PDA

View Full Version : Game State



Imzogelmo
02-01-2013, 03:19 AM
It seems to me that for an RPG, you have to have some set of variables that comprise a save file, such that the game can get you back to where you were upon reloading. Obviously, this need not be *all* the variables that the game uses, but only some small subset of them.

It also seems to me that you'd have a rather large set of data that is in use during a battle, and some set that is in use outside of battle (smaller than the battle data but still larger than a save file). I think we can agree on all of those general statement.

While the battle engine is probably the most difficult thing to do, it is also the most *nested* in terms of code: a battle is called from somewhere else, and it is a self-contained module as far as what it accomplishes. Outside of battle, you never need monster data (barring some kind of bestiary), level up data (barring some event-based level system), magic data (excepting the few non-battle spells), item data (except a few healing/status items)... What I'm saying is that the battle engine essentially is the driver of all the data. Everything else is just walking around on a map and keeping track of very general things like time, money, inventory, map/position... and of course churning out "events" which are really just a script (step here, do this..).

So what all has to happen for battles to be a reality? (not in final form, but as a testable module)

Gleeok
02-01-2013, 04:33 AM
Yeah, It's basically three modules: The "world"; the interface (menus, shops, inventories, etc); and the battle engine. Each one of these breaks down into separate states of their own, often with their own set of states and so forth. While the battle code can work just fine without maps, events, or towns, we're going to need an interface just to be able to use a phoenix down or even to select the attack command.

The good news is I finished assembling most of the raw resource crap (minus player sprites -- in progress) which can all be loaded and saved, and debugged (mostly) the scripting engine, and have a fair amount of base classes done. This was a fairly time-consuming process which didn't reflect into raw code.
The bad news is I haven't had too much time to work on it these last few weeks. -Although I did manage to put together some BattleActions today.

Actually, once I get Player/Monster entities, a few script methods, and player sprites in, you can start on it whenever. I set the default resolution to 256x208 ... which is strange. I know that 256x224 is the normal, and GBA uses 240x160 (which seems cramped together), but take a look at some PSX screens and you'll see what I mean. ..It's obviously stretches the X to match a 4:3 ratio, but the sprites look like they stretch along the Y a little too... (Almost like the battles have a separate resolution of 240x200.) ..Can anyone shed some light on this?

King Aquamentus
02-01-2013, 01:51 PM
Recently, Game Maker threw out its save game/load game features (which were very primitive and none too specific), so users now have to take a very similar approach to accomplish such functionality.

As for the battle engine, I suppose individual monsters would run on a timer or possibly even deactivate under certain circumstances like having a menu open. (Chrono Trigger actually lets you choose as an option whether or not the game does this.) Probably the best course of action with monsters is to use your imagination as to their strengths, weaknesses, and counters.

If you haven't already, consider this for determining what you fight: create many different sets of battles, which can be randomly triggered depending on where in the world you are. If you're in the first few patches of grass and walk around a little bit, you might end up in a battle with any of the following:

A: two killer bunnies
b: five killer bunnies
c: two killer bunnies and a hornet

And if you're in the woods, one of these might happen:

A: one wolf
B: three wolves
C: one giant

Basically, these would all be different sets you would have to pre-make, and ask the game to return a random "set" id with a value-range floor and ceiling to make sure Cthulu doesn't pop out of the tall grass near Palette Town. You could alternatively attempt re-using the same values but adding an additional variable to determine what those values get you (like checking to see where you are), but remember that you not only want this to differ depending on your biome, but also where in the world you are.

Gleeok
02-02-2013, 04:48 AM
King Aquamentus: Actually, monster group encounters and regions are pretty much done. :)

For save files I don't know how it will work since there's nothing to save right now. ;)

Also, I must be smoking crack because I think that the res is actually 256x208. O_o ..I would like to get this closer to 4:3 but then it wouldn't look like FF..so never mind.

Imzogelmo
02-02-2013, 05:09 PM
Seems like font size should be some fixed fraction of the vertical resolution. I wouldn't be too fond of final fantasy with scroll bars, lol.

Gleeok
02-02-2013, 06:36 PM
The problem is I don't have any decent fonts. I downloaded a few but they all have incorrect metrics. People also do not know how to properly arrange bitmap fonts. /rant

Need to use one that looks good at 8 pixels tall (including 1 pixel minimum of translation) ideally. -For a bitmap font this would only be 128x64.