Latest tut on Quake 3 maps

A forum to store posts deemed exceptionally wise and useful
IrrGamer
Posts: 22
Joined: Fri Oct 05, 2007 3:30 am

Post by IrrGamer »

Amazing!! I know you used SKeyMap to define controls, but when I copy and paste it (lol) into my game, it shows up with an error. I dunno where to put it...

Also, in my Q3 map the camera moves straight through the map. What did you do to create that collision thing? Is it the anim part?

Thx
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Amazing!! I know you used SKeyMap to define controls, but when I copy and paste it (lol) into my game, it shows up with an error. I dunno where to put it...

Also, in my Q3 map the camera moves straight through the map. What did you do to create that collision thing? Is it the anim part?
I think it will be much easier for you to use Event Receiver and after that simply call if the key has been pressed

1) Create event receiver and key array

Code: Select all

bool keys[KEY_KEY_CODES_COUNT]; 


class Receiver : public IEventReceiver {
 public:
 virtual bool OnEvent(const SEvent& event) { 
    //* * * * * * * * * * * * * * * * * * * * * * * * * * * *
    if(event.EventType == irr::EET_KEY_INPUT_EVENT)
            {
               keys[event.KeyInput.Key] = event.KeyInput.PressedDown;
               return false;
            }
    //* * * * * * * * * * * * * * * * * * * * * * * * * * * *
    return false;
  }
}; 

Receiver e_receiver;

2) When you create your Irrlicht device add the receiver name at the end with & before it:

Code: Select all

createDevice(video::EDT_OPENGL, core::dimension2d<s32>(800,600),32, false, true, false,&e_receiver);
3) After creating the device fill the key array:

Code: Select all

 for(int x=0; x<irr::KEY_KEY_CODES_COUNT; x++) keys[x] = false; 
4) Use:

Code: Select all

if (keys[KEY_KEY_W]) {  DoSomething(); }



A: He`s loading the level here:

Code: Select all

device->getFileSystem()->addZipFileArchive("./baseq3/baseq3.pk3");
     scene::IAnimatedMesh* bspmesh = 0;
     bspmesh = smgr->getMesh("nemesis.bsp");

     scene::ISceneNode* bspnode = 0;
     bspnode = smgr->addOctTreeSceneNode(bspmesh->getMesh(0));
     bspnode->setPosition(core::vector3df(0,0,0));
     bspnode->setScale( irr::core::vector3df(2,2,2) );
B: Add collision to the level here:

Code: Select all

//triangle selector
	scene::ITriangleSelector* selector = 0;
	selector = smgr->createOctTreeTriangleSelector(bspmesh->getMesh(0), bspnode, 128);
	bspnode->setTriangleSelector(selector);
	selector->drop();
C: Create your camera

D: Add collision to th ecamera here:

Code: Select all

//collision detector animator
	scene::ISceneNodeAnimator* anim = 0;
	anim = smgr->createCollisionResponseAnimator(selector, camera, core::vector3df(30,50,30),
	core::vector3df(0,-100,0),
	core::vector3df(0,50,0));
	camera->addAnimator(anim);
	anim->drop();
For better explanation I advice you to check this tutorial:

http://irrlicht.sourceforge.net/tut007.html
It was very useful for me 5 days ago. And the Irrlicht documentation too.

Good luck!
:wink:
nayon
Posts: 16
Joined: Mon Mar 16, 2009 1:07 pm

Post by nayon »

EDIT: I realized my problem, it was the setPosition :D



Hi everyone, I have a problem. When I load the default q3 map that comes with irrlicht i have no problems. However, when I load the nemesis map, there are no collisions with the map. The console says:

Code: Select all

Irrlicht Engine version 1.5
Microsoft Windows XP Professional Service Pack 2 (Build 2600)
Using renderer: Direct3D 9.0
NVIDIA GeForce 8600 GT  nv4_disp.dll 6.14.11.7516
Loaded texture: textures/nemesis/gray
Loaded texture: textures/nemesis/blue
Loaded texture: textures/nemesis/orange
Loaded texture: textures/nemesis/white
Loaded texture: textures/nemesis/gray.jpg
Loaded texture: textures/nemesis/blue.jpg
Loaded texture: textures/nemesis/orange.jpg
Loaded texture: textures/nemesis/white.jpg
Loaded mesh: nemesis.bsp
Needed 0ms to create OctTree SceneNode.(1 nodes, 44 polys)
Needed 0ms to create OctTreeTriangleSelector.(1 nodes, 44 polys)
But the model does not collide.
The code is:

Code: Select all

device->getFileSystem()->addZipFileArchive("media/baseq3.pk3");

        scene::IAnimatedMesh* q3levelmesh = smgr->getMesh("nemesis.bsp");
        scene::ISceneNode* q3node = 0;

        if (q3levelmesh)
                q3node = smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0));

		scene::ITriangleSelector* selector = 0;

        if (q3node)
        {
                q3node->setPosition(core::vector3df(-1350,-130,-1400));

                selector = smgr->createOctTreeTriangleSelector(
                                q3levelmesh->getMesh(0), q3node, 128);
                q3node->setTriangleSelector(selector);
        }
		
		scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(selector,pnode, core::vector3df(20,30,20),
							core::vector3df(0,-5,0),
							core::vector3df(0,0,0));
		pnode->addAnimator(anim);
		anim->drop();

As I said, the node collides with the q3 map in the irrlicht tutorial, but not this one. Any ideas why?
Stratosphere
Posts: 20
Joined: Wed Sep 09, 2009 11:54 pm

Post by Stratosphere »

I tried using it with Quake Amy Knife aka Quark, when i tried to load a simple level (one room with a light) the light was in the wrong place and it had pillars that i didn't place in the room. I'll give screen shots in a bit, I want to use quark any suggestions?

nvr mind dumb me never read the pdf :oops: , i'll get it working with quark now :)
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: Latest tut on Quake 3 maps

Post by Cube_ »

you need to make a skybox, if it was totally open you would see 'the void' (what is outside the map, bad idea!)
"this is not the bottleneck you are looking for"
Post Reply