ICE - IrrLicht Common Engine Framework

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

ICE - IrrLicht Common Engine Framework

Post by keless »

I wanted to use IrrLicht to prototype a 2D collision detection algorithm I need to use for my cell phone game (since I dont have access to my cell phone IDE from work). To do this, I wanted to use the same framework I already created for Tetris -- the game states, intro/options/main, interfaces etc..

So I decided to be robust about it and just make a straight Framework. It includes the basic classes needed to have a multi-state IrrLicht project. Currently I have two packages:
1) the source and a DevCpp .dev project file.
2) a DevCpp Template file

for VS, you can simply get #1 and create a new project and include the files.

they can be downloaded from here: http://www.skyesurfer.net/keless/IrrLicht/ICE/download/

to use #1, simply extract to a directory (RECOMENDED)
to use #2, extract to your DevCpp/Templates directory, then open DevCpp and choose 'New Project'->'Multimedia'->'ICE Framework' (NOT RECOMMENDED-- because DevCpp templates dont maintain folder structure)

This should help anyone who wants to create new IrrLicht projects quickly and with good state handling code. I'll probably add refinements occasionally as needed.

Eventually, I may start adding more useful Game Engine type classes that IrrLicht doesnt have (since it is more of a general 3D Engine).
a screen cap is worth 0x100000 DWORDS
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

Okay, plan for the next version of ICE:

1) Save/Load User Options from file automatically
ICE_Options will load user-preferences from a file on start. Changing options in the gs_OptionMenu screen will change these, and when gs_OptionMenu closes, it will tell ICE_Options to save its values back into the file.

2) One-Time Configuration screen
add a state called gs_Configure which will be the initial state. It will display a menu that lets the user choose what renderer/fullscreen/color depth/ resolution to use. When finished, it will set these as ICE_Options, and when the state closes the device will also close and will change to whatever preferences were chosen. This will also set a boolean flag to true, so that the screen will not be shown again (there will be a check box to re-allow the screen to be shown in the gs_OptionMenu state). Also, this flag will only be set AFTER the new device is created. (Meaning that if it crashes for some reason, the next time you run the game you will get the configuration screen agian, and be allowed to choose a different option). The default device created for this state will be whatever is the most compatible with all hardware configurations (probably EDT_SOFTWARE).

---
In continuation with the original idea of the ICE (IrrLicht Common Engine) Framework, I think these options will provide a very proffesional feel to games that utilize them, which will reflect positively on IrrLicht itself. Life is a little hectic right now, so I cant give an ETA yet, but stay tuned for updates.

The website now has a text-only front page:
http://www.skyesurfer.net/keless/IrrLicht/ICE/
a screen cap is worth 0x100000 DWORDS
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Nice, could be useful for lots of people here, I think. I'll add a link at the official homepage, to make it more popular. :)
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

im currently working on a pseudo-XML class, called Quick XML.

I looked at using some pre-existing libraries, but they all dont have DevCpp libraries, generally offer way more functionality, etc. etc. -- so I decided to build my own, in one simple and easy to use class, which covers just the functionality I need.

this will be used to save the Options to file, and to load them back in, but it can be used for any serialization of this sort, and will be added in the Utilities section of my ICE framework v2.0 when its ready.
a screen cap is worth 0x100000 DWORDS
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

well done

Post by schick »

I really like your work. Ive done some improvements to your code so it fits into my project.

The option singleton:

Just call SingleOption::GetInstance(); so one instance will be created and it will be the only one, because the constructor is private. (Thats my class which is used to save the single player options, i ripped out all config data)

Code: Select all

#ifndef _SINGLEOPTION_H_
#define _SINGLEOPTION_H_

#include <irrlicht.h>

//! handles all the game options
/*!
    That singleton will handle options realting the single
    player game. The Options are AI of the computer
    player and the difficulty of the game. 
    
    ToDo:     - load/save config file 
              - provide config data :)   
*/
class SingleOption
{
   

  private:
    //! private constructor
    /*!
        There is no way to allocate a new object
        using a constrcutor. The only way is to use
        the GetInstance method. So we are sure there
        is only one object alive.
    */
    SingleOption()
    {
    };    

  public:
    //! creates the only instance of SingleOption
    /*!
        There is no public constructor, so the only way
        to create a instance is calling that function.
        The instance will be deleted as soons as the
        game quits.   
    */
    static SingleOption& GetInstance()
    {
      static SingleOption Instance;
      return Instance;     
   };
    
};


#endif
If you want to set buttons relative to the screensize, there was a todo comment in your code:

Code: Select all


  core::dimension2d<s32> ioWndRes = mpoDriver->getScreenSize();
  // the image should fill the hole background
  irr::core::rect<irr::s32> mroScreenSize = core::rect<s32>( 0,0,     ioWndRes.Width,ioWndRes.Height);

My comments are related to my game so they might not be very useful.

I am looking forward to the next release,

schick
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

upps

Post by schick »

If you want to have a pointer to that option singleton just do something like:

SingleOption *mpoSingleOption = &SingleOption::GetInstance();
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

technically, I was using ICE_Options as a singleton, but you're right-- i forgot to hide the constructor!

also, the Singleton pointer is new to me. cuts down on the "ICE_Singleton::" code-- though since im also doing "irr::core::" on purpose, i think i'll leave this.
Last edited by keless on Sun Jan 11, 2004 9:18 am, edited 1 time in total.
a screen cap is worth 0x100000 DWORDS
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

qXML nearing completion

Post by keless »

qXML is almost done. i can write and read a qXML file.

here is some example of how it will work:

Code: Select all

EXAMPLE CODE (WRITING):
	// write preferences to a pseudo XML file 
    q_XML * xml = new q_XML_WRITENEW("text.pref");
    xml->createNewNode("graphics", "preferences");
    xml->addAttribute("bool", "fullscreen", "F");
    xml->addAttribute("string", "resolution", "640x480");
    xml->endCurrNode();
    xml->createNewNode("resolutions", "options");
    xml->addAttribute("string", "resolution", "640x480");
    xml->addAttribute("string", "resolution", "800x600");
    xml->addAttribute("string", "resolution", "1024x760");
    delete xml;
PRODUCES:
< node="root" type="qXML" >
	< attr="version" type="string" value="0.1.0" >
	< node="graphics" type="preferences" >
		< attr="fullscreen" type="bool" value="F" >
		< attr="resolution" type="string" value="640x480" >
	</ end="graphics" >
	< node="resolutions" type="options" >
		< attr="resolution" type="string" value="640x480" >
		< attr="resolution" type="string" value="800x600" >
		< attr="resolution" type="string" value="1024x760" >
	</ end="resolutions" >
</ end="root" >
   
EXAMPLE CODE (READING):
	std::string temp;
	//* read in preferences from a pseudo XML file
	q_XML *xml = new q_XML_READER("text.pref");
	temp  = xml->nextNode();
	printf("read node: %s\n", temp.c_str() );
	temp  = xml->nextNode();
	printf("read node: %s\n", temp.c_str() );
	xml->nextAttr();
	xml->nextAttr();
	attr_info attribute = xml->getCurrAttr();
	printf("2nd attr: %s as %s equals %s\n", 
		attribute.attrName.c_str(), 
		attribute.attrType.c_str(), 
		attribute.attrValue.c_str());

	temp = xml->nextNode();
	if(temp == "")
		printf("no more nodes\n");
	delete xml;
PROCUCES:
read node: graphics
read node: resolutions
2nd attr: resolution as string equals 800x600
no more nodes
NOTES (WRITING):
* end tags will be added for you on
destruction if you left any open

* do not add a node nested within
another node with the same name

NOTES (READING):
* reading happens serially, there is not currently
any way to rewind, except to close and start over

* currently (v0.1.0) nextAttr() will not
skip a sub-node looking for the next attr
a screen cap is worth 0x100000 DWORDS
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

qXML is complete (for now).

I plugged it into ICE and its working nicely. I also plugged it back into IrrLicht Tetris-- only took 10 minutes and no debugging was neccesary. I think that shows how powerful it is. Next I'll use it to save high scores for IrrLicht Tetris.

With options saving/loading complete, that means the only feature left for ICE v2 is the configuration screen.
a screen cap is worth 0x100000 DWORDS
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Will be adding XPath style functionality to qXML?

qXPATH?
Crud, how do I do this again?
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

currently the parsing mode of q_XML is to read directly from the file on calls-- xPath requires that the whole file be read in and stored in a tree format which can be traversed at will.

If it becomes obvious that this is helpful for any of my immediate projects, or if there is enough demand for it, I may write a 2nd, more advanced class (possibly named aq_XML for Advanced QuickXML) which uses q_XML for initial reading into a tree.

The reason it would be a second class is because I dont want to add overhead or complexity to the basic functionality of q_XML-- cause thats why I made it. To be quick and easy to use, understand, and integrate into any project.
a screen cap is worth 0x100000 DWORDS
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Great work!

Post by schick »

Thanks for your ICE. It really makes developing a game much easier.

Keep going,

schick
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

cool. I really appreciate that. I'd definately keep doing it even if for only myself, but I really hope to contribute something that can help everyone.

The next version will have some really exciting stuff, with the configuration state, and saved options! Its getting really cool.
a screen cap is worth 0x100000 DWORDS
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

okay, i've started work on the Configuration state.

I wonder if there are radio buttons/select boxes in IrrLicht GUI planned for version 0.5? For now, I may just wire some check boxes together to act like radio buttons, though I think a select box would be the best. Or a list box with a highlighted element.

Anyhow, I've updated the ICE webpage a tad, and included a section for links to ICE-based projects at the bottom. If anyone wants me to link to them from the page, just let me know.

http://www.skyesurfer.net/keless/IrrLicht/ICE/
a screen cap is worth 0x100000 DWORDS
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

keless wrote:I wonder if there are radio buttons/select boxes in IrrLicht GUI planned for version 0.5?
No, sorry. I just have planned to add tab controls and edit boxes for now.
Post Reply