Building Coding Problems
Stalker 26 Nov 2012
Hi,
So I have this model:
And I want to get it ingame. It has 3 Turrets and should be Garrisonable. The problem is that I didn't get it to work correctly yet.
I had two Ideas how to code it:
1.) Main Object has 2 Turrets, and an OverlordContain Module to contain an Attached Object which has another Turret, and is garrisonable.
- It works fine, but random crashes occur, when the building gets into damaged (or reallydamaged) state. Also If the Building is sold, the extra object keeps existing.
2.) Main Object is Garrisonable and has no Weapons. The 3 turrets are individual objects, created via Stinger Site logic.
- It works, but the turrets stay in the air during selling process, and they have no damged or reallydamaged states, which looks really dumb.
Any ideas?
~Stalker
So I have this model:
And I want to get it ingame. It has 3 Turrets and should be Garrisonable. The problem is that I didn't get it to work correctly yet.
I had two Ideas how to code it:
1.) Main Object has 2 Turrets, and an OverlordContain Module to contain an Attached Object which has another Turret, and is garrisonable.
- It works fine, but random crashes occur, when the building gets into damaged (or reallydamaged) state. Also If the Building is sold, the extra object keeps existing.
2.) Main Object is Garrisonable and has no Weapons. The 3 turrets are individual objects, created via Stinger Site logic.
- It works, but the turrets stay in the air during selling process, and they have no damged or reallydamaged states, which looks really dumb.
Any ideas?
~Stalker
Zeke 26 Nov 2012
Unfortunately your second method is the closest you can get in ZH. Though for the damage states, you can just add damage particle bones on the main model where the turrets are. It's not perfect but it's better than nothing.
n5p29 26 Nov 2012
better use the overlord contain. but since it's also garrisonable, how about using helix contain instead?
about the crash issue, maybe there's something else wrong in your codes.
about the crash issue, maybe there's something else wrong in your codes.
Zeke 26 Nov 2012
Stalker 26 Nov 2012
Random crashes seem to occur with both methods. However I'm pretty sure somethings's wrong with my model. How can a model make the game crash? (Sometimes it crashes when going from Normal into Damaged or Reallydamaged state).
IIRC Helix Contain requires a Locomotor and wouldn't work with Structures. Also the Firepoints wouldn't work.
EDIT: I did some testing, I'm 99% sure it's the model. Probably sometimes fails to load during state changes. But why?
-Too many Firepoints (it has 25)?
-Too much Alpha Channel (the big dirt pile)
-Too many (large) Textures?
-Too many Polygons? (I can't really believe that, it has ~2700)
Edited by Stalker, 26 November 2012 - 16:45.
IIRC Helix Contain requires a Locomotor and wouldn't work with Structures. Also the Firepoints wouldn't work.
EDIT: I did some testing, I'm 99% sure it's the model. Probably sometimes fails to load during state changes. But why?
-Too many Firepoints (it has 25)?
-Too much Alpha Channel (the big dirt pile)
-Too many (large) Textures?
-Too many Polygons? (I can't really believe that, it has ~2700)
Edited by Stalker, 26 November 2012 - 16:45.
Zeke 27 Nov 2012
Did you use .psd textures in the material editor? That can cause crashes. Also it would help if you post your codes.
Edited by Zeke, 27 November 2012 - 09:16.
Edited by Zeke, 27 November 2012 - 09:16.
Stalker 27 Nov 2012
All textures are .tga (I'll try with .dds later).
Well, here are the codes, however I don't think there's something wrong with it, as it was working just fine when I used a simpler dummy model.
Code:
Edited by Stalker, 27 November 2012 - 09:47.
Well, here are the codes, however I don't think there's something wrong with it, as it was working just fine when I used a simpler dummy model.
Code:
Spoiler
Edited by Stalker, 27 November 2012 - 09:47.
Zeke 27 Nov 2012
Stalker, on 26 November 2012 - 16:30, said:
-Too many Firepoints (it has 25)?
-Too much Alpha Channel (the big dirt pile)
-Too many (large) Textures?
-Too many Polygons? (I can't really believe that, it has ~2700)
-Too much Alpha Channel (the big dirt pile)
-Too many (large) Textures?
-Too many Polygons? (I can't really believe that, it has ~2700)
How big are the textures? .tga files are not ideal because they have really big file sizes and they generally don't look good compared to .dds files
If you are using hueg tga files that could be the problem.
Stalker 27 Nov 2012
I have already tried it with .dds. It still crashed.
I have also tried to simplify the model by attaching everything to a single mesh. It screwed up the alpha channel parts but it didn't crash. When I fixed the alpha channel, it crashed again. -.-
I have also tried to simplify the model by attaching everything to a single mesh. It screwed up the alpha channel parts but it didn't crash. When I fixed the alpha channel, it crashed again. -.-
n5p29 27 Nov 2012
have you checked all of the bones on the models? maybe the damaged models have something lack than the normal model.
Stalker 29 Nov 2012
After hours of trial and error I got it to work. I reimported, the w3d file, reapplied all textures, got rid of a few unneeded ones. When I edited the mesh for damaged models, it kept crashing ingame though. So at the moment there are only skin changes when it is damaged, but I'll leave it at that.
Thanks for your help, guys.
Thanks for your help, guys.
Zeke 30 Jan 2013
Double post bump, but I got an idea from a random convo with Kris. Try dividing the model and put the parts in different draw modules. I think SAGE has a limit on how many polies/textures it can handle per draw module.
Stalker 30 Jan 2013
I already put all the animated parts into another model, but that probably wasn't enough. It works at the moment, my damaged models however, are just reskins. My previous damaged models had a deformed mesh and crashed. That's probably because I attached all parts (with different skins) to a singe mesh. Normally that should work, but maybe I reached some limits there.