Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Could a unified RPG/tilemap library ever catch on?

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
Could a unified RPG/tilemap library ever catch on?
X-G
Member #856
December 2000
avatar

Right, I couldn't get the original URL to work, but ... read this if you haven't before. ;D

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Thomas Fjellstrom
Member #476
June 2000
avatar

X-G: ;D. That was awesome.

"Bite ME!". I'm dumb!.

"Even LISP pulled itself out of the pond to throw loopy hands around XML's throat, but only managed to choke its ownself." ;D^2

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

Script ID value == zone number, doesn't it?

Don't ask me; you're the script guy :) I just make the pretty pictures ...

simplep: I've never used XML, but that's certianly not what I had in mind. Though I would not be adverse to someone demonstrating a good way to customize the file format (as I've no clue) ...

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Thomas Harte
Member #33
April 2000
avatar

Hi again! By shear coincidence I just found Open tUME which is the open release of a map editor that has been knocking around and being updated since 1989 and during its history has been used for some commercial projects along the way.

simplep
Member #3,385
March 2003

Quote:

If you're always going to use tools to access .xml files, what's the point of making them text? It may as well be binary; it loads faster and takes up less memory on-disk. You may as well be using a well-structured tagged binary format.

Surely XML is overhyped. But it is not entirely useless, in my opinion. The point of XML is:

1) as a text file, it can always be modified with a simple text editor like Notepad or vi

2) a generic XML tool like XmlSpy can be used

3) it is a structured format; allows very easy representation of trees

4) it is as human readable as much as the tags allow it. If the tags are obscure, then the whole XML document is obscure. If the tags are clear enough, then it is quite human readable

5) it is almost self-documented; you can come back a year later and remember just by reading the XML document what its data are; if you have binary format only, there should be documentation around

6) it carries itself around different architectures; no need to worry about little/big endian

7) since it is self-documented, new external tools can be easily programmed either by the original author or by others.

Your point is correct though that it takes too much space. Since it is text, it can be compressed quite well. It is also correct that it takes a while to be loaded and parsed. But, remember, it is for tools.

In the place that I work, we have successfully used XML over a variety of products. It have solved quite some problems, especially data exchange between different architectures.

Keep it simple!!!

X-G
Member #856
December 2000
avatar

I don't think XML will work, here, though - the individual tags might be readable, but to a human, it will most likely be impossible to get a good view of what the tilemap looks like from the XML.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

simplep
Member #3,385
March 2003

Quote:

I don't think XML will work, here, though - the individual tags might be readable, but to a human, it will most likely be impossible to get a good view of what the tilemap looks like from the XML.

That's true. You can't see how the level is from the file. But neither you can from the binary format. From my point of view, XML has more advantages than disadvantages. It is worthy enough to give it a try.

I forgot the biggest advantage of XML: flexibility. A small set of tags may be defined today; future tags will not break backwards compatibility; the XML files may specify additional information, but they will be still loaded from older applications. Imagine a situation where you would like to extend your tilemaps with new attributes. With a binary-only format, you would have to re-compile the tilemap editor in order to support the new format; by using XML though, you can specify additional attributes for each tile, and the tilemap will still be loadable by the tilemap editor. This makes a huge difference. And by making the tilemap editor expandable by plug-ins, you can always provide additional processing for the new attributes.

Of course all these can be done with binary only, but more difficult. I think XML makes my programming life quite a bit easier.

Keep it simple!!!

X-G
Member #856
December 2000
avatar

We've covered human-readability already ... some counter-points, then:

  • Size. Binary files would be much smaller than XML files.

  • Speed. Loading a reading in a binary file is faster than parsing a whole XML file.

  • Bloat. A tile editor doesn't require the flexibility of XML.

  • Keep It Simple. XML is too complex for this task, I feel. It just seems like overkill to use XML - the advantages do not outweigh the disadvantages, IMHO.

  • About endianness ... Allegro is already endian-independent.

As for external tools ... see readability again. Tilemaps are too specific, and require some really peculiar display of the information for it to be any useful. Thus, any convential XML tools are essentially worthless when dealing with tilemap XML.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Oscar Giner
Member #2,207
April 2002
avatar

Quote:

With a binary-only format, you would have to re-compile the tilemap editor in order to support the new format;

If you do it right, you can do a loader that would load binary data of future versions: for each chunk of data, store its size at the beginning. If a chunk in version 1.0 has 4 variables stored, with a size of 16 bytes, and, in version 2.0, you add 2 more variables, making a total of 24 bytes, an old version capable of loading only 1.0 files, would read the first 4 variables (16 bytes) and skip the two variables that doesn't recognize. It's some work, but may be worth it.

X-G
Member #856
December 2000
avatar

Even better; Divide the file into chunks, and store version info in each chunk along with the size of the chunk. Then, the editor can choose only to read those chunks that it knows how to handle, and can skip the rest.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Korval
Member #1,538
September 2001
avatar

Quote:

Size. Binary files would be much smaller than XML files.

Compare .psd (photoshop's internal format) file sizes to .tga's, .bmp's or any other format. Compare .doc files to .txt, or even .rtf files.

The internal format of any editor is supposed to be large; it has all kinds of information that the "object" formats don't need.

Quote:

Bloat. A tile editor doesn't require the flexibility of XML.

We're talking about the tile editor's internal format, yes? If so, there's an entire undo-stack in that file (if there isn't, there should be), containing arbiturary information. Information that can change frequently as the tile editor is developed. And if the editor has plugins, their actions have to go there too.

Flexibility is important in the internal format of a plugin-able system.

Quote:

XML is too complex for this task, I feel. It just seems like overkill to use XML - the advantages do not outweigh the disadvantages, IMHO.

In theory. In practice, using something like Xerces to write/read an .xml file is simplicity itself. It's not like you have to write an .xml parser or something.

Quote:

About endianness ... Allegro is already endian-independent.

Allegro's .dat files are "endian-independent", for formats that it understands. But storing and retrieving arbiturary data in them (as a block) isn't.

Considering that this debate is solely on the internal format of the tile editor (which I didn't realize at first), arguments about file size are irrelevant (unless they're extraordinarily huge). Thanks to freely-avalaible .xml parsers, arguments about the ease-of-use are equally irrelevant. The only real question is, "Can the text be parsed and loaded fast enough?" That's a non-trivial question, depending on how fast you would like your loading to work.

Oscar Giner
Member #2,207
April 2002
avatar

Quote:

Quote:
--------------------------------------------------------------------------------
Size. Binary files would be much smaller than XML files.
--------------------------------------------------------------------------------

Compare .psd (photoshop's internal format) file sizes to .tga's, .bmp's or any other format. Compare .doc files to .txt, or even .rtf files.

The internal format of any editor is supposed to be large; it has all kinds of information that the "object" formats don't need.

What you say doesn't have anything to do about binary vs text files. Don't compare what it's stored in a .psd file (you can have a lot of layers, just to mention something) to what's stored in a .bmp.

Quote:

there's an entire undo-stack in that file (if there isn't, there should be)

What program do you know that stores the undo stack in the file?. Photoshop, Word, 3DS and all I've used I can remember don't do it: if you close the document, you lose the undo stack.

Quote:

Allegro's .dat files are "endian-independent", for formats that it understands. But storing and retrieving arbiturary data in them (as a block) isn't.

And what about pack_iputl and pack_iputw?

I agree that parsing a XML file is not difficult, either using an already written parser, or writing your own.

Korval
Member #1,538
September 2001
avatar

Quote:

What you say doesn't have anything to do about binary vs text files. Don't compare what it's stored in a .psd file (you can have a lot of layers, just to mention something) to what's stored in a .bmp.

The point I was making is that saying, "A text file is larger than a binary file" is not a valid argument for not using .xml as an editor's internal format. The reason is that the internal format of most large programs is larger than the external format. As such, the file size of the internal format is irrelevant (unless it pertains to speed).

Quote:

What program do you know that stores the undo stack in the file?. Photoshop, Word, 3DS and all I've used I can remember don't do it: if you close the document, you lose the undo stack.

I think it was Max I saw doing that. I can't be certain, though. I know I used some program that went so far as to save the undo stack.

Quote:

And what about pack_iputl and pack_iputw?

Those functions store a single word, not arbiturary data. Sure, you could put your data together into words and save/load them with these functions, but that's hardly "arbiturary data".

Johan Henriksson
Member #11
April 2000
avatar

I think any try at a rpg lib is doomed. it will grow too complex.

if you want to go through all the hassle and also make it flexible enough, it is better to make it an engine. make the source code open so one can customize it a bit, then put all basic functionality in scripts.

Bob
Free Market Evangelist
September 2000
avatar

Quote:

Compare .doc files to .txt, or even .rtf files.

OpenOffice's gzipped XML files (its native file format) are significantly smaller than MS Office's .doc (on just about every document I converted). I don't believe the .doc contains any additional data that isn't present in the XML conversion.

Quote:

I agree that parsing a XML file is not difficult, either using an already written parser, or writing your own.

I have a simple XML parser on my site, written in C. Uses callbacks to parse, and depends on well-formatted XML docs.

--
- Bob
[ -- All my signature links are 404 -- ]

Johan Henriksson
Member #11
April 2000
avatar

too add in a bitter comment; a document can be allowed to be 10% of the size of the program. but in case of open office and msword, that is still a lot >:E

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

a document can be allowed to be 10% of the size of the program.

Who set that rule and how badly do I get punished? ;) MapSlapper is 220KB and one of my files (which includes the tileset images) is 85KB. I expect that number to climb when I add animation, "stamps", etc.

I'll look at Bob's parser, but my file format considers all parts optional (like the palette in .bmp files), with a flag at the begining which details what's there and what's not (tileset, bitmasks, animation, etc). It won't save the tilemap in anyone's predetermined format, but it's versatile enough for me :)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

aybabtu
Member #2,891
November 2002

I don't think that an RPG is a great game to make a library for. It just seems like it would be too hard to make it so customizable. I could see a scripting library that specializes in RPG stuff, or a tilemap library (it would come with an editor, and have some functions to load/save maps and stuff), but not an RPG library.

23yrold3yrold
Member #1,134
March 2001
avatar

How much more would you need? :) About the only thing that can't be handled is the combat engine, and depending how generic you want to be, even that's debatable.

It's a good idea if only because RPG's tend to be the hardest genre to program. A little help getting started would be nice. Alternatively, if someone were to write a tutorial and provide a lot of souce code with many different ways of doing things, that would be helpful as well ...

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

aybabtu
Member #2,891
November 2002

Quote:

How much more would you need?

tilemap_engine + scripting_engine != rpg_engine
If it just had that, it really couldn't be called an rpg library...just a set of helper functions for the basic map and scripting system. I think it's easier to make your own stuff anyway...that way you know exactly how it works, and you don't have to learn a scripting language.

Quote:

Alternatively, if someone were to write a tutorial and provide a lot of souce code with many different ways of doing things, that would be helpful as well ...

Yeah, that'd work much better than a library.

23yrold3yrold
Member #1,134
March 2001
avatar

A library is not an engine. There's nothing wrong with helper functions. As for knowing exactly how it works, I'm all for fully documented source code. If you want an idea what I mean, read my third STL article on my site and see if you can easily follow what's goin on in the code (I write several pages outlining it). Assuming you know C++, of course :) A library would be documented even moreso; in fact, for those quibbling over tilemap file formats, I can tell you now it would be less than effort to modify the Save and Load functions in my editor. I've ben doing it quite often myself, actually ;)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Korval
Member #1,538
September 2001
avatar

Quote:

I don't think that an RPG is a great game to make a library for. It just seems like it would be too hard to make it so customizable. I could see a scripting library that specializes in RPG stuff, or a tilemap library (it would come with an editor, and have some functions to load/save maps and stuff), but not an RPG library.

Why not?

If you take a look at the basics of a square-tile based RPG (as opposed to isometric-tiles), you will find quite a bit of commonality.

In general, you have one (or more) overworld maps that link you to towns and other "enterable" structures. You can engage in combat, usually done by going to another screen (though the fighting engine could accomodate not doing so). You may, or may not, have some kind of GUI that is constantly on-screen. You will, however, have a pause menu that provides access to most of the different configurable features of characters, inventory, etc. You have a bunch of NPC sprites running around that interact with the player. And, you have some form of way to take control of the game for a cutscene (either script or code-based, or a mixture of both).

This all screams "Class Library" to me. Or, better yet, "Class-based Framework Library".

Quote:

As for knowing exactly how it works, I'm all for fully documented source code.

Ugh; I'm not.

There's nothing worse than having to read through someone elses source code just to accomplish something. I'd much rather have stand-alone documentation that gives you very specific paths for extending the functionality of something (like a class to derive from with specific virtual overrides, etc).

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

There's nothing worse than having to read through someone elses source code just to accomplish something. I'd much rather have stand-alone documentation that gives you very specific paths for extending the functionality of something (like a class to derive from with specific virtual overrides, etc).

By code documentation, I include the notion of stand-alone docs (again, see my third STL article for a rough example). A readme outlining the files and what's in them. When you find the file with the functionality you want to alter, you open it and find the exact code, which is commented further. If you can imagine it being documented in some way, it will be; let's put it that way :)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

aybabtu
Member #2,891
November 2002

Quote:

Why not?

If you take a look at the basics of a square-tile based RPG (as opposed to isometric-tiles), you will find quite a bit of commonality.

I could see where it'd be great, but what about the RPGs that are still square tile based, but have completely different gameplay? I guess my main argument would be that you'd lose a lot of customization ability when those things are done for you. But! if it was done right, it could be nice. It definatly couldn't have battle system functions...maybe basic stat changing functions...

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

I could see where it'd be great, but what about the RPGs that are still square tile based, but have completely different gameplay?

So? My tilemap editor makes tilemaps I can use for my platformer, shooter and RPG. Doesn't get much more diverse than that. Remember; this is a library, not an engine :)

You'd need a versatile tilemap editor, a versatile scripting language (rip off Lua or something ;)) and some GUI/dialog functions. That's a big chunk of your RPG engine done for you, and doesn't rob you of a whit of "customization ability".

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

 1   2   3 


Go to: