CCT PhysX 2.0

Posted By: 3run

CCT PhysX 2.0 - 01/24/16 20:24

UPDATE!

Simple cct (character controller) made with PhysX (SDK 2.8.4) plugin.
I've modified ackphysx.dll community version plugin, to get more PH_CHAR features.
Tested on several machines, it should work out of the box!
This template works only with CAPSULE hull! I don't recommend using BOX hull!

It currently supports:
Quote
It currently supports:
- collision masks (GROUP_NON_COLLIDABLE, GROUP_COLLIDABLE_NON_PUSHABLE, GROUP_COLLIDABLE_PUSHABLE)
- pXent_updateCharacterExtents for crawling/standing
- pXent_setCharacterSettings for changing skinWidth, stepOffset and slopeLimit for all ccts
- gravity + jumping
- inertia
- sliding on slopes
- 3d camera with collision detection and zooming
- kinematic platform (following the path) + elevator (moving to target position and back)
- added helper functions to check, if props have smashed the cct
- terrain support

Known issues:
Quote
- cct can (rarely) fall through kinematic elevator, if it's moving upwards and cct is falling on it
- problems with normal detection (can be seen in the video), on polygon edges normal.z can't glitch... this causes some weird movement on slopes if sliding is enabled, to void this problem, disable sliding also in screenshot folder you can see that 'Use Tesselation' flag in Map Compiler makes even more polygons/edges thus that will cause a lot of jittering on slope movement (cause on edges normal.z goes beyond the slope limit - can be seen in video)


You can see cct in motion on my youtube channel:
https://youtu.be/mfTzt57JoAw

HOW TO USE ?

There are lots of limitations to this movement template, mainly caused by physX itself (old SDK).
But by learning how the demo scene is made and setup you'll be able to get (more or less) suitable results.
Quote
- Mainly I would advice to keep the same size and don't increase/decrease world scale! Currently 40quants = 1 meter, NPC is 64 quant height.
- To make sure that correct .dll was loaded, there is a function called ackphysxHelloWorld();
- To make slope slidable, set it's FLAG8 in WED

CREDITS:
Quote
- original physX plugin was made by Chris Kahler
- based on ackphysX community plugin by Christian Behrenberg aka (HeelX) https://sourceforge.net/p/a8physx/home/Home/
- prototype.wad by Damocles (can be also found in AUM 100)
- elevator and platform sounds are taken from Freedoom project https://freedoom.github.io/ https://github.com/freedoom/freedoom
- crate model from old Newton plugin demo which was made by thomas oppl in 2007 (unfortunately I don't know who made the model itself)


Download link:
https://github.com/3RUN/Acknex-CCT

Screenshots:
[Linked Image]
[Linked Image]
[Linked Image]

If any bugs will be found, report them. I'll try to fix them in my spare time. Any feedback is (as always) welcome.

Best regards.
Posted By: 3run

Re: CCT PhysX 1.0 - 01/24/16 22:06

To make you understand why I'm having difficulties with implementing crawling... CCT doesn't change it's hull like usual entities in Acknex do, first of all I need to unregister and register CCT back in physX everytime I change it's size (when I go crawling and back to standing, with physX 3.x you don't need to do this, but native Acknex physX is only 2.x), plus when I lower 'max_z' to decrease the size of the bbox, CCT instead of lowering the upper 'max_z' only, makes the whole hull smaller, take a look at this screens:
Quote:
Standing (max_x, y, z = 16, 16, 32):

Crawling (max_x, y, z = 16, 16, 5):
So the thing is, that I need to update the Z position of the CCT shape, but it's different to the one we see in the Acknex (model's position with it's bbox size). I found out that with the CCT setting that I have in my demo, I need to lower bbox model with 10.8 quants when I go to crawling (so it actually looks like only the upper side of the bbox goes down). In 3dgs_snakes plugin there was that nice function called 'pX3ent_getfootposition' which used to return the foot position of the CCT hull (independent to it's size, cause foot position did not change!), native Acknex physX misses such useful function... (maybe cause it's outdated, and 2.x SDK did not support things like this? hard to believe, but it might be the answer). Even after changing the Z position manually 'by hand', I found out that it ruined the whole gravity movement that I have... CCT just falls through the ground after going to crawling state and then back to standing. So currently I'm having some difficulties with all this crap (this is why I hate Acknex native physX! it's too outdated and not flexable, and I don't really want to mention all the bugs it has). Anyway I'll try to sort things out and handle this situation, then I'll realise updated version with crawling and some tweaks.

Best regards!
Posted By: Steempipe

Re: CCT PhysX 1.0 - 01/26/16 17:38

That addition is pretty cool! I don't know crap about what you are coding, so to me it is pretty outstanding. Good luck with the workarounds.
Posted By: 3run

Re: CCT PhysX 1.0 - 01/26/16 18:14

Originally Posted By: Steempipe
That addition is pretty cool! I don't know crap about what you are coding, so to me it is pretty outstanding. Good luck with the workarounds.
Thank you very much, for your kind words and wishes! I have an idea for crawling, let's see how it's turns out. laugh


Best regards!
Posted By: 3run

Re: CCT PhysX 1.0 - 01/26/16 21:20

GREAT NEWS! I GOT CRAWLING TO WORK! grin

I used two different shapes (two different models, one for standing hull and one for crawling! it's almost same as pXent_addshape, but CCT!), and I switch between them while moving (each of those shapes have pointers and I have one main pointer, that 'points' to the current hull, this way I can handle movement, camera, animations and whatever!). Maybe tomorrow I'll upload a new demo, which will show all results!

Edit: my happines did not last for too long, cause somehow this little fuc*er doesn't fit this little whole... lubricant/vaseline didn't help here...

I guess most of community users who used to ask me "why don't I just use physX instead of OBB" now can see a materialized answer to their question. Problem is, that as far I as understood I need to keep stand and crawl hulls symmetrical somehow (32x32x64 and 32x32x32), other ways it will result falling trough ground crawl hull (maybe I could make some dirty workaround, but I'm really pissed off right now... and I don't really want to publish something dirty and too tricky to use at the end). Tomorrow I'll continue on copulating with lovely Ackenex and it's lustful physX...


Best regards!
Posted By: alibaba

Re: CCT PhysX 1.0 - 01/27/16 11:57

Keep up the good work!
Posted By: 3run

Re: CCT PhysX 1.0 - 01/27/16 12:25

Thank you! I already have an idea for workaround, let's hope it will work grin

Best regards!
Posted By: 3run

Re: CCT PhysX 1.0 - 01/27/16 13:27

AND IT WORKS! grin

Here is a little demo (I'm still working on it, but the fact that I got swaping hulls correctly made me happy!):
Download link
Quote:
Press C or CTRL to toggle CRAWLING!
When everything will work correctly, I'll upload a source code.

Edit: shit... I faced another trouble, now with c_trace detecting the celling above the CCT. All troubles caused by the position of CCT hulls, cause I need to move crawling hull down (it's centered in MED) to match standing hull's lowest point, but when I switch to crawling hull (actually when crawling), then I need to update standing hull's positions, I do exactly the same but with positive value (for crawling hull offset from standing hull is -24, for standing hull offet from crawling hull is 24). This causes some shit for 'c_trace', even it actually looks correct (I debug from to positions of the trace via 'draw_point3d', and they are always the same, as it should be). Trace detects the celling at first when CCT only starts penetrating the hole in the wall (where CCT crawls in), then it doesn't see celling till CCT fully enters the hole. I don't know what to do with this right now. physX plugin from 3dgs_snake had very useful function called 'pX3ent_getfootposition' or something like this, I really miss that one now...

Edit2: I'm opened for ideas.

Best regards!
Posted By: 3run

Re: CCT PhysX 1.0 - 01/28/16 10:22

I've got my problem solved. Now I need to add ladder climbing, platforms and some tweaks before releasing the source code (it will be dirty but yet useful).

Edit: added ladder! it's still not finished yet, so no source code, just a demo for you guys to give it a try. If you'll find any issues, please let me know.
Here it is:
Download link


Best regards!
Posted By: Reconnoiter

Re: CCT PhysX 1.0 - 01/28/16 11:11

It works very well, well done! I could only detect 1 tiny problem is that when you jump while crawling through something, the camera goes through the roof. But perhaps this is a pain to solve and a simple c-trace could fix this I quess.

Also would be cool if you could implement that if you are on the ladder and jump, you can jump towards a certain direction a bit with by holding down a move key while jumping. (hope that makes sense grin )

Anyway, I look forward to the code. My current move code is still a pain with certain ramps and keeping a smooth camera/view.
Posted By: Iglarion

Re: CCT PhysX 1.0 - 01/28/16 12:13

Works very well. It will be really nice and useful contribution, as always.

Keep it up!
Posted By: 3run

Re: CCT PhysX 1.0 - 01/28/16 13:21

Thank you guys! I appreciate your support. And I'm really happy that it works good laugh

I only tested this on the levels made of blocks, it should work exactly the same on levels made of models (maybe with some tweaks for traces), but I didn't test it with terrains yet. It theory it should work too, but I guess on too steep slopes, gravity towards sliding direction won't be so smooth and player will jump a little (well, this will happen in real life too).

Reconnoiter@ about jumping it a particular direction, that's a good idea, but there should be a room for improvements, right? tongue So some of community members will be able to improve the code and share back with us.

Edit: I added terrain into the test level, and it seems to work pretty nice laugh Also tweaked few things that I found out (plus lowered the crawling camera height, it might seems to be too low.. but this is the only thing I can do so far for now, cause it's probably a bug related to (as I already mentioned in previous post, where little bbox didn't fit big hole in the wall) how Acknex's physX is fu**ed up, and I don't rely on jcl, cause waiting for update may take forever). The other thing is, if you are going to use this in your game, don't allow player to jump while crawling grin Or even more dirty way, trace upwards while crawling and define the height for the trace, so when you jump on a specific height trace will touch the celling and will reset jumping forces (simply FORCE.z = 0).

Few screens:
Quote:
Terrain:

Camera in crawling state:


Best regards.
Posted By: Reconnoiter

Re: CCT PhysX 1.0 - 01/28/16 17:20

Very nice

Quote:
grin Or even more dirty way, trace upwards while crawling and define the height for the trace, so when you jump on a specific height trace will touch the celling and will reset jumping forces (simply FORCE.z = 0).
, dirty lite-c code all the way grin
Posted By: 3run

Re: CCT PhysX 1.0 - 01/28/16 17:36

Originally Posted By: Reconnoiter
Very nice

Quote:
grin Or even more dirty way, trace upwards while crawling and define the height for the trace, so when you jump on a specific height trace will touch the celling and will reset jumping forces (simply FORCE.z = 0).
, dirty lite-c code all the way grin
Yaaay! grin
Posted By: alibaba

Re: CCT PhysX 1.0 - 01/28/16 21:34

Nice work 3run, I´m sure it will be useful!
Posted By: 3run

Re: CCT PhysX 1.0 - 01/28/16 23:06

Thank you man. I'll do my best.

Best regards!
Posted By: 3run

Re: CCT PhysX 1.0 - 02/09/16 10:12

!!!!!!! UPDATE !!!!!!!
Quote:
Added crawling, proper jumping and some other tweaks to the previous version. I still can't get moving platforms to work, cause of the bug with 'setgroupcollision' thing... I also removed 'proper collisions' with rigid bodies from the previous version, cause it's really unstable and causes some weird behaviours, thus if you want proper collisions with rigid bodies, you will probably need to use rigid body instead of native CCT (or write your own physX plugin!).

Here is a new version:
Download link

Nasty screen:


Best regards!
Posted By: sebbi91

Re: CCT PhysX 1.0 - 02/09/16 14:28

Looks really nice!
Thank you very much for sharing the source laugh

Best regards!
Posted By: 3run

Re: CCT PhysX 1.0 - 02/09/16 14:33

Originally Posted By: sebbi91
Looks really nice!
Thank you very much for sharing the source laugh

Best regards!
You are welcome! I hope that it will be useful!

Greets
Posted By: Kartoffel

Re: CCT PhysX 1.0 - 02/09/16 18:16

cool stuff 3run, works really well! :]
Posted By: 3run

Re: CCT PhysX 1.0 - 02/09/16 18:53

Originally Posted By: Kartoffel
cool stuff 3run, works really well! :]
Thank you. I'm glad you like it!

Best regards!
Posted By: Steempipe

Re: CCT PhysX 1.0 - 02/10/16 20:32

Nice! Great to follow your "trials and tribulations". Good stuff.
Posted By: 3run

Re: CCT PhysX 1.0 - 02/10/16 21:38

Originally Posted By: Steempipe
Nice! Great to follow your "trials and tribulations". Good stuff.
Thank you. I tried to explain as much as I could, so forum users won't just use it as it is, but will understand how things work (workarounds).

Best regards!
Posted By: Steempipe

Re: CCT PhysX 1.0 - 02/10/16 22:28

Originally Posted By: 3run
Originally Posted By: Steempipe
Nice! Great to follow your "trials and tribulations". Good stuff.
Thank you. I tried to explain as much as I could, so forum users won't just use it as it is, but will understand how things work (workarounds).

Best regards!


You've done great! I got it working "out of the box" with no issues, and it's way over my head. Keep on!
Posted By: 3run

Re: CCT PhysX 1.0 - 05/24/20 18:58

New version available! Check the first post!
Posted By: 3run

Re: CCT PhysX 1.0 - 05/25/20 09:29

UPDATE! Fixed problem with not being able to run on different PCs (.dll wasn't picking up). Now it should work (tested here on several machines).

Edit: added
Quote
-kinematic platforms (following the path) and elevators (moving to target position and back)!
-executable
Posted By: CodeMaster

Re: CCT PhysX 1.0 - 05/25/20 17:20

Cool, thank you!
Posted By: 3run

Re: CCT PhysX 2.0 - 05/27/20 19:02

CodeMaster@ you are welcome smile

There is an update, found, and fixed bug in pXent_updateCharacterExtents.
Quote
- pX_setunit was affecting cct size, pos and stepHeight in pXent_updateCharacterExtents. So with each step change, you had to tweak some values to get same results. Now it's working correctly.
- fixed origin offset (when going to stand/crawl), now no values to tweak, it just should work!
- updated executable


Best regards!
Posted By: 3run

Re: CCT PhysX 2.0 - 05/28/20 23:21

UPDATE!
Quote
-added collision masks for collisions between cct and rigid bodies (GROUP_NON_COLLIDABLE, GROUP_COLLIDABLE_NON_PUSHABLE, GROUP_COLLIDABLE_PUSHABLE)
-added workaround for sliding slope bug with normal.z jerking! (in order to make slope slidable set it's FLAG8 in WED and its slope angle should exceed slope limit)
-increases skinwidth for cct to 1 quant
-updated executable

Posted By: 3run

Re: CCT PhysX 2.0 - 05/31/20 10:25

UPDATE!
Quote
-added pXent_setCharacterSettings to change cct settings (skinwidth, stepoffset, slopelimit)
-added static friction and restitution parameters for all static bodies created on physX_level_load call
-tweaked pushing, so cct now can't push heavy rigid bodies with GROUP_COLLIDABLE_PUSHABLE group
Posted By: Quad

Re: CCT PhysX 2.0 - 05/31/20 13:41

Hey 3run,

Very well rounded controller, actually. Only thing you might want to look in to is moving platform acceleration and air drag.

You can see that on the moving platform; when player jumps while it's moving with the platform, it suddenly stops and jumps in-place, forward movement is not taken in to account. You do not want it to keep that exact same velocity all the way through the jump though, it should degrade over time after you lose contact with the platform, otherwise you would land exactly on the same point in the platform as you started your jump, while the platform has moved. That degradation over time is the air-drag(plus also the fact that platform is not pushing you anymore)

Also, have you considered updating the physx plugin to latest physx versions?
Posted By: 3run

Re: CCT PhysX 2.0 - 05/31/20 14:00

Hey! Thank you for your feedback! laugh

I didn't really think about adding air drag on platforms, but it should be easy (if it's gonna be needed).
Also, platform rotations aren't affecting cct, this shouldn't be really hard to add too (in newer physX sdk this should be handled automatically I guess).
Originally Posted by Quad
Also, have you considered updating the physx plugin to latest physx versions?
Do you mean the latest physX plugin source code, or do you mean SDK 4.1?

Anyway, I couldn't compile physX plugin source code (from the download page), so I used the community version which was made by HeelX.
This means that I can't update my template to use the latest plugin source code with cloth support.

As for updating the whole thing to support SDK 4.1, I don't really see any reasons to do that (would be really time-consuming and pointless).
I'm not even sure that anyone needs all the contributions I'm making lately. grin It feels like throwing everything into the pitch-black pit...
I'm just creating something for myself (projects I have in mind) and sharing it so far. Also learning other engines, so in near future, I might stop using acknex.

Greets!
Posted By: Quad

Re: CCT PhysX 2.0 - 05/31/20 20:13

I meant physx 4.1, but i quickly checked the docs, even though it does not look too bad for 3 -> 4.1, it looks like quite some work for 2.8 -> 3.1.
Still, manageable if you ask me though. Just need time.

Originally Posted by 3run

Anyway, I couldn't compile physX plugin source code (from the download page), so I used the community version which was made by HeelX.
This means that I can't update my template to use the latest plugin source code with cloth support.
Greets!


If that's newer/better or would be nice to have for you, i can compile the source from the download page? (also, is it not the same one that ships with the last version of A8?)
Posted By: 3run

Re: CCT PhysX 2.0 - 05/31/20 20:48

Originally Posted by Quad
Still, manageable if you ask me though. Just need time.
Yes, it's manageable (especially with the help of Migrating From PhysX SDK 2.x to 3.x). To be honest, I find myself thinking about migration to 3.x from time to time... But still, I stop myself, because I don't see any real reasons to invest my time on it, as it's not the only thing that acknex lacks... And the community is pretty much dead too, I don't see users who need a newer version of physx (unfortunately). So I think that I'd better put that time in learning other engines (Godot, unity) since I want to make money in gamedev industry.

Originally Posted by Quad
If that's newer/better or would be nice to have for you, i can compile the source from the download page? (also, is it not the same one that ships with the last version of A8?)
Thank you very much for your offer man. I can't really say that I need the one from the download page, if I understood currently, the only difference is that it has cloth... While the one from HeelX works much better with joints. So I'm pretty good with what I have so far.

Btw, If anyone will need the source code of what I've added so far, I could upload it to github.
But I doubt that anyone will ask for it since community and engine is really dead :<
Posted By: Quad

Re: CCT PhysX 2.0 - 05/31/20 23:15

Originally Posted by 3run

But I doubt that anyone will ask for it since community and engine is really dead :<


Shame really, i just wish oP Group(or whoever owns the engine now) would just release the source code without the parts they can't release. Although it would be nice to have but don't really need lite-c compiler or editor sources.
I do not know for how long but this is the only way to breathe new life to community to make it survive longer imo.

I have like 3 separate editors for a8 that i abandoned for either the same reasons you don't want to create a physx 4.1 wrapper, or some engine limitation being a roadblock, especially renderer and limited resource management aspects makes it hard to do what i want to do. Last thing i remember was that cubemaps were loaded without mipmaps even if the texture was mipmapped, and kludging it from the side is not something i really want to do.
Posted By: 3run

Re: CCT PhysX 2.0 - 05/31/20 23:26

Originally Posted by Quad
Shame really, i just wish oP Group(or whoever owns the engine now) would just release the source code without the parts they can't release. Although it would be nice to have but don't really need lite-c compiler or editor sources.
I think getting rid of lite-c and making it (at least) pure C would be much better. And as for editor source code, I think no one really needs WED, MED, GED, SED crap nowadays... But yet, jcl doesn't really care about the engine's future, I think he just accepted that it's dead and focused on Zorro thing instead... :sad:

Originally Posted by Quad
I have like 3 separate editors for a8 that i abandoned for either the same reasons you don't want to create a physx 4.1 wrapper, or some engine limitation being a roadblock, especially renderer and limited resource management aspects makes it hard to do what i want to do. Last thing i remember was that cubemaps were loaded without mipmaps even if the texture was mipmapped, and kludging it from the side is not something i really want to do.
100% I agree with you... gamedev itself is pretty hard in general, I read/see a lot of successful developers losing their motivation overtime on their projects, cause it's not just fun as it used to be at the start... With acknex, this multiplies with endless "underwater rocks" and this just kills all your hope to get something working properly... It's just an endless suffer and struggle grin
© 2024 lite-C Forums