Arena of Honor - Multiplayer FPS with Newton physics

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Cairon
Posts: 40
Joined: Sun Apr 11, 2004 12:52 am
Contact:

Arena of Honor - Multiplayer FPS with Newton physics

Post by Cairon »

Hi everybody!

I'm want to announce my current project, Arena of Honor. Its an multiplayer first person shooter, with newton for physics, audiere for sound, and irrlicht for graphics. I currently only develop a win32 version of the game. But because all libraries I use are also available for linux, it shouldn't be very much work to port to linux.

Current status:
Network is still very buggy, not worth trying it. I still got very strange bugs because on my player update packets wrong PlayerIDs are received, and I don't know why.

The whole infrastructure of the game is quite complete, it loads config data from an xml file, and finds the installed level in the maps directory. I use quake3 bsp maps, with an additional xml file for level options, spawnpoints, entities, water surfaces, etc.

The physics now work quite well, I've got to different executables, one with player physics (Arena of Honor_P.exe), one without. I did this, because currently the player physics do quite much affect my weapon shots when the player moves forward.

I have implemented most weapons, and some of them are quite funny (espacially the shotgun, 5)

As far as I know, this seems to be the most developed opensource fps game with irrlicht, so I hope it will help others as an example.

If you've got any suggestions, bug fixes, or comments, just write it into this thread, or contact me via ICQ# 57468449

Project page: http://aoh.arturh.com

Happy new year everybody!!!
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Very very nice work. One remark: the movement. Strafing left, right and backwards work at the usual speed (quite fast but it's also Q3-like :wink:) but strafing frontwards is horribly slow. Also strafing forward + left or right is that slow. Maybe some wrong values for the forward strafing?
Great work.
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Post by schick »

Great work! Nothing to say, but Great work!

Cheers, Schick
Please send me an e-mail instead of a private message.
Cairon
Posts: 40
Joined: Sun Apr 11, 2004 12:52 am
Contact:

Post by Cairon »

thanks :-) Well, I know. But I don't know why :-( The movement when using player physics is very strange, because I can't just double the speed values, and the player speed is doubled. I played around a lot with the values, but I don't get the forward movement good :-((
Guest

Post by Guest »

Probably one of the best examples I've seen yet of the Irrlicht engine being used....absolutely lovely!
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

I haven't downloaded the executable yet (slow connection), but i did take a quick look at your source, and it looks very nice. From your site and source I got the impression that you were using actual physical bodies for your bullets. I've just been doing raycasting in my own project because I was under the impression that With high-speed small objects such as bullets there was a good chance that Newton would miss the collision.
1)Have you been having any problems with bullets passing through things?

2)If not, what speed are your bullets going at?

3)Also, if you're using true physical bullets, what are u using for player and enemy collision primitives? If you just use a box or cylinder I'd asume that you'd then have to do a raycast with the mesh to determine the exact spot on the mesh where the bullet hits. Is that what you do?
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Cairon
Posts: 40
Joined: Sun Apr 11, 2004 12:52 am
Contact:

Post by Cairon »

to 1: Yes, sometimes i have this problem, but i think its not very often with these bullets. i create them as a cylinder with NewtonCreateCylinder, you can see the whole code in mg.cpp in ShotPrimary()

to 2:

core::vector3df direction = target - position;
direction.normalize();
direction *= 2000.0f;
core::vector3df nVeloc (direction * IrrToNewton);
NewtonBodySetVelocity(body, &nVeloc.X);

so its 2000 / 32, for conversion between irrlicht and newton

to 3: i'm currently working on the player / bullet collision, and i have two different approches:

1. I try to call the callback function with the player set material to m_playerMaterial, and all the bullets set the material to m_bulletMaterial.

NewtonMaterialSetCollisionCallback (nWorld, m_bulletMaterial, m_playerMaterial, NULL, BulletHitsPlayer, NULL, NULL);

2. Thats what i currently implemented, I check every frame for every bullet if they are in a bounding box where the player is... I know that this method is very slow and inaccurate, so I try to rewrite my code for method 1. ;-)

I got the player movement running now very nice with player physics. But i've got the problem, that my weapon shots (first weapon and rocket launcher f.e.) are shooting in very strange direction when i move forward or strafe. I don't know why, i'm doing simply:

start = camera->getPosition;
end = camera->getTarget - start; // with collision testing for walls, shorted

anim = sm->createFlyStraightAnimator(start, end, t);
node->addAnimator(anim);
anim->drop();

Does anybody has an idea why that could happen? you can try it if you run the Arena of Honor_P.exe

Another think I tried out, to increase the accuracy of my physic shapes, is to debug the newton world. I found the function NewtonBodyForEachPolygonDo in the newton docs, and wrote a function to draw all the newton bodies wireframe:

Code: Select all

void _cdecl NewtonDebugBodyOutlines(const NewtonBody* body, int vertexCount, const float* FaceArray, int faceId)
{
	core::vector3df p0 (FaceArray[0], FaceArray[1], FaceArray[2] );
	
	const video::SColor c0(0,0,255,0);

	for (int i = 2; i < vertexCount; i ++) 
	{
		core::vector3df p1( FaceArray[(i-1) * 3 + 0], FaceArray[(i-1) * 3 + 1], FaceArray[(i-1) * 3 + 2] );
		core::vector3df p2( FaceArray[i * 3 + 0], FaceArray[i * 3 + 1], FaceArray[i * 3 + 2] );
	
		core::triangle3df t;
		t.set(p1*NewtonToIrr,
			  p2*NewtonToIrr,
			  p0*NewtonToIrr);
		
		driver->draw3DTriangle(t, c0);
	}
}

That works a little bit, but always the newton world is moved by and offset to the irrlicht world, and sometimes the whole wireframe map is in a completly different position, or you see just crazy lines.

I guess thats a problem with the irrlicht draw3DTriangle function, because I don't think that newton changes the polygon values in a way, this effect could happen.

You can try it out yourself by typing O.

Ehm, another thing :D

I GOT THE NETWORK STUFF RUNNING

If you want to play with me, contact me via ICQ# 57468449.
I'm working on a internet master server too, to easy the connection founding.
Cairon
Posts: 40
Joined: Sun Apr 11, 2004 12:52 am
Contact:

Post by Cairon »

ahh, one important this i forgot about the bullets:
i shot them without gravity enabled. in my CNewtonObject class, i've got a boolean whether gravity should be enabled or not. and i'm checking this in my newton callback function before applying gravity.

i enable gravity after 500 ms, to let the bullet fall down :-)
That makes the bullet flying perfectly to his target.
VeneX
Posts: 228
Joined: Sun Nov 30, 2003 3:32 pm
Location: The Netherlands
Contact:

Post by VeneX »

If you shoot while you are walking foreward, the bullets will collide with the player and fall to the floor...
But I like this game :D
Visit my website @ www.venex.be
Plethora project will be added to the site
AMD AthlonXP 2600+, 512MB DDR, Radeon M10 (mobile 9600) PRO 64MB, WinXP
Cairon
Posts: 40
Joined: Sun Apr 11, 2004 12:52 am
Contact:

Post by Cairon »

yeah, i know... thats the biggest bug when using player physics i currently fight with ^^
Ronin
Posts: 116
Joined: Wed Mar 03, 2004 6:23 pm
Location: Germany

Post by Ronin »

Looks really good...

How did you the timing for Newton Update, in a test app I wrote, everything moves like in slow motion. I nearly copied this part from merciors tutorial. I tried several different values for gravity, masses and timestep, but with no luck.

I also tried a different approach, called "Accumulative Timeslices", that I found in the Newton forums, but that result was horrible.

I would like to know how you did it, because it looks very cool in your demo...
YASS - Yet Another Space Shooter - www.yass-engine.de
Cairon
Posts: 40
Joined: Sun Apr 11, 2004 12:52 am
Contact:

Post by Cairon »

you can find the physics things in physics.cpp in the source package. I do it with this code:

f32 fps = (f32) device->getVideoDriver()->getFPS();
if (fps > 0.0f) {
NewtonUpdate(nWorld, 1.0f / fps);
}

I got this from the mercior tutorial.

EDIT: and i set NewtonSetMinimumFrameRate (nWorld, 60.0f); after creating the newton world.
Arena of Honor: http://aoh.arturh.com
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Putting this code at the beginning of your Newton wireframe drawing fucntion should help

Code: Select all

SMaterial m;
  m.Lighting = false;
  driver->setMaterial(m);
  driver->setTransform(ETS_WORLD,matrix4());
The mostimportant part there is that you are setting the modelview matrix to identity. I think it is not doing this that led to lines in weird places. Your triangle coordinates were beign multiplied by some other model's matrix.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Cairon
Posts: 40
Joined: Sun Apr 11, 2004 12:52 am
Contact:

Post by Cairon »

THANK YOU SO MUCH :D
It works now perfectly, but it slows down the fps a lot of course :D
You can access this debugging feature by pressing 'O' in my game.

Now i can perfectly adjust the collision primitiv for my bullets and balls.
Arena of Honor: http://aoh.arturh.com
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

Congrats 8) !

Good design, runs smoothly on my 800 MHZ PC.
I take a look on your sources and suggest some useful things, which can be included in next Irrlicht release - I mention IScaleAnimator for example.

Another advantages for Irrlicht users are physics and network implementation. I think that stuff like raknet tutorial will be very useful and can be included in Irrlicht tutorial pages, of course if you have time for that :wink:

I see for first time raknet with Irrlicht together in action.

Thanks!
Post Reply