Deli-Slicer / CatBurglar

0 stars 0 forks source link

Implement multiple layers for Renderer #3

Closed pushfoo closed 3 years ago

pushfoo commented 3 years ago

tl;dr

We are going to need to have multiple sprite lists or draw "layers". We may also need to have a LayerManager that keeps track of sprites and allows them to request moving between layers.

If problems come up where we aren't sure of how to implement this or need to solve another problem first, making another ticket that mentions this one would be ok.

Why?

Example 1: Setting up the Puzzle

An NPC sits down behind a desk, facing the screen

The player's solution to this game scenario would be to sneak behind the desk. To depict the NPC facing forward, the following would need to happen:

  1. Draw the chair behind the NPC
  2. Draw the NPC in front of the chair
  3. Draw the desk in front of the NPC and the chair

Example 2 : Core Gameplay

You need to sneak behind an NPC at the desk Continuing from the example above, the player character will need to be drawn behind all of the above. To draw the player character sneaking, we will need to draw the player before the NPC and the furniture. The draw order will need to go as follows:

  1. Draw the Player
  2. Draw the chair behind the NPC
  3. Draw the NPC in front of the chair
  4. Draw the desk in front of the NPC

Example 3: Gameplay Variety

Having NPCs face in a variety of directions will allow us to add more variety and complexity to puzzles. To draw the NPC sitting at a desk with the NPC's face away from the screen with minimal asset load, we probably want to draw three pieces in the following order:

  1. Draw the desk the NPC will be sitting at
  2. Draw the NPC that will be sitting on the chair
  3. Draw the chair over the NPC so they appear to be sitting on it with their back to the player

What Layers?

Something like the following layers, ordered from first drawn to last, will be needed to draw the game:

  1. Static Background cached, non-changing tiles likely loaded as a pre-rendered image or TMX.
  2. Sneak Behind Layer When crouched / sneaking behind objects, the Player's first sprite gets drawn at this point.
  3. Furniture Far Layer Desk Jockeys that face away (using a computer maybe?) will have desks that is drawn here
  4. NPC Sit Layer Sitting NPCs go here
  5. Furniture Near Layer Desks facing the player will go here
  6. Normal Actor Walk Layer Most walking actors will walk here
  7. Darkness Overlay If we include lighting effects, they will get drawn here
  8. Highlight Layer / Effects The overlay/outline of the player will get drawn here, as will the highlights of interactive objects that are in range and currently selected
  9. UI Elements This happens automatically if we use the UI manager class

How?

Each layer might need to be a separate sprite list stored in a LayerManager class. In addition to having a method to draw everything, it may also be convenient to put an update method on it.

Implementing the player's see-through view when sneaking We might be able to draw the player's current animation frame a second time at partial transparency as a way of showing their position. This implies desks have to be light colored. This may need to be implemented as a second sprite, which raises questions about whether we'll make game objects with multiple sprite components.

pushfoo commented 3 years ago

Outdated ticket, not enough time to build this gameplay for this game jam.