Thursday, 29 September 2016

Level Layout Sketches and Pseudocode

I wanted to create a walkthrough of how a level would work in my game, as an exercise to better help me understand how the core gameplay loop will work and what is potentially missing from the game as it stands. Below I have sketched out a rough diagram with annotations, as to how a level may be set up.
A simple level sketch

The yellow bar at the bottom is the door to the room, and as a result it is where the player will spawn in from when they enter the room. From here they will be able to move around the room, they will collide with scenery, and they can leave the room if they wish.
  • if player enters the room {
  • spawn them at the door
  • }
  • if player hits move keys {
  •        move in the corresponding direction
  • }
  • if player collides with scenery {
  • stop the player moving in that direction
  • }
  • if player collides with door {
  • leave the room
  • }

In a standard room in the game, enemies will already be placed in the room, and more will spawn from the designated enemy spawn point. The basic enemy AI will see them move towards the player, until they reach a certain distance, and then start shooting.

  • if player enters the room {
  • enemies start moving towards player
  • }
  • if enemy is close enough to player to engage {
  • start shooting at player
  • }
  • if enemy hits player {
  • player loses 1 health
  • }
  • if all enemies are dead {
  • spawn another wave of enemies from the enemy spawn point
  • }


   When players manage to hit and kill the enemies, they gain score, and there is a chance they will drop money, keys, ammo or health. If the player is lucky enough to have the enemy drop a key upon death, they will be able to open a chest.


  • if player kills enemy {
  • enemy dies
  • enemy has a chance to drop loot, loot randomly selected between the four options
  • player gets 100 more score
  • }
  • if player is next to chest and has a key {
  • player opens chest
  • player uses and therefore loses 1 key
  • player gains random loot
  • }

   Not every room in the game will be a combat room. Some rooms will contain NPCs that aren’t enemies. They could be traders, quest givers, puzzle rooms. The way these rooms function is that the player will be able to move around the room as normal, and when they approach the NPC they will be able to interact.
  • if player is next to the NPC and hits the interact button {
  • contextually interact with the NPC eg. talk, trade, give item
  • }
 These are the individual rooms, but these rooms are connected by overall levels.
    These levels are randomly composed of different rooms, although every level will have at least one NPC room and one boss room. The player will spawn at the spawn point on the left, and can choose to go into any room in the level at any time.    

  • if player enters the level{
  • spawn at the player spawn point
  • }
  • if player walks into building{
  • spawn into the corresponding room
  • }

   This is the core gameplay loop to my game. The player enters the level, walks to a room, completes the objective within the room, gets loot, leaves room, and repeats until all the rooms in the level are completed.

1 comment: