IrrWizard?

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

Hi Guys,

Any pointers on using terrain instead of maps ??

From what I read, a terrain is something I add using code rather than a map or level I load.

I am using the irrWizard 1.1 (Core) framework.

I have used Armens very good terrain generator, and used that in the irrlicht terrain example, and works very well.

I have also added a very nice Sky Dome instead of a Sky Box.
(I'll post code for SkyDome if anyone wants it)

My basic game will be a (rpg / arcade style) character running round collecting basic object (say coins) for points, and shooting the odd enemy.

Hopefully to include some bush-like maze, to guide the player round the terrain.

So really what I need guidence on is loading a different (hopefully pre-formatted not random) terrain to my world for each game level.
Then I will place given objects / enemies at certain points on the terrain.

And finally any hints on what I do with the edges or borders of the terrain, so I just dont fall off the edge of the world.

Many Thanks Guys
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

trooper wrote: And finally any hints on what I do with the edges or borders of the terrain, so I just dont fall off the edge of the world.

Many Thanks Guys
Well, you could use perlin method to implement a seamless terrain where you walk one direction and never hit the edge of the world. After all, the real world is not flat and you cannot fall over the edge of the world if you reached the edge. :)

Also, I believe it's also persistent in that if you come across a hill and decide to back track to that hill again after going off north for hours, that hill will still be there when you head south again.

Maybe this may help you get started:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15480

I would just google for perlin.
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

Hi Lug,

Thanks, looks very useful !

I also found something called - LibNoise.

Seems good and very good examples.

Fast replay, cheers :D
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Core or Full Framework

Post by trooper »

Hi guys,

Ok guess this is the killer question.

I'm a noobie ok, but experianced Delphi programmer, so don't flame me :?

Should I use the Core framework, or use the FULL framework, and just trash the first level, to start my new project.

Seems the full framework is what I'm looking for, and will save huge coding since, weapons, health, ammo, and all that is in place, plus NavGraph, that the core is setup for, but not implemeneted.

I'm doing a 3rd person view (terrain based) RPG, well guess it's half RPG half FPS, as my character will still run round shooting stuff.

Screenshots so far: (dull but always nice to see others work)
http://www.thetrooper.co.uk/mygame

next question is:
In the full framwork am I actually a model or just a gun model and a camera ?
Hence I need to load a player model and move camera back.

Thats my goal so far anyway, get something running round the terrain, and some cool SFx.
Guess the Game play, enemies and AI, will all come later.

Unless anyone has a better suggestion on which aspects I should work on first.

Thanks
You scratch my back, I'll scratch yours.
BattleElf
Posts: 18
Joined: Sat Mar 04, 2006 10:55 am
Location: Brisbane, Australia

Post by BattleElf »

I believe it's just the gun model for the fps view. If you want 3rd person you have to add in the code to show the player model. My team hasn't got around to that yet but I don't imagine it'd take much to do.
elektrikal
Posts: 17
Joined: Tue Sep 26, 2006 8:01 am

Player but Not FPSPlayer

Post by elektrikal »

hi there
hey Im using IRRWIZARD 1.1 for my project but I need a Player...not a FPS Player ...so what u think is the best aproach to do that??

can anybody paste some code here for a player class which would be derived from IGameEntity and that fits in irrwizard structture???

many thx in advance
Sorry about my bad english.thanks.
roguelike
Posts: 14
Joined: Tue May 30, 2006 11:03 am

Post by roguelike »

Can't you copy and re-name the GamePlayer to GameFPSPlayer and then in the GamePlayer rip out all the FPS bits and put in some of your own stuff, maybe a pointer to the camera could be good.

If you wanted an RPG player, you could create an RPGPlayerStats class and add all your STR,INT,WIS and things there. And then in the GamePlayer class have a pointer to the RPGPlayerStats class and some accessors (getter and setter).
________
Locked funds insurance forum
Last edited by roguelike on Tue Feb 22, 2011 10:49 pm, edited 1 time in total.
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Player but Not FPSPlayer

Post by trooper »

Hi elektrikal

I have just used this in my project, was pretty easy to put into my IrrWizard Framework.

Give it a shot, if you get stuck I'll post some of my code.

http://irrlicht.sourceforge.net/phpBB2/ ... son+camera

Couple of notes, I used the Dwarf Model for testing, and it needs to be rotated 90 degrees on the Y axis, see the Cam.xml file, once you have downloaded from the above forum post.

This model does lack any running animation, so all he does is kneel down and stand as you walk around, but hey, it works
You scratch my back, I'll scratch yours.
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

Hi Guys,

I am having a problem adding a second level to the full framework

I have added one to the 'core' framework just fine.

It's pretty much the same, except instead of using - CGamePlayState::loadMap() - I have created a terrain, and also a 3rd person camera.

Everything seems fine, health and ammo hud loads, I can run around terrain with 3rd person camera.
I can see health and ammo power-ups on the terrain.

I can use mouse wheel to rotate weapons, and reload.
note: I can hear this happening, rather than see it.
weapon and textures load, in debug window, although I dont see them with my 3rd person camera and faerie model.

My problem is when I fire it crashes out here - GameWeaponOwnedStates:

// hit a wall (default), or water
switch (node->getID())
{
case ID_NODE_WATER :
pWeapon->getGameManager()->getFXManager()->createGenericParticleEffect(pWeapon->getGameManager(), pWeapon->getGameManager()->getWeaponManager()->getTargetsPosition(pWeapon->getGameManager()), "media/particle_green.bmp", 300, pWeapon->getDamage() +4);
break;
default :
pWeapon->getGameManager()->getFXManager()->createExplosion( pWeapon->getGameManager(), pWeapon->getGameManager()->getWeaponManager()->getTargetsPosition(pWeapon->getGameManager()) );
}

I think it is something to do with this in GamePlayState:
because I dont use loadMap()

// Load in game Level from resources
m_Selector = 0;
scene::IAnimatedMesh* mesh = pManager->getSceneManager()->getMesh(map);scene::ISceneNode* node = 0;
if (mesh)
node = pManager->getSceneManager()->addOctTreeSceneNode(mesh->getMesh(0));
if (node)
{
node->setPosition(mapPosition);
m_Selector = pManager->getSceneManager()->createOctTreeTriangleSelector(
mesh->getMesh(0), node, 128);
node->setTriangleSelector(m_Selector);
m_Selector->drop();
}
pManager->setMetaSelector();
pManager->getMetaSelector()->addTriangleSelector(m_Selector);


this is my 'selector' right after I create terrain in CGameStateLevel02:

// create a triangle selector
scene::ITriangleSelector* selector
= pManager->getSceneManager()->createTerrainTriangleSelector(terrain, 0);
terrain->setTriangleSelector(selector);
selector->drop();



Any ideas ??

I can post more code if required

Thanks in advance
:wink:
You scratch my back, I'll scratch yours.
area51
Posts: 338
Joined: Thu Mar 18, 2004 10:20 pm
Location: UK
Contact:

Post by area51 »

I suspect 'node' is null, you can strip all that stuff out if you dont care too much about hitting water, or add an if statement before checking that node is valid.

Code: Select all

   if (node)
   {
        // do something
   }
hope this helps.
________
gently caress
Last edited by area51 on Fri Feb 25, 2011 12:09 am, edited 1 time in total.
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

Hi,

OK, still a little confused, what should 'node' be ??

As I did not load map (ie the demo quake map) and created a terrain, would 'terrain' be my node ?

I still need to check if I hit water, as I will add some later, and again if I add other meshes (buildings/trees)

I'll post a little more code later, thanks
You scratch my back, I'll scratch yours.
Gladius_Coldhead
Posts: 56
Joined: Thu Oct 12, 2006 5:15 am

Post by Gladius_Coldhead »

IrrWizard 1.2?
when?
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

Hi Guys,

Carrying on from my previous problem

I'll add the code for my CGameStateLevel02:

Code: Select all

void CGameStateLevel02::Init(CGameManager* pManager)
{
	// perform generic initialisation from parent
	CGamePlayState::Init(pManager);	
		//CGamePlayState::loadMap(pManager, "20kdm2.bsp", core::vector3df(-1300,-144,-1249));
	
	// AI Navagation Graph, try xml first 	//Get WayPoints and Nodes for SFx & Objects
	if (!pManager->getPathManager()->loadNavGraph("navGraph.xml"))
		loadPathMap(pManager);
	pManager->getWeaponManager()->addFPSWeapons(pManager);
	pManager->getPlayer()->Init(pManager); // 100% Health & Ammo


	// add terrain scene node
	scene::ITerrainSceneNode* terrain = pManager->getSceneManager()->addTerrainSceneNode(
		"media/terrain/terrain1_HeightMap129.bmp",0,-1, 
		core::vector3df(0.0f, 0.0f, 0.0f), // position
		core::vector3df(0.0f, 0.0f, 0.0f), //rotation
		core::vector3df(80, 1.0f, 80), //scale
		video::SColor(255, 255, 255, 255),5,scene::ETPS_33); // color - LOD - Patch Size
	terrain->setMaterialFlag(video::EMF_LIGHTING, false);
	terrain->setMaterialTexture(0, pManager->getDriver()->getTexture("media/terrain/grass2.jpg"));
	terrain->setMaterialTexture(1, pManager->getDriver()->getTexture("media/terrain/grass_detail3.jpg"));
	terrain->setMaterialType(video::EMT_DETAIL_MAP);
	terrain->scaleTexture(1.0f, 10.0f);

	// create a triangle selector
	scene::ITriangleSelector* selector
		= pManager->getSceneManager()->createTerrainTriangleSelector(terrain, 0);
	terrain->setTriangleSelector(selector);
	selector->drop();

	// load and display animated fairy mesh
	scene::IAnimatedMeshSceneNode* anode_fairy = pManager->getSceneManager()->addAnimatedMeshSceneNode( 
		pManager->getSceneManager()->getMesh("media/faerie.md2"));
	anode_fairy->setMaterialTexture(0, pManager->getDriver()->getTexture("media/faerie2.bmp")); // set diffuse texture
	anode_fairy->setPosition(core::vector3df(3900,100,6700));
	anode_fairy->setCurrentFrame( 0 );
	anode_fairy->setMD2Animation(scene::EMAT_RUN); 
    	anode_fairy->setLoopMode( true );
	
    	// create collision response animator
	scene::ISceneNodeAnimator * anim = pManager->getSceneManager()->createCollisionResponseAnimator( 
		selector, anode_fairy, core::vector3df(50,50,50),	// was 60 100 60
		core::vector3df(0,-1,0), // gravity ??
		core::vector3df(0,0,0), 0.000500);
	anode_fairy->addAnimator(anim);
	anim->drop();

    	// create camera RPG ////////////////////////////////////////////////
    	scene::CCameraRPGSceneNode * cam = new scene::CCameraRPGSceneNode( 
	anode_fairy, pManager->getSceneManager(), 999,  pManager->getDevice(), selector, "cam.xml" );
    	pManager->getSceneManager()->setActiveCamera( cam ); 
	cam->setFarValue(12000.0f);
    	cam->drop();
    
	// disable mouse cursor
		//pManager->getDevice()->getCursorControl()->setVisible(false);

	// fog for effect
	terrain->setMaterialFlag(EMF_FOG_ENABLE, true); 
	pManager->getDriver()->setFog(SColor(0,200,200,255),true, 50, 5500);
	pManager->getDriver()->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true); 

	// Skybox
	loadSkyBox(pManager);

	// Add items/effects to level
	addAmmoPickups(pManager);
	addHealthPickups(pManager);
	addKeyPickups(pManager);

}
All I have done is comment out the LoadMap() and replace it with
a terrain, some fog and a skyDome, camera, and triangleSelector.

As fog, skydome, and other stuff are in the LoadMap() also.

Everything works fine, I can run around terrain, heatlth and pickups load ok.
I have health and ammo hud, but the problem is as my above post when I fire.

It just crashes out !!

Any ideas guys ??[/code]
You scratch my back, I'll scratch yours.
esaptonor
Posts: 145
Joined: Sat May 06, 2006 11:59 pm

Post by esaptonor »

I am of the opinion that in the shooting code it does soemthing with node as specified above. But you have not defined node. So in the shooting code, remove whatever the node part is. Or put an if statement as Area51 said above. This means only if the node is something will it try the next bit.
Whatever the problem is, it must be with the shooting.
area51
Posts: 338
Joined: Thu Mar 18, 2004 10:20 pm
Location: UK
Contact:

Post by area51 »

IrrWizard 1.2 has to be comming soon, it's just work commitments have total trashed my spare time at the moment. It should work with 1.2, however I havnt tested that yet.

@trooper The 'node' will represent something that the crosshair has clicked on thats been added to the SceneManager, ie Quake level, enemy model, terrain, water etc. Now if that dosn't return anything then the rest of the shooting code that relies on a 'node' being there will crash.

Im thinking the 'Skybox' or lack of it is your problem.

If you are still getting the crash, then step through the code using the debugger. That should give you a better idea where the problem lies.
________
MOTORCYCLE TIRES
Last edited by area51 on Fri Feb 25, 2011 12:09 am, edited 1 time in total.
Post Reply