Snake - Loading cut-scene assets

Published October 13, 2019
Advertisement

I've worked through loading of cut-scene data from the JSON files, and am now figuring out how I want to load cut-scene assets.  I'm mostly typing up this blog entry as a way of documenting this to myself.  Cause thinking through this is a little bit hard. ?

When you hear "cut-scene", you might be thinking that I'm just going to play a video file before each level to provide some narration.  Nope, I wanted to make use of the game engine instead.  Cut-scene definitions are kind of like scripts that indicate which map to display, have the snake move around the map, make things appear, etc. on a timeline.  My hope is that this will make cut-scenes feel like you're part of the narration...  Many games we play will pre-render video files, often looking way better than the game itself -- I've always felt like I'm being taken out of the game when this happens.

In my head, the opening of story mode will show the snake moving through several areas before reaching the first playable map.  Background music will play, some narration occurs, and then the game begins.

Anyway, the challenge I'm facing now is that I decided to allow cut-scene definitions specify as many maps as the level designer chooses.  Currently, the "StoryLevelAssetBundle" class I wrote only allows for the level's main map and its textures to be stored.  I now have to expand that to store multiple maps across potentially up to three cut-scenes (one played before the level, another if the player loses, and another if the player wins).  It's also possible -- even likely -- that the same textures will appear across those maps.  It's even possible that the same map could appear several times.

So here's what I figure I need to do...  Note that I'm using the phrase game map in an attempt to distinguish it from the C++ unordered_map.

  • Loop through each cut-scene's event list to find all the references to game maps.  Load the game map definitions for them, probably keeping them in a std::unordered_map, keyed by game map filename.
  • It's probably still best to keep the level's playable game map asset separate -- during game play we want it easily accessible.
  • Loop through each game map definition, in order to load all the game map-related textures.  To avoid loading the same texture multiple times, keep all textures in a std::unordered_map, also keyed by game map filename.  If a texture has previously been loaded, we'll now know.
  • While looping through the game map definitions, we can also store the floor and barrier texture references in separate std::unordered_map's, keyed by floor or barrier ID.  However, the values will be pointers to the sf::Texture objects previously loaded.
  • I believe the game maps used within cut-scenes will need to be in a nested container structure.

Now that I have that written down, time to implement it!

I've worked out in my head exactly how the silly "Adam's Revenge" story will go, and I'm really looking forward to getting over this hump of being able to play opening cut-scenes before each level.  We have our Thanksgiving weekend here in Canada, and this is how I'll be spending it (well, the non-family part of it at least). ? 

The fate of the world is in your scales...

 

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement
Advertisement