One step back, five steps forward
While developing In Between we had the idea of dynamically shattering a specific story scene into pieces.
The scene should shatter based on the players position in the world and should react to it in realtime.
We discussed the matter and came to the conclusion that we would create an animation in 3D Studio Max, export it to Unity as .fbx and then set the animation timeline position based on the player’s coordinates. This way we would have the most freedom in staging the animation.
Matthias ended up creating a pretty cool animation. It was well thought out and shattered nicely.
Shattering the story scene
Then he tried to import the animation into Unity.
It turned out, that you can’t bake some modifiers in 3dsmax so when he exported the model, the shatter-animation was missing. We tried different scripts that would first export the model frame by frame and then re-assemble it in a second step, but these often crashed and if they didn’t crash the outcome was completely wrong. At this time, Matthias had spent 4-5 hours on the whole thing and was now pretty busy with cursing 3dsmax.
Me: | “Well...i could try to write a shader for this effect ... shouldn’t be too hard. But i can’t promise if it’ll be fast enough on mobile devices ... drawcalls or fillrate might kill us” |
Matthias: | “You can do that … ?” |
Me: | “I guess” |
Matthias: | “How long would that take?” |
Me: | “About 30 minutes to 1 hour for a prototype” |
Matthias: | “I think you should give it a try” |
So I started working on it and to my surprise had a working prototype in about 30 minutes (more on the technique in a future post). I then started playing around with it…
About 1 hour later Daniel looked over my shoulder, trying to catch a glimpse of what I was doing all the time.
Daniel: | “What the...this looks great!” |
Me: | “What the… where has the time gone!?” |
Daniel: | “We should totally make this a gameplay element, this looks fun!” |
Me: | “Yeah… I have been blowing up spheres and cubes for an hour ... I guess you are right” |
So I ended up putting the shatterizer in every scene, blasting the level into pieces each time the player died without any sort of pre-production or baking. I also introduced a special “Shatter Mode” to the game that will be unlocked once a user played through the game once, making it significantly harder to beat the game. Over the time I also extended the system step by step to make the game more responsive to the player’s actions in general.
Game Over
So, after all, 3dsmax modifiers not being bakeable was actually a good thing. Not only is it a lot easier now to shatter a level, it is also easier to tweak the shattereffect than it was in 3dsmax as we can directly change its values inside the game on the fly. It’s also more responsive and led to an improved look and feel of the game. Oh and it also helped us in solving a pretty big dilemma with storytelling (more on that in a future post).
Shattering the backdrop, revealing the storylayer of the game
Sometimes limitations can really help to push your game forward as they force you to think in other directions.
Do any of you guys have similar experiences you want to share?
-Wolfgang