Automatic wreck generation system
Moderator: Moderators
Automatic wreck generation system
Alright, I'm really tired right now and nothing makes sense. Sorry if this makes no sense.
Alright, so in my sleepless daze, I had an idea for automatic wreck generation. It's simple: specify specific vertices (possibly with constraints for motion) in the model and set a flag in the unit def. Then, once the unit dies (post-death anim, etc), the script deforms the specified vertices by random values (possible, see Kloot/jK's code and beherith's wiggling trees) to create a wrecked mesh. For the texture, I think it would be best to add a Luacob function to overlay a texture with other images and desaturate.
Did any of that make sense?
Alright, so in my sleepless daze, I had an idea for automatic wreck generation. It's simple: specify specific vertices (possibly with constraints for motion) in the model and set a flag in the unit def. Then, once the unit dies (post-death anim, etc), the script deforms the specified vertices by random values (possible, see Kloot/jK's code and beherith's wiggling trees) to create a wrecked mesh. For the texture, I think it would be best to add a Luacob function to overlay a texture with other images and desaturate.
Did any of that make sense?
Re: Automatic wreck generation system
if that is possible, why not have it for alive units too!the script deforms the specified vertices by random values
wtf link?(possible, see Kloot/jK's code and beherith's wiggling trees)
Re: Automatic wreck generation system
it does make sense
i can see the following issues:
- you would have to be careful with which verts you selected, might end up strange if you stretched a quad and it ended up being larger than the original
- stuff like wheels/barrels that "explode" away from the unit ATM when its destroyed would have to be accounted for.... it would be peculiar to see a wheel bounce away from an exploding vehicle and then to see it suddenly reappear on the wrecked mesh
-would selecting verts for deformation take a longer time than reskinning/distorting a model to make a wreck in the classical sense? im not sure; this would have to be examined for viability (because it all falls apart if this method actually takes longer to implement for the artist)
however the strong points related to this obv are the texture-swapping on damaged units as demonstrated and the pseudo-random nature of generated wrecks, so its defenitely an idea with merit
personally this makes me think of possibly running a macro within a 3d editor; something to load up a model, "relax" some of the vertices and make them sag downwards on the vertical axis, replace the skin, and then by hand possibly adjust some of the finer details like fallen-off tires and pipes etc... this way at least would avoid uvmap distortion
just my thoughts on the matter
i can see the following issues:
- you would have to be careful with which verts you selected, might end up strange if you stretched a quad and it ended up being larger than the original
- stuff like wheels/barrels that "explode" away from the unit ATM when its destroyed would have to be accounted for.... it would be peculiar to see a wheel bounce away from an exploding vehicle and then to see it suddenly reappear on the wrecked mesh
-would selecting verts for deformation take a longer time than reskinning/distorting a model to make a wreck in the classical sense? im not sure; this would have to be examined for viability (because it all falls apart if this method actually takes longer to implement for the artist)
however the strong points related to this obv are the texture-swapping on damaged units as demonstrated and the pseudo-random nature of generated wrecks, so its defenitely an idea with merit
personally this makes me think of possibly running a macro within a 3d editor; something to load up a model, "relax" some of the vertices and make them sag downwards on the vertical axis, replace the skin, and then by hand possibly adjust some of the finer details like fallen-off tires and pipes etc... this way at least would avoid uvmap distortion
just my thoughts on the matter

Re: Automatic wreck generation system
no no non ononono. do not build a wreckage generator into the engine.
instead allow Lua to deform vertices. Then when somebody asks "can i haz randomly broken wreckage?" you go "trolololo lua it!"
And then somebody makes a gadget and everybody copies it into his game and there was much joy.
instead allow Lua to deform vertices. Then when somebody asks "can i haz randomly broken wreckage?" you go "trolololo lua it!"
And then somebody makes a gadget and everybody copies it into his game and there was much joy.
Re: Automatic wreck generation system
You cant put shaders on features yet. Worked for units though:
BaNa wrote:yeah thats pretty nice i guess
BUT WAIT
WHAT IF MODEL GOT DAMAGED TOO?
![]()
Re: Automatic wreck generation system
i remember that from random wip.
so is it released? guide? i would use it or at least would like to look at it.
and what about that wiggling shark http://springrts.com/phpbb/viewtopic.ph ... =shark.gif
i downloaded it but the shark does not wiggle. i put him in water and [x] enable luashaders support but no wiggling.
so is it released? guide? i would use it or at least would like to look at it.
and what about that wiggling shark http://springrts.com/phpbb/viewtopic.ph ... =shark.gif
i downloaded it but the shark does not wiggle. i put him in water and [x] enable luashaders support but no wiggling.

Re: Automatic wreck generation system
Beherith wrote:You cant put shaders on features yet. Worked for units though:
was added not too long ago...Spring.UnitRendering.SetFeatureLuaDraw (enables the LuaRules' DrawFeature callin)
( number featureID, boolean enabled ) -> nil
is this not what we needed?
Re: Automatic wreck generation system
Sorry for the offtopic, MK.
Smoth, is this in master yet?
Knorke, ill try to dig it up, but you may have to ask BaNa for it.
Smoth, is this in master yet?
Knorke, ill try to dig it up, but you may have to ask BaNa for it.
Re: Automatic wreck generation system
IIRC it should have been in last release.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Automatic wreck generation system
Btw, I added all that stuff to evo, but the only thing I couldn't get working was the unit damage stuff. Could you maybe have a look and see if you can figure out what I fucked up?Beherith wrote:You cant put shaders on features yet. Worked for units though:
BaNa wrote:yeah thats pretty nice i guess
BUT WAIT
WHAT IF MODEL GOT DAMAGED TOO?
![]()
Re: Automatic wreck generation system
Looks like Photoshop's plastic texture filter. Makes sense though, to ruin a unit, you just apply as many filters as you can to it till it becomes a wreck 

Re: Automatic wreck generation system
Smartassery only works if you get it right: Craquelure.
Re: Automatic wreck generation system
Licho and me had a brainstorming about this topic ~2years ago.
We came to the result that the best way is:
We came to the result that the best way is:
- to transform the model into voxels
- apply destructive operations on it (explosion, gravity, melting, ...)
- transform the voxels back to polygons (-> MarchingCubes etc.)
Re: Automatic wreck generation system
Are voxels really the best way? I think Zerg and I talked about them briefly several years ago, but it was my understanding that the lack of acceleration was prohibitive and given the low hardware specifications many players work with, very few operations using voxels could be performed at once. Of course, if this is client-side and can be toggled, then it becomes more reasonable.
Anyway, I know little about OGL and the modern situation regarding voxels, so I'd like to learn more if you have the time to elaborate. I personally feel that hand generated wrecks will always be best, but given the tools many are using, they aren't convenient.
Anyway, I know little about OGL and the modern situation regarding voxels, so I'd like to learn more if you have the time to elaborate. I personally feel that hand generated wrecks will always be best, but given the tools many are using, they aren't convenient.
Re: Automatic wreck generation system
unless your units are made of plasticine i don't think it would make something nice but GOGOjK wrote:Licho and me had a brainstorming about this topic ~2years ago.
We came to the result that the best way is:
In theory it should be very easy to code this (except the marching cube algo., but there is code for that on the inet).
- to transform the model into voxels
- apply destructive operations on it (explosion, gravity, melting, ...)
- transform the voxels back to polygons (-> MarchingCubes etc.)
Last edited by Satirik on 12 Apr 2011, 20:45, edited 1 time in total.
Re: Automatic wreck generation system
Neddie wrote:Are voxels really the best way? I think Zerg and I talked about them briefly several years ago, but it was my understanding that the lack of acceleration was prohibitive and given the low hardware specifications many players work with, very few operations using voxels could be performed at once.
No voxels are rendered, they are just needed for natural transformations of the mesh.jK wrote:
- transform the voxels back to polygons (-> MarchingCubes etc.)
Re: Automatic wreck generation system
Ah, that makes sense, particularly since the death effects will mask the switch over so there is no need to render the process. Thanks for clarifying.