basic First Person engine - an open-source community project

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

basic First Person engine - an open-source community project

Post by jph_wacheski »

Ok, here is a basic First Person control set up that I built over the past few days,. I am going to develop a game using this; however, in an attempt to help grow the ZGE community I am offering this as our first community based game engine!

My hope is that the rest of you will have a look at what I have done here and help make improvements, and add more to it, so we can all benefit from working together on a simple first person game framework.

I am just using the Box3D collision style,. I attempted to do this with the OBB style,. however, as the player or targets rotated they would get stuck in the "walls". Using this method we also gain jumping support with out having to code much for the z direction as the Box3D does most of the work. The jumping is one feature that is still not wroking correctly just yet,. my 'grounded' variable is not being reset properly,. and the player can sometimes jump in the air,.

The other major issue currently is the translateing of the aiming into the proper velocity for the z axis of the shots,. currently it works somewhat however it is just a crude hack I guessed at,. and the aim is a bit off. As you know my math skills are weak,. but what i can see is that as the angle moves away from the horison the x and y velocity needs so decrease,. just not sure the proper relationship for that,. trig once again.

So there you go,. have a look and post improvements or additions or just chat about possible implementations of such an engine. peace.
Attachments
basic_FP_engine_001.zip
iteration 001 of the open source ZGE FP engine!
(3.23 KiB) Downloaded 569 times
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Good work jph! Looks like Gyro Phyter 3D :)

I can't help you with the trig as my math skills aren't good enough, hopefully Kjell or Francesco will come to the rescue here.
User avatar
Kjell
Posts: 1881
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi,

Use the following code to get the aim right.

Code: Select all

CurrentModel.Velocity.Vertical = sin(CurrentModel.Rotation.Vertical*Pi*2);
CurrentModel.Velocity.Longitude = sin(CurrentModel.Rotation.Horizontal*Pi*2)*cos(CurrentModel.Rotation.Vertical*Pi*2);
CurrentModel.Velocity.Lattitude = cos(CurrentModel.Rotation.Horizontal*Pi*2)*cos(CurrentModel.Rotation.Vertical*Pi*2);
What's horizontal, vertical etc. depends on your preference. I've attached a example, aim with mouse and shoot with left mouse button.

K
Attachments
Aim.zip
(38.33 KiB) Downloaded 581 times
User avatar
ithamore
Posts: 6
Joined: Sat Aug 30, 2008 6:43 am
Location: Expatria

Post by ithamore »

Thanks, jph. I'm really liking this.
Post Reply