Skip to main content

Logic Flow

Over the weekend I expanded upon the logic processing or my game engine.  Originally it would process all of the logic for the current room (a level essentially), actors in the current room and any logic scripts held in a global list.  When a new room is entered all logic not contained in the global list is dumped and the new room and actor logic is run.

There are functions to load and stop global logic so if I needed to kick off logic that would process across multiple rooms that is very easy to do.  But I hit an issue putting together a new room that needed to have more complex logic that was executed only in that room.

I could make a script that is run globally but I would need to make sure to kill it when the player exits the room.  This is not a problem but it does leave plenty of room for error if you forget to kill it when the room exits.

Introducing "local logic" all the flexibility of "global logic" but with out the need to clean up.  The local logic gets emptied any time the room changes.  Now I can kick off scripts on the local level and not have to worry about cleanup though I still have the power to kill the script at anytime.  Now you can break up the logic into many smaller pieces and start and stop them through the main room script.  Its like Lego but with game logic.


Comments

Popular posts from this blog

Plunder Bunny | Flash Game Character Mockups

Another collection of design/mockup sheets for a personal project.  The game was a very simple 2D platformer in the vain of Super Mario.  I got pretty far with the game but ended up getting busy with some contract work and the project feel into the ever growing abyss of personal projects.  When I get some more free time I'd like to try and re-visit it. The visuals were really fun to work on.  Inkscape was used to flesh out my initial sketches.  Each character was broken up into pieces like a paper puppet.  After Saving the pieces out at high resolution they would then be put back together in Blender 3D where they would be animated.

Level Buddy | Blender Addon

An old-school CSG inspired level editor add-on for Blender 3D. The add-on is still very much a work in progress but fairly solid for blocking spaces super quickly.  Just because graphic fidelity has gotten insanely good and hyper detailed doesn't mean we shouldn't look back how older games were put together, at least that is my opinion.  One thing I always come back to is how quickly the tools in the first 2 versions of Unreal Ed 2 and Doom level editors allowed anyone to block out a level, iterate on feedback or try an idea out.  So I just took some time to put together a similar pipeline right in my 3d package of choice.  I wanted to keep it simple and quick to try out level design ideas.  You can use it for simple white boxing of your level, break it up into multiple static meshes and import them into your game engine of choice or  you can use that as your starting point to start more detailed modeling .  When you build the map you get a single static mesh th

Data First Project

Last post I talked about a project I started using the approach of designing the data first.  It is my current pet project and one that I will keep exploring and playing with because it is so much fun.  So here are some snippets of code the show the structure of my data and some of its values. One thing you might have noticed is that I am using the JSON data structure.  JSON is a great format and pretty much every language already has a JSON parsing library so it really let me focus on the design of the data and how each piece would reference/connect to other bits of data.  Just like code you spend a good chunk of time very early on iterating your data design.  My first attempt I found that I was nesting things way more then I really needed.  Since there was no code at this point it was super easy to just move things to new sections and make large sweeping changes until everything started to make logical sense for what I wish to accomplish.  As the data structure started to grow