First some random news, I got instant failed on my driving test earlier this week for driving through an amber light – but, I passed the second test today. Yay!
Back to topic. Not long after I got back from Te Anau, I decided to start a random project. I don’t have any formal plan other than this:
- “Run-n-gun” top-down shooter.
- Small & simple above everything else. Should be about a month’s worth of work.
- Everything is cubes & can be killed in a single shot.
- Player moves via keyboard & aims/shoots via mouse.
- Enemies of two types: chargers & shooters. Kill player on contact.
- Optional: coloured variants, e.g. fast, two lives, etc.
- Optional: other enemy types, e.g. spawners, shielders, etc.
- Very simple level generation.
Player & enemy cubes can rotate, with their facing direction shown by their texture. Chargers simply move towards you. Shooters simply shoot at you, they don’t move.
I was thinking of using BSP Tree level generation, but I’m thinking of something even simpler. I’m not sure what the name is for it is, so I’ll just explain it. Think of the level as a grid, like in Noughts & Crosses, & you have a few lists of pre-made rooms; one for corner spaces, one for side spaces, & another for centre spaces. All pre-made rooms are the same size & composed of floor & wall tiles.
For each space on the grid:
- Choose a list of rooms, depending on where the current space is on the grid, e.g. list of centre rooms if not at an outer space of the grid.
- Randomly select a room from the list.
- You may need to rotate the room at corner or side spaces so they are accessible, unless you have additional room lists for these cases.
- Place room in the current space & repeat above until done.
I’m not going to worry about connecting rooms as each pre-made room should be designed to connect to all neighbouring spaces. This will result in very predictable levels, but it’s about as easy as it gets to code level generation.
I’ve been doing bits & pieces over the past while & my current progress is:
- The player cube & template room.
- The player cube moves via the keyboard, rotates to face the mouse cursor, & shoots cyan lit-up capsules on mouse click.
- The capsules, or “shots”, move forwards & destroy themselves on hitting something.
- The camera follows the player, giving a top-down view.
- The room is composed of 16×16 floor & wall tiles (hand placing these can be tedious).
I’ve already encountered some issues, mainly to do with physics & colliders. It’s easy for the player to be able to squeeze through walls, no matter how overlapped the wall colliders are. Looking online, this seems to be a common problem with tile based games, at least in Unity. The only thing apparently certain to work is to merge adjacent colliders on run time, somehow. Fortunately changing the room size, applying a “physics material” to the player, & tweaking it seems to have stopped this, so far. It hasn’t stopped the player from randomly bouncing off walls on contact though.
I know this project is kinda random but I felt like I needed to do something other than be stuck trying to figure out how to make RPG Maker combat better without scripting. I do admit I’ve been focusing more on this than my RPG Maker project lately. It’s not fun being stuck.