I'm thinking ahead at the moment, but I want to obviously use Lua as my scripting language in my engine.
What I want to do, is have
Events essentially on my map.
You can create either:
NPCs,
Signs and
Scripts.
Each event ties back to a script, I want to have my events in my map file look like this...
Which is first the
ID of the event so I can reference it from other events.
Then
Event Type which is either 00, 01 or 02.
Then
X and
Y for position on the map.
Then there's
Sprite which will be the sprite ID of the event or 00 if there is no sprite.
Then the
Face of the sprite. This value is either 00, 01, 02, or 03 (4 faces). The value is used for NPCs to chose what way they face.
Then
Moving is just a 00 or 01 value. Either they're not moving or they are. The moving is just a random movement.
The last is
Script and that is the script ID that the event is associated with.
Now, there are two issues I need to address.
First off, is how I'm going to compile a list of Sprites to associate with the Sprite ID.
Sprites will be stored in a sprite folder.
There will be a tool created that will allow you to add sprites to a list and save out a binary file that will store the name of the sprite texture file and the ID associated with it. The byte
FF will signify the end of a filename string.
Here is an example of 3 sprites (in readable form)
Code: Select all
01 "hero.png"
02 "evil_bad_guy.png"
03 "warrior3.png"
Each sprite file is going to be a different length, so instead of just wasting space by creating a static size, I will just use the byte
FF to separate the end of the texture.
Here is that same list in hex:
Code: Select all
01 68 65 72 6f 2e 70 6e 67 FF
02 65 76 69 6c 5f 62 61 64 5f 67 75 79 2e 70 6e 67 FF
03 77 61 72 72 69 6f 72 33 2e 70 6e 67 FF
In the actual file, they wouldn't be split up on lines (obviously) but I did this so you could see the break more easily.
So when the engine starts it parses the sprite binary file and adds the sprite textures to the
Sprite Texture Manager.
Same goes with the scripts as well, those can be taken care of with a script manager as well.
A separate manager class can be created to handle loading those in, however, I'm not entirely sure how to link Lua up to C++ yet so I'm not sure what I'll do until I read up some more.
But yeah, figured I'd get that down so I don't forget later
Let me know what you think.
ALSO! The editor in SDL is kind of coming along... not really though.
I'm currently working on it though... so I'll let you know how that goes.
I think I'm looking too much into the big picture.
I'll just focus on the UI alone first then I'll worry about the entire map editor later.
So far, Buttons have been created... that's it... lol.
Well that is all.