Error!

A-Engine Update #7: Sugar and Candy

Hello everyone!

It’s been a while since I last wrote something. There has been a couple of projects higher up in my priority list that kept me busy in the past period, but this doesn’t mean there isn’t anything new to write about here. Today, I plan to go over various new features and other tidbits that I haven’t covered before. I’ll try not to go over too much details that would fit better in a documentation, but you can always ask for more information in the comments if you’re interested in knowing more.

 

First, let’s talk about an A-Engine project’s structure. In the rewrite, I’ve been trying my best to hard-code as little things as possible. The first thing the game does when it launches is looking for a file called config (no extension) in its working directory. The content of this file looks like this:

{directories}
  SYSTEM = "data/system.a"
  LOAD = "data/load.a"
  PREFERENCE = "data/preference.a"
  LOG = "log.a"
{/directories}

It’s basically a list of directories of important files an A-Engine game looks for when it launches. You’re free to name and place any of these files anywhere you want, leaving the config file to be the only one with a fixed directory at all. Here’s a short summary of what each of the 4 files contain:

system.a contains all global settings describing how different components (window creation, physics, input, graphics..etc) will work with your game.

load.a contains a list that references object files, stage files and general assets your game will need.

preference.a contains settings and data that can be permanently changed by the player through the game. Things like key configuration and save data (permanent variables) are stored here.

log.a contains messages you can let the engine spew (for debugging reasons). You can also choose to have the engine write detailed crash log messages to it – after closing gracefully – instead of bringing them up in a pop-up dialog with information often irrelevant to players.

Now, have a screenshot:

Error!

Error!

To many, such level of error report is rudimentary. But to those who came from modding LF2, things were never this accurate! No more combing through hundreds of lines for that typo you made last night. I’ve done my best to have the A-Engine report any detectable common error in a similar manner, too – from syntax errors to invalid directories to invalid values (negative frame numbers or non-existent frame ids given to constant tags)  and much more.

Notice how content of one .a file can be divided to multiple other files at will with the help of >IMPORT. The effect of importing a file is identical to copying and pasting its content to where >IMPORT is. This will come handy when dealing with giant .a files, or when you have a set of lines that are reused in multiple other .a files.

The eagle-eyed reader should have noticed a number of discrepancies over what they saw in the screenshot and things I’ve went over recently. This part in particular:

click<jump> = "jump"

Clicking the jump button will take the object to the “jump” frame, fine. But I said last time that all action mapped action keys in the A-Engine are named from 0 to 9, so should this be something like click<0> = “jump” or maybe even click<1> = “jump”. Did I decide that I’m going to give them default names or something? No. The answer lies somewhere in system.a under the {input} main component:

  {map_keys}
    MAP_KEY = "<0>", "<attack>"
    MAP_KEY = "<1>", "<jump>"
    MAP_KEY = "<2>", "<defend>"
    MAP_KEY = "<3>", "<special>"
    MAP_KEY = "<4>", "<taunt>"
    MAP_KEY = "<attack|jump|defend|special>", "<action>" 
  {/map_keys}

What happened is that <jump> is set to be an alias for <1>, just like how <attack>, <defend>, <special> and <taunt> were mapped to <0>, <2>, <3> and <4> respectively. In the last line, <action> was implicitly mapped to <0>, <1>, <2> and <3> (or <attack>, <defend>, <jump> <special>). As a result, hold<action> = would activate when any of these buttons are held in a frame. You can map your buttons to any names you like, given they follow some simple naming rules (no spaces, special characters other than “_” nor names beginning with a number).


 

And that’s it for today’s update. I’m sorry if its less dense than usual. There are much more interesting things I’ve been working on, but I didn’t write about them today because I haven’t finalized with how they work yet. I’ll try to get back to you guys as soon as I get the chance. And as usual, if you have any questions or comments, post them in the comment section and I’ll answer everyone of them to the best of my ability.

Have a nice day!

Comments (1)

Add A Comment

Your email address will not be published. Required fields are marked *