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.

Dark Physics & Dark A.I. & Dark Dynamix / Open Source Player Module (Alone Game Engine)

Author
Message
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 27th Sep 2007 16:29
Hello,
My player module for my latest game in progress "Alone" is now almost complete.
I have attached the latest release of it, and will not upload any newer releases (unless it's a fix (see further down)) as I also want to keep some things unique to my game.

My reason for releasing it is because I spent hours upon hours trying to get a nice looking player system to wrok flawlessly.
And I tried to search the forum, but I didn't find much help; some ideas, but not much useful code.

I hope this will keep others from spending hours looking arond the forum, or struggle with the same concept
(I may just be terrible at coding though, and the reason why no one had posted a player module code was because it was so easy to write one )

Anyway, features are:
* movement
* rotation
* crouch
* jump
* lean left
* lean right
* camera bobbing

Attached is the download ~ 2.8mb
Included in the zip file is a simple level I made in 3D World studio, which is what makes the zip file so large.

Enjoy!

Oh, and if anyone knows why the player is sliding around please tell me, or post the code to fix it. Thanks.

I allways afraided from a clowns. aww..

Attachments

Login to view attachments
Oolite
18
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 27th Sep 2007 21:53
You can stand up still when you are in the tunnel and the bobbing is sometimes erratic, not sure why you slide around, its rather annoying.

Anyway, i like it, nice work.

Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 28th Sep 2007 00:31
You can stand up still when you are in the tunnel,
Ah, thanks for pointing that out. I forgot to fix it earlier when I decided the code was ready for public.
I will fix it as soon as I can.

the bobbing is sometimes erratic,
This is because I check if the player is on the ground.
If it isn't on the ground then this means it is in the air, which means that no bobbing should take place.
The command "PHY RAYCAST ALL SHAPES()" isn't 100% accurate as sometimes when the player stand on the ground, this command returns that it is no where near the ground/point of intersection.
This also mean that you cannot jump.
I am waiting for patch 1.3 of Dark Physics to come out; hopefully it has been fixed in that release.

not sure why you slide around, its rather annoying,
couldn't agree more.

Glad you like it I spent many hours to get it to work.

I allways afraided from a clowns. aww..
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 30th Sep 2007 00:08
Hi,

I have fixed two of the above mentioned bugs.

I still don't know why the player body is sliding around.
Anyone know?

version 0.04b is attached to this post.
Download the attached version at the top if you want the media, this hasn't been changed.

I allways afraided from a clowns. aww..

Attachments

Login to view attachments
Oolite
18
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 1st Oct 2007 23:23 Edited at: 1st Oct 2007 23:27
I've tried to delete the player body and create a new one, (much like your crouching code) when the player is on the ground, standing up and not moving, it just behaved really erratically jolting around.
Are you sure its not a friction problem, or the level is on a slight tilt (shot in the dark, i know but you never really know).

I also made some of my own personal changes, you now can't crouch while in the air and you can only sprint while touching the floor.

Lukas: Do you think you can make it so the player smoothly stands up, like he does when you crouch, i can see you are relying on the physics, it just feels odd to see him jolt back up so quickly. Also, it would be nice if the camera tilts to the direction you are leaning, it kind of looks like a sidestep, i haven't given the code a good thorough looking over yet so i'm not sure how you are handling the camera, this would be a welcome feature.

Attachments

Login to view attachments
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 2nd Oct 2007 03:42 Edited at: 2nd Oct 2007 03:43
Nice, I didn't think about those features.
I did make it so you are unable to move while in the air, and the velocity is unchanged, so you get a smooth jump, in a different version of the module. I will see if I can add that into v0.04 as well.

Quote: "Do you think you can make it so the player smoothly stands up, like he does when you crouch"

I will see what I can accomplish. I think it could be done by storing the old ypos of the camera just before the crouch key was pressed. then increment that ypos variable until it is the same as where it should be while standing.

Quote: "it would be nice if the camera tilts to the direction you are leaning"

I have tried this; Here we need to rotate the camera on its Z axis but DBPro's built in rotation commands is making this impossible to look ok. I would add EzRotate functions, but I don't think many people have that plugin.


Overall did you understand much of the code? Or should I write some comments about what is going on and what does what?

edit,
Quote: "Are you sure its not a friction problem"

I have tried to change the player material to different values.
I haven't tried to apply a material on the level object though, maybe I should. anyway time for bed.

I allways afraided from a clowns. aww..
Bozzy
17
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 2nd Oct 2007 09:30
Have you tried that "curvevale" or whatever it is... It worked nicely with INCA Pro movement

"I'm a firm believer that if a team scores one goal, then the other has to score two to win."
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 2nd Oct 2007 21:07
Attached is v0.04c
Fixes:


Bozzy,
what do you mean? :/ I am not using curvevalue for movement. Download the source and you will see how I am doing the movement.

I allways afraided from a clowns. aww..

Attachments

Login to view attachments
Oolite
18
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 3rd Oct 2007 02:21
Its now looking pretty spiffing mate, not sure i like the fact you can't move at all when you are in the air, maybe just make it less sensitive to the movement so you at least have some control over it.
I also seem to be sliding faster than before, maybe its worth applying a large downforce to the character or changing the material to something sticky when he is standing still.

I'll have a play tomorrow, I like the comments, again, nice work.

Login to post a reply

Server time is: 2024-05-06 10:26:15
Your offset time is: 2024-05-06 10:26:15