Tutorial 2 and 7 help

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Tutorial 2 and 7 help

Post by Azert »

I'm new to Irrlicht and I've got some problems with creating my own levels. Tutorial 1 (Hello world!) is no problem but when I want to create a level with FPS controls it goes wrong...

Here's the thing that goes wrong:

I use tutorial 2 as example.
I've created a map with Maya (.obj files) and replaced ("20kdm2.bsp") with ("map.obj"), so I've got this:

scene::IAnimatedMesh* mesh = smgr->getMesh("map.obj")

But then I need to create a ZipFileArchive:

device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3")

I tried to make some myself but I failed to display anything.

The thing(s) I need is a valid code to walk on an .obj file (like in tutorial 7:Collision) and a valid ZipFileArchive..., so is there someone who use Maya and succeeded to display his own levels?
(And please don't say that maps are only possible as BSP files, that would be a dissaster for me.)

As C++ compiller I use Dev-C++ (may be usefull to know)


Hope someone can help me out.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

1st - you don't need a zip archive...
If you want one, that's another thing... ;)
A normal zip archive (without password protection) should work...

2nd - it should all work with no problems...
Maybe you did something wrong, are you sure you specified the path to your files (archive or mesh) correct ???

3rd - you can use any mesh format you want (as far as Irrlicht supports it)...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Post by Azert »

Euh... I need to admit: I'm a total noob when it comes to programming...

How do you delete the archive part in the code so it can work without the archive? And what is a path ? :oops:
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Owowow.. :lol:

for the archive thing simply remove this line:

Code: Select all

device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3") 
A path (Pfad) is also called a directory, folder or drawer
for example this: ../../media/
or this: C:\Windows\system32\
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Post by Azert »

The code looks fine when it compiles but when I try to run it, it says:

Could not load mesh, because file could not be opened.: ../../media/map.obj

I've also placed the .obj file in the media directory so the path should be fine...
O.o
Any idea?
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Post by Azert »

Allright found one error: a wrong name... (stupid mistake), but now I've got a new one... When it runs it says:

Loaded mesh.: ../../media/map.obj
Needed 3ms to create OctTree SceneNode.(35 nodes, 782 polys)

For what stands that OctTree?
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

OctTree is the collision tree used to make collision on your map :D
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

An OctTree node is an optimized node, especially for maps...
The vertices of the mesh are ordered in an oct tree so only visible shapes will be drawn, this improves the speed for huge meshes...

If you look at the code you'll see a line with node = smgr->addOctTreeSceneNode(...)

For normal meshes (player, items) you don't need an oct tree node...
Simply use addAnimatedMeshSceneNode(...) then...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Post by Azert »

I think this is the part where I need to "correct" something:


[ scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/map.obj");
scene::ISceneNode* node = 0;

if (mesh)
node = smgr->addOctTreeSceneNode(mesh->getMesh(0));]

But I have no idea what I need to do with the OctTree, SceneNode or what the 3ms is I need to create... :? [/code]
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Post by Azert »

(Sorry, first time I tried to enter a code)

I think this is the part where I need to "correct" something:

Code: Select all

scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/map.obj"); 
scene::ISceneNode* node = 0; 

if (mesh) 
node = smgr->addOctTreeSceneNode(mesh->getMesh(0));

But I have no idea what I need to do with the OctTree, SceneNode or what the 3ms is I need to create...
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Don't think about it longer, just use an OctTree node for your map and AnimatedMeshSceneNodes for other things... ;)

The message is simply from Irrlicht telling you that the OctTree was created successfully and how long Irrlicht took to create it...

EDIT: if you did something wrong in your post you can edit it again (there is a button "Edit" on all your posts, no need to write it double)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Post by Azert »

Allright that clears one problem :)

But I still get an empty screen, no mesh.
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Post by Azert »

Problem solved: got the mesh on screen.

It's only covered in black so I'll need to add some lights (read something about in other topics), now I only need to try collisions.

By the way: thanks a lot
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Well, I think you just used the code from the Quake map from the tutorial...
There is a line like this:

Code: Select all

node->setPosition(core::vector3df(-1300,-144,-1249));
this sets the position of the node...
But the Quake map is far away from the center (at position 1300,144,1249)...
So if you use this position with your node, it probably will be far away from the center where your camera is locatet...
Try smaller values for this position (maybe 0,0,0 or 0,0,100) then you should see your node...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Azert
Posts: 18
Joined: Sun Feb 18, 2007 11:34 am
Location: Belgium

Post by Azert »

Well the problem was a LOT simpler than a wrong origin, I only needed to MOVE a bit :?

I still need to find a way to add light...

I exported the mesh to IrrEdit and placed a light but when I tried to run the map.irr file it says it does not support that file... O.o
Post Reply