Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] FPS engine using sparkys collision dll and dbo maps

Author
Message
Softwizz
14
Years of Service
User Offline
Joined: 14th May 2009
Location: U.K.
Posted: 12th Jul 2009 19:20 Edited at: 26th Nov 2010 17:55
Here is my FPS engine so far, it uses dbo maps (or levels, whichever you prefer) and sparky's collision dll.

The dll is here (i think)
http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

I have adapted the code from the complex collision demo that comes with the dll for the movement.

I have also added a minimap to the screen which could be adapted for loads of things. The minimap code was adapted from noo8 thread here: http://forum.thegamecreators.com/?m=forum_view&t=153609&b=6

The keys are:
WASD to move
mouse to look around
hold left shift to run
hold c to crouch
space jumps

There is a compiled version if you want to have a look at how it plays here:

The source code with a dbo level but no textures is attached.

Let me know what you think.





Attachments

Login to view attachments
LEAF
15
Years of Service
User Offline
Joined: 29th Oct 2008
Location:
Posted: 16th Aug 2009 21:23 Edited at: 16th Aug 2009 21:29
That's awesome dude! I get 82 fps (128 if I change sync rate to 0) on a cheap laptop . Can I use this code for my own games?

Regards,
Black Retro Box

-Feel free, run around naked
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 17th Aug 2009 00:30
Quote: "Can I use this code for my own games?"

Considering this is in the Code Snippet section you can use it if you want to.

Looks neat by the way, I'm going to use that Mini map thingy in DGDK for sure

It's not the world that turns against you, it's you that turns against the world.
Softwizz
14
Years of Service
User Offline
Joined: 14th May 2009
Location: U.K.
Posted: 18th Aug 2009 05:24 Edited at: 18th Aug 2009 05:27
Hey
Yes you can use the code LEAF, it is in the code base as well and I have credited other peoples code I adapted.
I am still working on this as well, screenshot of a weapon and some test collectable objects, also I managed to get a HUD working, at the moment it displays the player position, score, fps and details for opening doors.


Nothing to see here, move along please.

Attachments

Login to view attachments
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 19th Aug 2009 18:29
Its starting to look like Quake ^_^


Your signature has been erased by a mod
lil marioman
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: Canada
Posted: 24th Aug 2009 19:02
Is there by any chance, a way to limit the camera angle? It's kinda unrealistic to be able to look 360 degrees every way.

I'm scared of bugs. I mean that in more ways than one.
Softwizz
14
Years of Service
User Offline
Joined: 14th May 2009
Location: U.K.
Posted: 24th Aug 2009 21:17
Use:


this will narrow the field of view, replace xx with the field of view angle.

To experiment put the FOV commad after the line:


Nothing to see here, move along please.
lil marioman
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: Canada
Posted: 24th Aug 2009 23:00 Edited at: 24th Aug 2009 23:04
Not exactly what I ment, but thanks.

What I ment was, if you keep moving the mouse upwards, you're able to look directly above you, behind you, and directly below you.. which isn't exactly realistic...

As in, if you rotate the camera upwards with the mouse to about 270 degrees, everything becomes inverted. And I don't want the player to be able to stretch their head 270 degrees without rotating their body.

I'm scared of bugs. I mean that in more ways than one.
Softwizz
14
Years of Service
User Offline
Joined: 14th May 2009
Location: U.K.
Posted: 25th Aug 2009 04:44 Edited at: 25th Aug 2009 04:46
Well what you need to do is limit the angle the object the camera is attached to can rotate.
You will need to add something like:


In the moveplayer() function

so the first few commands of the function will be:


See what I mean?

Nothing to see here, move along please.
NEW
17
Years of Service
User Offline
Joined: 4th Dec 2006
Location:
Posted: 30th Aug 2009 20:43
It is a great code. I used it to make fps game. But I have the player going into an elevator that goes up and down. My problem is that even though I put collison on the elevator, the player falls through the floor. I set the collison on the elevator the same as I set it for all the other stationary objects in the world.

MOE
Softwizz
14
Years of Service
User Offline
Joined: 14th May 2009
Location: U.K.
Posted: 1st Sep 2009 17:34
Hey NEW,
I dont know what you mean by 'the player falls through the floor'
Also I will assume you are using Sparkys collision DLL
If the elevator is on an upper floor and the player walks in but falls through the floor you could try putting:

where xx is the elevator object number, after every movement of the elevator.
also
You may need to move the player with the elevator if the problem is the player is left in position when the elevator moves.

try it out and post you elevator move code so i can have a look, i will try out my own elevator code as it is something i have not tried before and it may be a usefull excercise.

Nothing to see here, move along please.
Softwizz
14
Years of Service
User Offline
Joined: 14th May 2009
Location: U.K.
Posted: 1st Sep 2009 20:36
I have tried to make some elevator code and it works!
I have made a new thread for it as there doesnt seem to be anything like it when I searched the forum, check it out:

http://forum.thegamecreators.com/?m=forum_view&t=157213&b=6&p=0

Nothing to see here, move along please.

Login to post a reply

Server time is: 2024-05-04 23:39:53
Your offset time is: 2024-05-04 23:39:53