Hello,
i´ve got a basic question on mapchanges ...
How can i load a new map, when my camera arrives at a specific position in the current map (for example a door or something like that ...) ?
mapchange ?
Check the position or collision and if you there, unload the old meshes and create new ones...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
It's simple:
Code: Select all
//load first map
IAnimatedMeshSceneNode* map1 = smgr->addAnimatedMeshSceneNode(smgr->getMesh(...));
//load second map
IAnimatedMeshSceneNode* map2 = smgr->addAnimatedMeshSceneNode(smgr->getMesh(...));
map2->setVisible(false);
//create camera
ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
while(device->run())
{
vector3df camPos = camera->getPosition();
if(camPos.X > ... && camPos.X < ... && camPos.Z > ... && camPos.Z < ...){
map1->setVisible(false);
map2->setVisible(true);
}
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
excuse me for my bad english and for my ignorance...but I'm 14 and i come from Italy, where the study of english is a optional (-:
Yes, you can do it this way if you're using only a few meshes...
But you'll have all meshes in memory, all the time !!!
Let's say you have a really big game with many maps (for example The Elder Scrolls series), then you have 100s of maps in memory...
Not talking about all the object meshes...
But you'll have all meshes in memory, all the time !!!
Let's say you have a really big game with many maps (for example The Elder Scrolls series), then you have 100s of maps in memory...
Not talking about all the object meshes...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
@Acki -
would the only way to do it be to load and unload meshes like:
I thought I read somewhere that it wasn't good to load/unload in the 'while'...but I dunno
would the only way to do it be to load and unload meshes like:
Code: Select all
while(device->run())
{
if(camera blah...) {
drop->first mesh
IAnimatedMeshSceneNode* map2 = smg->addAnimatedMeshSceneNode(smgr->getMesh(...));
...
...
...
}
I thought I read somewhere that it wasn't good to load/unload in the 'while'...but I dunno
Join us in the Irrlicht chatroom:
[url]irc://irc.freenode.net/irrlicht[/url]
I love deadlines. I like the whooshing sound they make as they fly by. -D.Adams
[url]irc://irc.freenode.net/irrlicht[/url]
I love deadlines. I like the whooshing sound they make as they fly by. -D.Adams
Well, it's always done inside the while, because it's the main loop...
Even if you call a function, it's always inside the main loop...
What you never should do is to do this between beginScene and endScene !!!
Now, I would call a function, create a loading screen and do the removings and creatings in there ...
BTW: always think about there are many ways to do something, this is only one solution I think it's a good choice...
Even if you call a function, it's always inside the main loop...
What you never should do is to do this between beginScene and endScene !!!
Now, I would call a function, create a loading screen and do the removings and creatings in there ...
Code: Select all
while(device->run()){
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
if(cam == endPos) loadNewMap();
}
void loadNewMap(){
guienv->addImage(loadingScreen);
driver->beginScene(true, true, SColor(255,100,101,140));
guienv->drawAll();
driver->endScene();
smgr->getRootSceneNode()->removeAll();
// create new map and objects
...
}
BTW: always think about there are many ways to do something, this is only one solution I think it's a good choice...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java