I decided to write a short post about how I have arranged and developed my level flow and core gameplay in Deadly Bullet. To visualize it all I took this screenshot from Unity to clear things up, check it out (click to enlarge):
I have one of the levels of a certain location (city) opened up. I have 4 different locations that are all unique, and all of them have 3 levels that are variations of the same theme. Say, we have this city location here that has CITY A, CITY B and CITY C levels. Each of them have a different layout to make the game feel fresh as player climbs up the level loop in one location.
Each level shares the same Core prefab. Core prefab includes all the core gameplay elements that are same everywhere, like how the spawning of enemies, powerups and bonus objects are handled as well as all the player, AI, menu, camera and HUD logic. The only custom assets in each level are the level geometry pieces. I use a template arena of certain size that has bounds visualized for easier design of the levels.
Looking at things under the Core prefab, we have first the GlobalController. This is a dummy GameObject I use in all of my games to handle global stuff like statistics, spawn logic, difficulty scaling and other common elements such as the player inventory, level or XP amount.
Next is the Main Camera that is the game camera. Nothing special here, I have a pretty simple code that just follows the Player GameObject and rotates the camera slowly locally to give a nice twist effect (pretty much stolen from Super Hexagon, great game btw!) I need to work on the camera a little bit more to be lazier and drag behind, and not just follow the player stiffly.
Under the camera we have the Music Player. Again, simple stuff in a script that takes in all the tracks to a fixed size array, shuffles songs and doesn’t kill the GameObject when switching between scenes.
Last but not least we have the Player GameObject that includes the player script that has all the obvious variables like speed, turning rate, platform specific controls, collision detection and so on.
Under the LevelGeometry dummy GameObject I have all the visuals of the level and also some special nodes like waypoints for the special enemies and player spawnpoints. Player death is detected just by checking for an collider tagged as “Lethal” and all the objects like the buildings here are using that tag. The waypoints for special enemies (such as the biker that drives a certain pre-defined path) are also tagged and stored to an array on the start of the level. The array is then sorted to get the correct order for the enemy to know which node leads where.
That’s pretty much all of it in a nutshell, on a pretty high level. I didn’t want to go into boring (and messy) details here but just to show an overview how my levels work. I’m pretty sure I will be releasing the sources once again at some point post-release like I did with my earlier games Chompy!, Lumo and Seasons. That reminds me, maybe it’s time to put out the source code of MUKS soon…