Game Development Community

Menu File Format for Game Development Toolkit

by Grant McNeil · in Technical Issues · 08/08/2003 (7:02 pm) · 6 replies

Hello Garagegames!

I'm writing a 2D engine, the "PFEngine", and I have recently run into a road block.

I'm creating the Menu Editor tool, and I need to decide on a good file format for creating and interpreting the Main Menu the user creates.

Basically what I want is a system where I can easily create an algorithm to get the menus and submenus out of the file, the options functions and to be able to store all these in variables.

This is very easy to do, but I want the coolest, neatest, most optimized file format that I can do. Because, well, you know, Open Source.

So Garagegames Programmers, I would like some help.

Heres my main Idea so far:

Menu.txt:
Menu1Title
option1
function1
option2
function3
option3
function3
END
Menu2Title
option1
function1
option2
function3
option3
function3
END
EOF

CMenu.cpp:

CMenu::CMenu()
{
File.open("Menu.txt");

(Basically create the loop, store what the variables do and sort out they're functions with a switch statement)

File.close();
}

So, basically what would be cool is for someone to strut their stuff and show me a better way to do the format and a better algorithm.

Oh, and if this is stupid, flame me. I honestly think this post isn't idiotic, but if it is, please state so.

--Grant McNeil

#1
08/08/2003 (7:12 pm)
I know this sounds silly but... why not just use XML, or some of the existing interface development file formats / tools that exist. XML is nice because it's standard and human readable / editable in extreme cases where ya' need to do some debugging. Plus, you get the advantage that there's a ton of libs to handle XML already.

Then there's a ton of other menu formats, including lookin' at some of the new open source projects that parse SFW formats (then ya' pick up simple animation to go along with your menu system.)

Just some thoughts for ya' to chew on :-)
#2
08/08/2003 (7:16 pm)
Oh yeah, I probably should mention this.

I'm 16, and i'm doing this for kicks.
#3
08/08/2003 (8:26 pm)
I agree. XML is a simple format to read (lots of libraries and source code you can just plug into anything you're doing) and provides an out-of-the-box heiarchial structure. You can even put the names of the functions to call in the XML file if you really want and use function pointers to invoke it, making it 100% dynamic. Don't try to reinvent the wheel.
#4
08/08/2003 (10:20 pm)
I put in another vote for XML. There are plenty of existing XML classes out there (look on sites such as codeproject.com) if you want to save time, or as you're doing this for kicks maybe you want to reinvent the wheel ;)
#5
08/08/2003 (11:28 pm)
Yeah, that sort of thing is perfect for XML. Good tick to put on your resume, too...
#6
08/09/2003 (7:11 am)
Wow,

Now that I have looked into it, XML seems perfect for what i'm trying to do.

Thanks guys,
--Grant