Product Chat / GameGuru Convex Hull Added.

Author
Message
Preben
15
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 5th Aug 2019 10:13 Edited at: 5th Aug 2019 10:21
Bad English video, my mind was in another place , sorry



Added Convex Hull collision shapes to GameGuru.
In your .fpe use: "collisionmode = 9" To use a convex hull shape for collision.

This is way faster for the physics engine to process so its perfect for objects where you dont need a perfect collision mesh but still need collision. Like if you have 100 rocks on your level changing the rock to use convex hull will really speed up the physics engine.

BUG FIX: If you have fps drops due to collision on your level, you can use convex hull on the models to remove the fps drop.

GitHub:
https://github.com/TheGameCreators/GameGuruRepo/pull/584/commits/6229dea0742ce115df5d9f4511bd850bdb1108eb
Subscribe and checkout great GameGuru/AGK video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,
granada
GameGuru TGC Backer
17
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 5th Aug 2019 11:23
Fantastic addition Preben, thank you .should speed up a lot of people’s levels

Dave
Windows 10 Pro 64 bit
GeForce RTX™ 2070 GAMING OC 8G
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
3840 x 2160 ,60 Hz
PM
Tarkus1971
Reviewed GameGuru on Steam
4
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 5th Aug 2019 11:55
Nice work Preben, thank you. Will try this when I get the chance.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth, Roland D05 Synth Module, Bluedio Victory V Headphones, AKG K141 Studio Headphones, Lenovo Ideapad, with Windows 10 64bit, 8Gb Ram and AMD A10 7th Gen Graphics. Acer Swift i3 Laptop with Intel Optane memory, Intel 620UHD GPU, Windows 10 64bit.
OldFlak
GameGuru TGC Backer
4
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 5th Aug 2019 12:02
Awesome Preben

Reliquia....
aka OldFlak
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
3com
5
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 5th Aug 2019 12:10
Quote: "BUG FIX: If you have fps drops due to collision on your level, you can use convex hull on the models to remove the fps drop."

Great Preben!
thank you mate.

Wonder if collision has something to do with soldiers shooting thru the walls?
Player takes convex hull, box, cyl as collision shape, but does the soldiers does the same?
In another words does the soldier takes a wall with let's say box as collision shape, as an object with collision than should avoid.
It is not natural soldier shooting/walking trhu the walls.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
synchromesh
Forum Support
5
Years of Service
Recently Online
Joined: 24th Jan 2014
Location:
Posted: 5th Aug 2019 12:16
Fantastic stuff and a welcome addition for optimisation ..
Thanks Preben ..
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
smallg
Community Leader
14
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Aug 2019 14:46
nice job!
do you know if there is a limit to the number of points? i.e. if you combined a bunch of objects into 1 mesh how well would it be able to handle that?
also just curious - why does the chair make a ramp shape but the fence and altar don't when the only real difference is the rotation of the object? (if you lay the chair on its side it would technically be the same as the fence) - not that it matters, convex is a great addition, i'm just wondering if you know the reason behind it? i'm assuming it's because the logic works/calculates from top - down?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
granada
GameGuru TGC Backer
17
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 5th Aug 2019 15:46
@smallg I think the fence is two separate models

Dave
Windows 10 Pro 64 bit
GeForce RTX™ 2070 GAMING OC 8G
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
3840 x 2160 ,60 Hz
PM
cybernescence
GameGuru Master
6
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 5th Aug 2019 16:52
Thanks Preben. I have just the level to test this on. Will report back outcome

Cheers.
GraPhiX
Forum Support
14
Years of Service
User Offline
Joined: 15th Feb 2005
Playing: Fixing stuff ;)
Posted: 5th Aug 2019 17:21
Quote: "nice job!
do you know if there is a limit to the number of points? i.e. if you combined a bunch of objects into 1 mesh how well would it be able to handle that?
also just curious - why does the chair make a ramp shape but the fence and altar don't when the only real difference is the rotation of the object? (if you lay the chair on its side it would technically be the same as the fence) - not that it matters, convex is a great addition, i'm just wondering if you know the reason behind it? i'm assuming it's because the logic works/calculates from top - down?"


Dave is right the model does not look as bad as it does in the video, it is 2 pieces placed together but not lined up correctly

also I don't think there was a FPS drop at the chair so the chair does not really need 9 I think 1 would suffice

@Preben thank you so much for the Convex settings I have just added it to FPE Creator
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Laptop - Helios 300 Predator - i7 7700HQ - 32GB - Nvidia GTX1060 6GB - 525GB M2 - 500 SSD - 17.3" IPS LED Panel - Windows 10 Pro x64
Various Tutorials by me
AmenMoses
GameGuru Master
3
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Aug 2019 17:25
If the object is box shaped use box collision ( collision mode=0 ), if it is spherical or cylindrical then use those collision shapes ( 2 & 3 ) all of these are way faster than convex hull! (for cylindrical shapes the models Y axis must be the centre, i.e. like the barrels)

GG does have the facility to have objects built up from multiple physics shapes but I'm not sure how well that is implemented, so for example 'L' shaped objects could use two box collision shapes. (I think this is only implemented for static entities, extending this for use with dynamic entities would be a huge improvement!)






Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
14
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Aug 2019 20:57
Quote: "@smallg I think the fence is two separate models

Dave"

probably, i was thinking preben had welded the models to showcase the convex calculations... otherwise a box collision shape would be just as effective)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
synchromesh
Forum Support
5
Years of Service
Recently Online
Joined: 24th Jan 2014
Location:
Posted: 6th Aug 2019 01:35
Have to be careful with AI im guessing or you could have them unexpectedly running up ramps ... although …. Run and jumping a chair could look cool
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
Pirate Myke
Forum Support
9
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 6th Aug 2019 03:51
Outstanding. Thank you.
RIP
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

New:
Intel(R) Core(TM) i5-8400 CPU @ 2.81GHz, 12GB RAM, Nvidia gtx1050ti 4gb, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3774




Preben
15
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 6th Aug 2019 09:21 Edited at: 6th Aug 2019 09:53
If your able to use box/cylinder/sphere collision you should it is faster , convex hull is faster then using the mesh for collision (or polygon collision) , so it should be used on objects that dont fit any of the predefined shapes, but where you still need some precision in the collision.

Here are some objects that would fit perfect for convex hull:



smallg: the limit is 100 points , i kind of tried to explain how the shape would be but ...
Put your model inside a bag and suck out all the air, and the bag will now kind of be your convex shape (simple explained) , thats also why the chair got that shape (with a ramp).

3com: "Wonder if collision has something to do with soldiers shooting thru the walls?" , dont think its the collision shapes , its properly the ray that are cast from the AI to the player that are inside the collision shape when cast, but thats another problem
Subscribe and checkout great GameGuru/AGK video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,

Attachments

Login to view attachments
3com
5
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 6th Aug 2019 12:43
@ Preben
Thanks for the explanation.
So another question:
If I've let's say a wall broken into several fragments after animation (physics, gravity and so on), does each fragment has collision?
or it lose the collision shape when the wall break into several chunks?
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
cybernescence
GameGuru Master
6
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 6th Aug 2019 14:34
@Preben did you try convex with terrain collision? I saw some comments in the code about this - wasn’t sure if you were inviting people to test this (with some code tweaks) or you had already done so?

Cheers.
Mr Love
14
Years of Service
User Offline
Joined: 9th Jun 2005
Location: Sweden
Posted: 6th Aug 2019 19:06
I didnt belive the physics slowed down the engine when the physics isnt really used? Good job anyway! One problem in the engine that I think is serious is that AI characters never follows the player if the player jump up on a box or a carhood, etc. There shourld be a commando something like "FollowPlrOnEntity" even if its high to climb for the AI, how bout a climb animation?(If it isnt already there)...
Guess what Aiko and I did this weekend...
smallg
Community Leader
14
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Aug 2019 22:18
Quote: "I didnt belive the physics slowed down the engine when the physics isnt really used? Good job anyway! One problem in the engine that I think is serious is that AI characters never follows the player if the player jump up on a box or a carhood, etc. There shourld be a commando something like "FollowPlrOnEntity" even if its high to climb for the AI, how bout a climb animation?(If it isnt already there)..."

that's not really how the A* pathing works in GG because we only get 1 walkable plane by default - the terrain, it won't take into account navigating on objects unless you specify they are ok for it.
you would need to mark the objects as walkable - i.e. floor zones (or forcesimpleobstacle = 3 if it still works) and make sure there's a way for the AI to get up to that height - i.e. stairs or ramp or resetting the AI position after an animation (like a jump).
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Mr Love
14
Years of Service
User Offline
Joined: 9th Jun 2005
Location: Sweden
Posted: 7th Aug 2019 07:12
"and make sure there's a way for the AI to get up to that height"

Yeah, but thats a part of the problem, if You put a ramp in front of a carhood (For example) then the player get collision problems. Would be better if You courld just mark the entity as "AiCanClimb"...
Guess what Aiko and I did this weekend...
Preben
15
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 7th Aug 2019 09:25
3com: animated objects is handled different.
cybernescence: Yes did test it on the terrain and its not really useful
Subscribe and checkout great GameGuru/AGK video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,
DVader
15
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 7th Aug 2019 16:41
Cool. Could have done with that years ago Had several problems over the years where you can't have collision in a cylindrical lift for example.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
3com
5
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 8th Aug 2019 01:09
Quote: "animated objects is handled different."

Thanks Preben.

I believe that an entity always remains the same, and always in the same position, even if it is an animated entity.
I believe that the animation is executed and the object moves a few meters but in reality the object is still in the same initial position, without experiencing any change, the object that we are seeing a few meters beyond, really does not exist, is an instance of the model original, if this is so, the fragments of the object do not really exist and therefore cannot have collision, the collision of the object is still in the original object, and I am not talking about characters, only objects.
Perhaps we could know through the X file, how many chunks the object will be divided into, convert these chunks into static and assign them collision convex hull; although this may be a very crazy idea.
Or I may be totally wrong.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GubbyBlips
User Offline
Joined: 14th Jan 2019
Location:
Posted: 10th Aug 2019 18:59
This sounds great Preben. So... this will work or not for dynamic entities?
When will this likely be available?

Anyhow, I'm going to give it a go ASAP because dynamic entities hate to represent
their true shape selves-- not really sure why, but my guess is that it has again to do
with trying to make cheap work of the low memory capabilities of 32 bit GG and
subsequent frame rates? Well, if this actually does represent "true clipping" on
moving, dynamic entities--- we have just made "one giant leap" for GG kind.
PM
AmenMoses
GameGuru Master
3
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Aug 2019 19:41
Not really anything to do with memory capabilities, it's more to do with number crunching.

The Bullet physics engine can handle any collision shape but the simpler the shape the better the performance, the simplest shape is a box, calculating collisions between boxes is mathematically pretty simple which is why you so often see demos with thousands of boxes to show off a BE implementation.

Spheres are also mathematically pretty simple, cylinders are slightly more complex as are cones.

Arbitrary mesh shapes are very complex and computationally very expensive so where possible the best approach is to break down a complex model into simpler shapes, GG can do this but IIRC it isn't implemented for dynamic entities.

Convex hulls are a compromise whereby a closest fit approach is used to reduce a complex mesh into a simpler less computationally expensive shape, in a lot of cases the resulting shape will match the visible shape well enough for most purposes.

For dynamic entities GG currently only allows box, sphere and cylinder collision shapes. If I read the OP correctly Preben has added another option, i.e. convex hulls.

Cone shape could also be added relatively simply and with a bit more work I reckon that multiple physics shapes could be added for dynamic entities. But arbitrary mesh collision for dynamic entities are never going to be a good idea!

When I first started playing around with GG there was a way of making a dynamic entity have mesh collision and in my first stab at the moonlander demo I did used the lunar lander model with mesh collision (and nothing else on the level!), I got single figure FPS when moving it around dynamically!

The simplest answer is to choose dynamic entities for your game very carefully to make sure they fit one of the simpler collision shapes.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
3
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Aug 2019 20:10
@Preben :

Looking at the changes you have made it appears that the Convex Hull shape can only be used for static entities, are you planning on changing M-Physics::physics_setupobject routine to allow use for dynamic entities as well?

Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2019-12-13 15:22:40
Your offset time is: 2019-12-13 15:22:40