Sunday, October 30, 2011

Smush Alpha Version Progress Report

Smush Alpha Version Progress Report

Preface
Smush is intended to combine rigid body mechanics with tower defense: the player places bombs that can blast apart terrain in the world, and the resulting flying objects are used to destroy incoming enemies.  So far, we have completed most of the fundamental mechanics of our game, including ray casted bomb placement, explosion forces, enemy models with following behavior, and vertical terrain growth.

Scene Modeling
In the beginning, we tried to model the scene with multiple different types of primitives in Unity 3D. Although it is faster to create certain structures in this approach, the collision detection(especially quirky for cylinder primitives) and terrain growth are too inconsistent with this variety of geometry.


First version of the game world

Subsequently, we switched to a model where terrain is built from Prefab 1x1x1 cubes. By controlling the activation and deactivation of the physics, we can still get the variety of structures we want while making their elements more uniform.

Game world version 2.0

Bomb Placement
Bomb placement is implemented by calculating a 3D ray from the 2D position of the mouse in the view port and camera transformation. We then do a ray casting test against the terrain of the game world, currently testing for collision only against the floor of the environment. We visualize the bomb placement zone with a transparent sphere that indicates the bomb blast radius, and we switch the shader of the blocks that are currently in contact with the bomb blast radius.


Bomb effect indicator and the cubes that are going to be affected by the bomb.

Boom!


Enemy Models
    The enemy models are created with Maya and imported into Unity3D via FBX Importer. A mesh collider is attached to the enemy model prefab to detect collisions with the blocks. Later, particle effect components are also added to the enemy prefab to showing the path of the enemy’s movement, and explosions when they are destroyed.

Flying enemy
Grounded enemy
Enemy in the game with contrail made by particle system

Enemy Behavior
    We control the enemies with a steering behavior. It is a path following behavior consisting of multiple seek behaviors: multiple way points are defined in the game world, and an the enemy agent gets close enough to its current certain way point, it will start heading for the next one in the path.  Enemies continue until they reach their destination (the player’s “base”) or are destroyed by contact with blocks.
    In order to make their paths more evident, we draw lines using meshes representing the paths the enemies may travel.

Enemy path drawn on the map


Terrain Growing
    Initially, terrain growth was done with a single controller, and the designer has to input the coordinates of the desired growth zone by hand into code. Later, we tried to grow the blocks in the game world according to a random distribution. But doing so generates too many unnecessary blocks and quickly pushes the game to the performance cap of the rigid body simulator in Unity 3D.

Growing pattern from the random function approach.

In the end, we decentralized the terrain growth by creating block spawning prefabs, with the dimensions of the prefab defining the size of the terrain growing area and the maximum height of terrain growth in one instance. This allows us to create and modify the amount of blocks in the stage easily.

The semitransparent boxes are the zones of terrain growth.
Random terrain growth in confined area

Putting It All Together
    We integrated all of the parts mentioned above and created a simple GUI tying them together. Players are able to start a wave of enemies, call for more blocks to be grown into the scene, and place bombs that will fling blocks around and kill enemies.
Screenshot from alpha build



Next Steps
    A few things that were not immediately planned for the alpha are evidently needed to make the game more of a game, as well as more playable.  There is currently no resource system restricting how many bombs the player can place nor to limit the player’s ability to request more blocks, and currently very little strategy or manual skill  is needed since the player can simply topple the blocks onto the enemy path where they will behave like land mines to the enemies.  There is also no indicator of how much time is left before a given bomb explodes.  Lastly, the game has no effective audio or visual cues informing the player of danger or damage.

No comments:

Post a Comment