State of the OceanThat stuff looks professional...but also necessary for such an intensive job.
Anyways I programmed something today (like the little spiky animal in metroid that climbs walls) and Jon thought of sticking that behavior onto other entities...so that's cool. We can use that logic elsewhere for moving fans, spikes, etc
Event / Cutscene Managementwhy do thisEven the Ocean has a lot of cutscenes and events that rely on other events having happened. Thus, managing what cutscenes I've finished, need work, or how to debug them, can be complex. So I made this spreadsheet to calm my nerves. Its overall effect is abstracting away the coding details, letting me have an overview glance at how game events change game state, as well as makes debugging easier, and have a brief understanding of each event, without having to click through files or memorize too much.
Ideally I would have an automated way to generate the spreadsheet from the cutscene script files, but I didn't plan (as in, I didn't even know what to plan for - this is the first time I've done something so complex) to think of a way to do this. So I'm hand-filling the spreadsheet, which is fine -I don't have that many scripts.
This is helpful with debugging,b ecause, say that in some random event, the game crashes or something goes wrong. Then I can use this spreadsheet to glance at what could have affected it. In general every event only relies on 1-3 other state variables to decide if it needs to run or not, so I can look at what other events set those state variables to help track what could have fucked the event up. Yay debugging!
what do the fields meanSo explaining the fields:
event_filename - Straightforward, this is the name of the script file which my "Generic NPC" (bad name , okay whatever) or GNPC object loads. More on what GNPC is later, but basically it's what lets the cutscene or whatever else run.
description - What it does. The examples here are: an event that stops you from going anywhere except the City on the world map, an event that triggers the world map tutorial. Others could be: something that blocks you from leaving an area, a forced dialogue triggering.
UNSET flags needed The event flags or dialogue state (see below for explanation) that must be equal to 0 for something to run. So in this case, if the dialogue state variable intro/map/1 is set to 1, then this scene can't run.
SET flags needed Flags that need to be set for the event to run. If it's EF_23 (intro_console), this means that something somewhere else has to have set event flag #23 to 1 for this event to run.
FLAGS CHANGED Keeps track of the game state this changes. in the piture, intro/map/1 > 1 means that I set 'intro/map/1' to 1 ('played') from its original value, 0 ('not played').
location Where this event is located (map name)
definitionsEvent flag: just little numbers to store info about the game (Did I finish level 1? What was level 1? etc) . Often represents a "did or did this not happen", but I can set them to any integer if I want store more complicated data (e.g., the first 3 main areas have AREA_IDs of 1, 2, 3. I set Event Flag 26, "First area started" to 1, 2, or 3 depending which area the player goes to first, so that I know this in future events.)
Dialogue state: Dialogue in this game uses a CATEGORY-SCENE hierarchy. A Scene is a collection of lines of dialogue, e.g.
"Bob: Hi"
"Alice: Hey"
That also contain relevant dialogue tags for branched dialogue, portrait, speaker name, dialogue box location...etc.
So an example might be "town/merchant/1", or state variable #1 from dialogue scene Town-Merchant. Each category-scene pair has two state variables, '1' and '2'. These can be set to any number. They are usually used to denote whether the scene has been read by the player or not.
---
Overall there isn't much difference between Event flags and dialogue state, it's just organization purpose. And sometimes I add empty dialogue scenes to use them as state variables....anyway.s...heheh
GNPC / generic npcGNPCs are..complex, and poorly programmed. They're a giant mishmash of things. Most of the time, they are NPCs you can talk to. You can attach scripts to them to make them change the state of the game (set dialogue state / event flags), or do fancier things like move, affect other objects.
They also can be cutscenes or events. I could make a GNPC be an invisible rectangle that blocks your way if the right conditions or met, or I could make it an invisible trigger that spawns bullets, or it could spawn a bunch of other NPCs to make a complex cutscene with many moving people...etc, move the camera, move the player, hide the player, change to different maps, change songs, play sounds, etc.
In theory if I gave people the API I made for them, you could script anything you want in the game :O to affect anything!!! Oooh
The scripts are in Haxe, and someone cool wrote a library that parses these scripts IN REAL TIME!! and interprets them...magic. (It's called 'hscript')
Anyways, there's a bunch of details for how it all works and stuff, but it basically lets me do anything without having to make compiled, hard-coded entities for everything.
misc serialization notesall the dialogue state and event state are saved into 2 files. if you die, then it reloads the data from your last save. Thre's some trickiness with quicksaving and temporary checkpoints, but quicksaving essentially creates a temporary entire save file that is loaded from (with some meta data denoting it as temporary), checkpoints cache relevant state (dialogue state, entity states if relevant (ugh), event states.)
---
END
--------------------------------
Video game stuffI also played some of professor layton and phoenix wright...it's...actually a fun narrative game. The narrative is a mystery and not really super interesting, but the way the gameplay goes through it is cool. Part visual novel, part SAT reading comprehension, part random logic Mensa puzzles, part hidden object. I also played through Super Luigi U. Gonna do the rest of levels/star coins. I actually got the bundled version