Page 1 of 2

Is there any game created with irrlicht (Source code)

Posted: Sun Dec 25, 2005 6:03 pm
by Guest
Is there any source code of a game created with irrlicht

Posted: Sun Dec 25, 2005 6:34 pm
by boboS
There are a lot:
Just look at the Project Page: http://irrlicht.sourceforge.net/phpBB2/ ... um.php?f=6

Just search for one with source code include.

Posted: Sun Dec 25, 2005 6:42 pm
by Guest
Thanx , I m searching for a source where anybody has applied "Saving / loading " game feature. Is there any

Posted: Sun Dec 25, 2005 7:01 pm
by Guest
you could search google for save/load tutorials on how to do it - or you could wait until someone has done something like this which you can just copy&paste ... your decision.

but it should not be too hard, just store all information about the current level and its objects/entities in a file and read it out again.

example:

object: entity
type: monster
health: 100
armor: 100
position: 100.0; 0.0; 100.0
scale: 1.0

then make a function which writes this information to a file like this:

"OBJECT entity TYPE monster HEALTH 100 ARMOR 100 POSITION 100.0;0.0;100.0 SCALE 1.0"

then you save this as savegame.sav.

to load it, you just parse the whole file line-for-line and save each line in a string.

so basically like this:

1. open file
2. scan how much lines there are.
3. create an array if strings and store the lines in it.
4. then scan the lines for the information that they hold and re-create your objects with the information you got out of the files (which is stored in strings)


this is sure not the best method, but its easy and it actually should work like this. the only condition is that you have to keep track of all your objects, maybe you can make an IObjectHandler class which stores all objects you create in a list, so you can easily save their information later - i hope you get what i mean.

good luck :)

byebye!

Posted: Sun Dec 25, 2005 7:19 pm
by boboS
You cand find a tutorial here : http://www.gamedev.net/reference/articl ... le1289.asp
The procedure is like Gfxstyler said. Grab information, write to file, close file. And to load you open the file and read information, write to objects.

Posted: Sun Dec 25, 2005 7:33 pm
by Guest
ok i agree what u said
but now if i want to save whole level how can i, urs only aplied to game database. I m saying about whole level including particles info or any animators info and then loading them.

Posted: Sun Dec 25, 2005 7:43 pm
by boboS
The same thing. You must track information to you objects. When you press 'Save' button you grab the status from all objects you want to track.
But I dont know to explain in detail how everything works.

Posted: Sun Dec 25, 2005 8:12 pm
by Guest
Anonymous wrote:ok i agree what u said
but now if i want to save whole level how can i, urs only aplied to game database. I m saying about whole level including particles info or any animators info and then loading them.
like i said, you need to keep track of _everything_. thats why a "loader" or "manager" for every type of objects would be best since you can easiely save the things which you created, so for example a ParticleManager where you create a particle.

just create a particle class (abstract all the irrlicht stuff - this is even useful without save/load ... everyone should do that) and let the ObjectManager create it, for example:

IParticleClass* particle = ObjectManager->createParticle(blablabla);

now you ask yourself, why do you need to load it with ObjectManager->? its because the objectmanager has to do this:

when ObjectManager->createParticle is called, you create an IParticleClass instance in ObjectManager and save it in a list, then return that instance of IParticleClass so your IParticleClass which you initially wanted to create will be loaded.

example code how you could handle it for a particle class (this is a basic example and you should try to do it yourself, i only write this to give you an idea on how to do it)

Code: Select all

// in IObjectManager class 
IParticleClass* IObjectManager::createParticle(blabla)
{
//this function should only be callable from IObjectManager (otherwise it wont keep track), so make IObjectManager class a "friend" of IParticleClass (you know what i mean when you use classes) 
IParticleClass* Particle = new IParticle(blabla);

//you need to create a function like this (this is the important part - this will keep track of the particle you created)
addToParticleList(Particle);

return Particle;
}

//in IObjectManager class again
void IObjectManager::addToParticleList(IParticleClass* Particle)
{
//this is a std::list<IParticleClass*> ParticleList
ParticleList.push_back(Particle);
}
this should explain itself and you should get how to do it. (you have to do this for every class in your game, so for particles, sounds, entities, vegetation, cars, cds, gamepads, porn videos, blablabla.. everything that is visible in a game :D )

feel free to ask any questions :)

byebye!

Posted: Sun Dec 25, 2005 8:12 pm
by Guest
ok i don't want this in detail , when we talk about scene serialization then we want to save info for every thing might be neede. I m using XML to save levels. But i m currently facing a problem . I want to save the info about animator. I m able to get the information but there is a problem with loading it , When i load the animator it starts from it initial position , but i want to start from the position i saved it. How do i pause and resume an animator in a scene

Posted: Sun Dec 25, 2005 8:17 pm
by Guest
i dont think you can start/stop/pause animators, but i dont know for sure.

i wrote a bit more detailed how you could possibly do it above your last post :)

good luck!

Posted: Sun Dec 25, 2005 8:25 pm
by Guest
so its bad to use an animator in ur level if u r not able to save/load it.
I m able to save everything but the hell is there is an entity wants to be animated with animator how can i use the feature in game i m not able to use the save load feature for this animtors.Bcoz if animator has to saved it must be loaded at the correct position and not from the start.
I suppose "GFXstyLER" , u also created a game , have u not used animators and if used have u not saved thier info , and if so how come u load it at correct position (just similar to pauing and resuming an animator)

I tried Virtual Editor where "ETcaptor" stored levels using xml , but the bug remains there . I created a scene with it , added an entity and attached a fly circle animator , i saved it when entity wz at pos "x" , but when i load it
the animator makes entity move from its starting pos not from "x" pos

Posted: Sun Dec 25, 2005 8:35 pm
by kushagra
The feature might come in the next Irrlicht Version
See the Development page

Posted: Sun Dec 25, 2005 8:38 pm
by Guest
well animation/movement in my app is a "little" different.

basically i have an ObjectManager like i told in my other post above where i add the objects in a list and then call ObjectManager->update(); in the main loop.

the update() function does this:

1. iterate through all lists that are available and call (*iterator)->update() for every object that is in the list. all my objects have an update() function that gets executed then. and in the update() function i can just do my movement code (which uses timing but it should also work without it). thats basically the same what animators do, but i just a bit reinvented the wheel because i need to adjust that and i also want to put other functions in the update() function.

so instead of having an animator that moves a node i just have a function that moves a node that gets called every frame through the ObjectManager (so you dont have to define the objects in the code, they just get added/removed from the list, very handy) :

Code: Select all

//in IObject class
void IObject::update()
{
//this is just an example 
vector3df nodepos = node->getPosition();
nodepos.x += 123;
node->setPosition(nodepos);
}
its a bit hard to understand but when you get it you can implement it yourself, its really useful :)

good luck!

Posted: Sun Dec 25, 2005 8:42 pm
by Guest
well unfortunately i dont have any "app" or project at the moment because my damned computer screwed up (a lot of smoke coming out of the case ... omg) and i just wiped out linux from my notebook - thus i dont have any backup on my notebook and my other computer is not able to boot up anymore.

but i think only the power supply thingy is damaged and not the harddisk. im away for two weeks now anyway so iam not able to get the data, damn :D

but i may do a re-write of everything i had this far because know i know a lot more how the different things work and i know c++ better, so the new result should be much cleaner/nicer/less bugs.

but thats off topic!

Posted: Sun Dec 25, 2005 9:06 pm
by kushagra
Yeah thanx anyways , currently i m developing an in game editor for which i asked u this ques. THere i also used the same aproach as u did , I took a class holding a list of object pointers and these all update functions are caleed by list pointers.
Now one more ques, i m reframing a little bit, if i want to add a sound support , i looked at different libraries i found Audiere the best and easiest , can i use to produce 3d sound.