PDA

View Full Version : Programming a 2D RPG Engine of sorts.



Chesso
08-01-2009, 05:54 AM
So I have some basic tile specifications, a basic graphic setup that can handle 4 layers of tile drawing on 1024x768 map surface.

I was going to start building a basic editor before going much further (so I can obviously test maps out quickly rather than manually write out the information of every tile).

But then I thought to myself...... hold on a second, how in the hell will I manage some form of scripting/events for maps (so I actually can have a game built and run instead of a char running around maps aimlessly).

So, what sort of implementation ideas do people use?

I am pretty sure I can handle map editing, maps, a hero, warp points to go from map to map, layered tiling etc), but the actual event driven part I am unsure of where to even start.

Traveler
08-01-2009, 11:58 AM
That largely depends on what rules you have in the game. I'm sort of had the same problem with Village Defense.

When I first started, I created an editor just for building the maps. ie, placing the tiles and setting some to obstacle or road properties. I later found that too limited as I also needed something to handle all the images and animations, so I started over and decided not to use a (map) editor, but to have editor functions within the game (functions such as placing objects, is something I require in the game anyway) and a separate editor for images where I can add properties to each image, such as height, width, but also name, type, whether parts of the image should not be walked on, selection criteria, which layer, important coordinates (required for shooting, or from which position to begin drawing) etc etc.

I've not yet given much thought about events/scripts. At this point I believe I don't really need them as every object is probably going to have its own set of rules, that do not change during the course of the game.

efilnukefesin
08-01-2009, 03:26 PM
yeah i'm with traveler here... i think it's no bad idea to integrate an editor directly into the game, but you clearly need to seperate the two parts and make the editing part to be turned off by one variable. but id you construct your game like that you could make extra editors as well. you only save the initialising parts i think.

personally, i have my editors and my game as seperated programs, but sharing the same source units, because that makes sense and you're always up to date and don't have to program everything twice.

an idea for a scripting system would be a simple parser, i think there are no ready-to-use-solutions to have a look at, but you could use some xml-like format or a completely new thing. then you'd have to make sure all needed information can be given, e.g. position to execute, action to execute, ... and the parser unit or object or whatever will parse this file and will make the given things. but i think you'll need to start from scratch with that one...

Brainer
08-01-2009, 03:31 PM
Scripting shouldn't be that hard, it depends solely on what you need it for. Hit my MSN, I'll send you a very nice ebook about that. ;)

Chesso
08-01-2009, 09:05 PM
Well I am at this pointing thinking RPG Maker style if anyone remembers the earlier versions of it. Which is event based scripting, I think I can pull that off to some degree.

Actually the major thing I am being concerned with is what traveler has mentioned somewhat and that is animation.

I obviously planned to setup main sprite animation on "no matter what" sort of basis, but if I don't build something solid to handle it on a wider scope, I won't be able to realistically handle it throughout the game.

My basic rendering approach so far is based on 4 layers of my record tTile type, if the tilenum is not greater than 0, then no drawing occurs for the individual one (I expect the bottom layer to often be fully processed but not the other 3 layers).

If I am to add animation into this.... well maybe I will have reserve 1 bottom and 1 top layer for animations and setup special rules for the tilesetting and such.

Well I'll do what I can in regards to the editor and just keep all of this in mind lol.