3DS Levels

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.
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

3DS Levels

Post by unrealfragmaster »

Hi. Im new here, decided to use Irrlicht after looking and trying many other engines.
I am able to load Quake3 maps into the eninge and move around. How to I load maps I make in 3D Studio Max? I have a map made in it, with the camera attached to the back of the gun so it is first person. Could this be displayed as the user camera in the game?

I hope you can help
Thanks :)
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
wornaki
Posts: 54
Joined: Sat Aug 23, 2003 1:18 am
Location: Argentina, South America

Post by wornaki »

Not sure about what you want. My advice is to look at one of the first-person demos around the forum and see how it is made.
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

Post by unrealfragmaster »

I want to load a 3DS level into Irrlicht, not a Quake 3 level that most people seem to do.
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
wornaki
Posts: 54
Joined: Sat Aug 23, 2003 1:18 am
Location: Argentina, South America

Post by wornaki »

please look at this thread
http://irrlicht.sourceforge.net/phpBB2/ ... .php?t=726

If you only want to load a .3ds file then change the line of any example in the tutorials to point to your .3ds file. It is as simple as that.
The camera issue is another thing. Irrlicht does not support .max files just .3ds
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

Post by unrealfragmaster »

So, do I just replace the "20kdm2.bsp" with xxx.3ds?
What about the first line, about the pk3?
Thanks for your help

Code: Select all

device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");scene::ISceneNode* node = 0;

if (mesh)    node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
wornaki
Posts: 54
Joined: Sat Aug 23, 2003 1:18 am
Location: Argentina, South America

Post by wornaki »

Yes you do that. It should runlike this, though I'm not an expert.

Code: Select all

scene::IAnimatedMesh* mesh = smgr->getMesh("xxx.3ds");
scene::ISceneNode* node = 0; 

if (mesh)    
{
node = smgr->addOctTreeSceneNode("xxx.3ds"); 
See if it works
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

Post by unrealfragmaster »

Thanks, ill try it out. So do i just totaly replace the code i printed with the code you gave?
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

Post by unrealfragmaster »

I replaced the code with the code you gave me, and have the 3Ds file n the media folder. But I get this compiler error:

Compiling...
3ds.cpp
D:\Program Files\Irrlicht\examples\2.Quake3Map\3ds.cpp(123) : error C2664: 'addOctTreeSceneNode' : cannot convert parameter 1 from 'char [14]' to 'class irr::scene::IMesh *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\Program Files\Irrlicht\examples\2.Quake3Map\3ds.cpp(190) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

Post by unrealfragmaster »

Basically, I have a 3DS file in the Media folder. I have added the code Wornaki gave in place of the code for loading a BSP file. Im using the Quake3 map example. Here is the code I am using. Could someone tel me what to change or add in?

Code: Select all

#include <irrlicht.h>
#include <wchar.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
scene::ICameraSceneNode* camera = 0;
class MyEventReceiver : public IEventReceiver
{
public:
	virtual bool OnEvent(SEvent event)
	{
		if (camera)
			return camera->OnEvent(event);

		return false;
	}
};
int main()
{
MyEventReceiver receiver;

	IrrlichtDevice *device =
		createDevice(video::DT_DIRECTX8, core::dimension2d<s32>(640, 480), 16, false, false, &receiver);
	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();
scene::IAnimatedMesh* mesh = smgr->getMesh("transport.3ds"); 
scene::ISceneNode* node = 0; 

if (mesh)    
{ 
node = smgr->addOctTreeSceneNode("transport.3ds"); 
if (node)
		node->setPosition(core::vector3df(-1300,-144,-1249));
	camera = smgr->addCameraSceneNodeFPS();
	device->getCursorControl()->setVisible(false);
#ifdef USE_AUDIERE
	if (music)
		startAudiere();
	#endif
int lastFPS = -1;

	while(device->run())
	{
		driver->beginScene(true, true, video::SColor(0,100,100,100));
		smgr->drawAll();
		driver->endScene();

		int fps = driver->getFPS();

		if (lastFPS != fps)
		{
			wchar_t tmp[1024];
			swprintf(tmp, 1024, L"Quake 3 Map Example - Irrlicht Engine (fps:%d) Triangles:%d", 
				fps, driver->getPrimitiveCountDrawn());

			device->setWindowCaption(tmp);
			lastFPS = fps;
		}
	}
device->drop();
	
	return 0;
}
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
wornaki
Posts: 54
Joined: Sat Aug 23, 2003 1:18 am
Location: Argentina, South America

Post by wornaki »

Wait a sec. Are you using irr 0.4.1 or 0.4 or version 0.4.2?. There are some differences between them. Look here
http://irrlicht.sourceforge.net/changes.txt

Fine, now that I've cleared that, let's go on to something useful

Code: Select all


#include <irrlicht.h> 
#include <wchar.h> 
using namespace irr; 
#pragma comment(lib, "Irrlicht.lib") 
scene::ICameraSceneNode* camera = 0; 
class MyEventReceiver : public IEventReceiver 
{ 
public: 
   virtual bool OnEvent(SEvent event) 
   { 
      if (camera) 
         return camera->OnEvent(event); 

      return false; 
   } 
}; 
int main() 
{ 
MyEventReceiver receiver; 

   IrrlichtDevice *device = 
      createDevice(video::DT_DIRECTX8, core::dimension2d<s32>(640, 480), 16, false, false, &receiver); 
   video::IVideoDriver* driver = device->getVideoDriver(); 
   scene::ISceneManager* smgr = device->getSceneManager(); 
scene::IAnimatedMesh* mesh = smgr->getMesh("whateveryormediafolder is/transport.3ds"); 
scene::ISceneNode* node = 0; 

if (mesh)    
{ 
node = smgr->addOctTreeSceneNode(mesh->getMesh(0)); 
if (node) 
      node->setPosition(core::vector3df(-1300,-144,-1249)); 
   camera = smgr->addCameraSceneNodeFPS(); 
   device->getCursorControl()->setVisible(false); 
#ifdef USE_AUDIERE 
   if (music) 
      startAudiere(); 
   #endif 
int lastFPS = -1; 

   while(device->run()) 
   { 
      driver->beginScene(true, true, video::SColor(0,100,100,100)); 
      smgr->drawAll(); 
      driver->endScene(); 

      int fps = driver->getFPS(); 

      if (lastFPS != fps) 
      { 
         wchar_t tmp[1024]; 
         swprintf(tmp, 1024, L"Quake 3 Map Example - Irrlicht Engine (fps:%d) Triangles:%d", 
            fps, driver->getPrimitiveCountDrawn()); 

         device->setWindowCaption(tmp); 
         lastFPS = fps; 
      } 
   } 
device->drop(); 
    
   return 0; 
} 

the above should work for 0.4.1 and 0.4. For 0.4.2 some things should be changed

#include <irrlicht.h>
#include <wchar.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
scene::ICameraSceneNode* camera = 0;
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (camera)
return camera->OnEvent(event);

return false;
}
};
int main()
{
MyEventReceiver receiver;

IrrlichtDevice *device =
createDevice(video::EDT_DIRECTX8, core::dimension2d<s32>(640, 480), 16, false, false, &receiver);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
scene::IAnimatedMesh* mesh = smgr->getMesh("whateveryourmediafolderis/transport.3ds");
scene::ISceneNode* node = 0;

if (mesh)
{
node = smgr->addOctTreeSceneNode("transport.3ds");
if (node)
node->setPosition(core::vector3df(-1300,-144,-1249));
camera = smgr->addCameraSceneNodeFPS();
device->getCursorControl()->setVisible(false);
#ifdef USE_AUDIERE
if (music)
startAudiere();
#endif
int lastFPS = -1;

while(device->run())
{
driver->beginScene(true, true, video::SColor(0,100,100,100));
smgr->drawAll();
driver->endScene();

int fps = driver->getFPS();

if (lastFPS != fps)
{
wchar_t tmp[1024];
swprintf(tmp, 1024, L"Quake 3 Map Example - Irrlicht Engine (fps:%d) Triangles:%d",
fps, driver->getPrimitiveCountDrawn());

device->setWindowCaption(tmp);
lastFPS = fps;
}
}
device->drop();

return 0;
}
[/code]

That should work too.
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

Post by unrealfragmaster »

I am using 0.4
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

Post by unrealfragmaster »

When I tried to compile:

D:\Program Files\Irrlicht\examples\2.Quake3Map\3ds.cpp(65) : fatal error C1004: unexpected end of file found
Error executing cl.exe.


Whats wrong with it?
Last edited by unrealfragmaster on Mon Dec 15, 2003 8:58 pm, edited 1 time in total.
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
wornaki
Posts: 54
Joined: Sat Aug 23, 2003 1:18 am
Location: Argentina, South America

Post by wornaki »

#include <irrlicht.h>
#include <wchar.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
scene::ICameraSceneNode* camera = 0;
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (camera)
return camera->OnEvent(event);

return false;
}
};
int main()
{
MyEventReceiver receiver;

IrrlichtDevice *device =
createDevice(video::DT_DIRECTX8, core::dimension2d<s32>(640, 480), 16, false, false, &receiver);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
scene::IAnimatedMesh* mesh = smgr->getMesh("transport.3ds");
scene::ISceneNode* node = 0;

if (mesh)
{
node = smgr->addOctTreeSceneNode("transport.3ds");
if (node)
node->setPosition(core::vector3df(-1300,-144,-1249));
camera = smgr->addCameraSceneNodeFPS();
device->getCursorControl()->setVisible(false);
#ifdef USE_AUDIERE
if (music)
startAudiere();
#endif
int lastFPS = -1;

while(device->run())
{
driver->beginScene(true, true, video::SColor(0,100,100,100));
smgr->drawAll();
driver->endScene();

int fps = driver->getFPS();

if (lastFPS != fps)
{
wchar_t tmp[1024];
swprintf(tmp, 1024, L"Quake 3 Map Example - Irrlicht Engine (fps:%d) Triangles:%d",
fps, driver->getPrimitiveCountDrawn());

device->setWindowCaption(tmp);
lastFPS = fps;
}
}
device->drop();

return 0;
}
That should be changed to

Code: Select all

#include <irrlicht.h> 
#include <wchar.h> 
using namespace irr; 
#pragma comment(lib, "Irrlicht.lib") 
scene::ICameraSceneNode* camera = 0; 
class MyEventReceiver : public IEventReceiver 
{ 
public: 
   virtual bool OnEvent(SEvent event) 
   { 
      if (camera) 
         return camera->OnEvent(event); 

      return false; 
   } 
}; 
int main() 
{ 
MyEventReceiver receiver; 

   IrrlichtDevice *device = 
      createDevice(video::DT_DIRECTX8, core::dimension2d<s32>(640, 480), 16, false, false, &receiver); 
   video::IVideoDriver* driver = device->getVideoDriver(); 
   scene::ISceneManager* smgr = device->getSceneManager(); 
scene::IAnimatedMesh* mesh = smgr->getMesh("thepathtoyourmodel/xxx.3ds"); 
scene::ISceneNode* node = 0; 

if (mesh)    
{ 
node = smgr->addOctTreeSceneNode(mesh->getMesh(0)); 
if (node) 
      node->setPosition(core::vector3df(-1300,-144,-1249)); 
   camera = smgr->addCameraSceneNodeFPS(); 
   device->getCursorControl()->setVisible(false); 
#ifdef USE_AUDIERE 
   if (music) 
      startAudiere(); 
   #endif 
int lastFPS = -1; 

   while(device->run()) 
   { 
      driver->beginScene(true, true, video::SColor(0,100,100,100)); 
      smgr->drawAll(); 
      driver->endScene(); 

      int fps = driver->getFPS(); 

      if (lastFPS != fps) 
      { 
         wchar_t tmp[1024]; 
         swprintf(tmp, 1024, L"Quake 3 Map Example - Irrlicht Engine (fps:%d) Triangles:%d", 
            fps, driver->getPrimitiveCountDrawn()); 

         device->setWindowCaption(tmp); 
         lastFPS = fps; 
      } 
   } 
device->drop(); 
    
   return 0; 
} 
Let's see now
unrealfragmaster
Posts: 31
Joined: Mon Dec 15, 2003 5:49 pm
Location: Ireland
Contact:

Post by unrealfragmaster »

Compiling...
main.cpp
D:\Program Files\Irrlicht\examples\2.Quake3Map\main.cpp(63) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
http://www.gameplayzone.com/forum
Join the gameplayzone forums today!
http://www.gameplayzone.com
All the latest gaming news and advancements
wornaki
Posts: 54
Joined: Sat Aug 23, 2003 1:18 am
Location: Argentina, South America

Post by wornaki »

Are you sure you have irrlicht.dll placed in the base dir of you app(that means where you compile). Do you use Dev C++ or VC and have everything well settled?.
The code I sent you worked fine for me(with a mesh called park.3ds from gametutorial). Try putting your model in the base dir of your project and calling it directly with no paths. Maybe it works
Post Reply