I have a numbers of problems hoping that someone will guide me as to what is to be done. Thanks in advance!!
1) How to placed a weapon on the enemy and as well as from the first person view?
2) Is the health of the player a .MD2 file? How can I keep a record of my character life?
3) Collision? When I run the Irrlicht engine in C++, I can shoot "red orb" by pressing the space bar. The "red ord" can collide perfectly onto walls resulting in some effect, but how I can detect the collision on the characters?
4) AI. What should I do to make the enemy chase after my character and and shoot him if they see him?
I am currently doing a project and need to get this done for submittion asap. I will apprepricate if anyone could help. =)
With a million thanks,
Haze
Weapon Positioning and AI
Hi
1) I don't really understand. Maybe try this: ISceneCollisionManager::getRayFromScreenCoordinates, and instead of the standard camera, create a new one and position it to the place of the enemy player.
2) The .md2 and other model formats cannot store these informations. You should track it yourself. E.g.:
3) I don't use Irrlicht collision system. If you want some advanced physics in your game, you might want to use a physical simulation engine too (ODE, Newton, Tokamak...). I use ODE and I prefer to use it's collision detection system instead of Irrlicht's one.
4) It is bit more complex topic than discussing all here You can find some great articles about game AI at GameDev.net
Toma
1) I don't really understand. Maybe try this: ISceneCollisionManager::getRayFromScreenCoordinates, and instead of the standard camera, create a new one and position it to the place of the enemy player.
2) The .md2 and other model formats cannot store these informations. You should track it yourself. E.g.:
Code: Select all
class Player {
//...
int health;
scene::IAnimatedMeshSceneNode* video_scene_node;
//...
};
4) It is bit more complex topic than discussing all here You can find some great articles about game AI at GameDev.net
Toma
Last edited by WToma on Sun Oct 09, 2005 7:40 am, edited 1 time in total.
"This is not a bug, this is a feature!"
Thanks for your reply. My first question is that: how do I equipped a weapon to my characters? This is my code :
mesh1 = sm->getMesh("../../media/sorcerer.md2");
if (mesh)
{
model1 = sm->addAnimatedMeshSceneNode(mesh1); //sorcerer
if (model1)
{model1->setMaterialTexture(0, driver->getTexture ("../../media/sorcerer.pcx"));
model1->setPosition(core::vector3df(100,40,-80));
model1->setScale(core::vector3df(2,2,2));
model1->setMD2Animation(scene::EMAT_ATTACK);
model1->setMaterialFlag(video::EMF_LIGHTING, false);
// model1->setMaterialType(video::EMT_SPHERE_MAP);
model1->addShadowVolumeSceneNode();
}
From the code, I have imported sorcerer.md2 into the program and load the texture - sorcerer.pcx to it.
1) I am wondering how can I import the weapon so that it can be placed on the sorcerer hand?
2) Like counterstrike, I would like to see the weapon that I am carrying on my screen. May I know how am I able to do that?
Thanks.
mesh1 = sm->getMesh("../../media/sorcerer.md2");
if (mesh)
{
model1 = sm->addAnimatedMeshSceneNode(mesh1); //sorcerer
if (model1)
{model1->setMaterialTexture(0, driver->getTexture ("../../media/sorcerer.pcx"));
model1->setPosition(core::vector3df(100,40,-80));
model1->setScale(core::vector3df(2,2,2));
model1->setMD2Animation(scene::EMAT_ATTACK);
model1->setMaterialFlag(video::EMF_LIGHTING, false);
// model1->setMaterialType(video::EMT_SPHERE_MAP);
model1->addShadowVolumeSceneNode();
}
From the code, I have imported sorcerer.md2 into the program and load the texture - sorcerer.pcx to it.
1) I am wondering how can I import the weapon so that it can be placed on the sorcerer hand?
2) Like counterstrike, I would like to see the weapon that I am carrying on my screen. May I know how am I able to do that?
Thanks.
There's two other threads in this forum covering FPS weapony, so check them out, they may help you.
Try setting the weapon as a child to the character, that should work for the enemies i think, you may need to offset the position to actually line up the weapon though, but when i've done it it's put the weapons in the right place, but in animations they're a few frames out of sync....
If you look at the code from the tech demo tutorial (the one where you can fire the red orb) then you can see how they've done the collision detection with the walls, but what you need i think is a metaselector instead of a triangleselector, and then if you can get a triangleselector from the character then you can add that to the meteselector as well as the triangleselector for the map and that may work... I'm atleast hoping that will work as i'll be wanting to do something like that for my project!
Try setting the weapon as a child to the character, that should work for the enemies i think, you may need to offset the position to actually line up the weapon though, but when i've done it it's put the weapons in the right place, but in animations they're a few frames out of sync....
If you look at the code from the tech demo tutorial (the one where you can fire the red orb) then you can see how they've done the collision detection with the walls, but what you need i think is a metaselector instead of a triangleselector, and then if you can get a triangleselector from the character then you can add that to the meteselector as well as the triangleselector for the map and that may work... I'm atleast hoping that will work as i'll be wanting to do something like that for my project!
I can confirm that the MetaTriangleSelector method works, as i've just managed to do it in my project, if you have trouble let me know and i can show some code, although it will be in java as i'm using a java binding for Irrlicht, but that just means you have to convert into C++ which is straight forward
Thanks for the reply. JP, can u send me the code regarding the collision? I am a newbie in game programming and thats why I had so many problem. Also, I dont really understand how I can set the weapon to be the child of the characters?
Pls email me at: s8340567h@ntu.edu.sg
Thanks a lot!
Haze
Pls email me at: s8340567h@ntu.edu.sg
Thanks a lot!
Haze
...for completeness
Weapon code for player camera:
This thread may help with adding a weapon to your characters:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=7514
________
NEVADA DISPENSARIES
Weapon code for player camera:
Code: Select all
mesh1 = sm->getMesh("../../media/sorcerer.md2");
if (mesh1)
{
model1 = sm->addAnimatedMeshSceneNode( mesh1 , sm->getActiveCamera(), -1); //sorcerer
if (model1)
{
model1->setMaterialTexture(0, driver->getTexture ("../../media/sorcerer.pcx"));
model1->setPosition(core::vector3df(100,40,-80));
model1->setScale(core::vector3df(2,2,2));
model1->setMD2Animation(scene::EMAT_ATTACK);
model1->setMaterialFlag(video::EMF_LIGHTING, false);
// model1->setMaterialType(video::EMT_SPHERE_MAP);
model1->addShadowVolumeSceneNode();
}
}
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=7514
________
NEVADA DISPENSARIES