Gm Bullet in GM

Yal

🐧 *penguin noises*
GMC Elder
You'd probably get help much faster if you tried explaining your problem. Not everyone uses the same engines together, but the code might still be possible to understand.
  • What are you doing right now?
  • What is the expected result?
  • What result DO you get?
 

hippyman

Member
I believe the OP is talking about this DLL created by andbna from the archives: http://gmc.yoyogames.com/index.php?showtopic=379653

And if this is in fact the DLL you are talking about, I have also had issues with the raycasting functions.
I haven't gone back to it in a while but I suppose I could take another look now that somebody else is attempting to use it also.

I really wouldn't mind figuring this out. What all have you tried so far?

Here is my current GMZ file showing what I've tried.

Open up "3D Objects\Player"

Open "Jumping" action in step event

I've left some comments explaining an issue with one of the raycast functions and it shows the other two that I tried.

https://www.dropbox.com/s/fbhwfvfu4qgw5mg/BulletPhysics.gmz?dl=0


WRONG:I did some searching through the source code and I have a feeling that the dll wasn't actually completed. I can't find anything related to raycasting.:WRONG

Also I found out that the arguments for GMBULLET_RaycastTestSingle should be
RigidbodyID,shapeID,x,y,z,xto,yto,zo

I was wrong about not being able to find anything. I found the actual functions you call, inside gmbMiscExports.cpp
 
Last edited:
M

Misty

Guest
The approach I was usin was along the lines of a bucket approach, fanning leads see where they go. Random fruit bowl of ideas so to speak.

Thing is, I got a raycar to work in GM, using Bullet Physics, but it ain't go no traction. Tweaked the paramaters, but no luck... Was looking for a pro to show up, take me by the hand and show me the way.
 

hippyman

Member
Aaah... unfortunately you don't have a pro here. I got stuck on raycasts and all but abandoned it after that since I couldn't figure it out and it was so old already. Feel free to use whatever you find useful in that GMZ.
 
I

icuurd12b42

Guest
If you are ray casting and your wheels dont touch the ground... how would you have traction?

*And Yep, I helped out making GM Bullet. That 💩💩💩💩's ancient
 
M

Misty

Guest
Hmm could you PM me a working raycast car or have you not been able to do that yet either?

My wheels do touch the ground, infact they sink through the ground half of the time (adjusting sus settings doesn't help.)
 

hippyman

Member
*And Yep, I helped out making GM Bullet. That ****'s ancient
@icuurd12b42 Would you possibly be interested in working on a Nvidia Physx extension with me?

If you'd be able to guide me in the right direction I'm more than happy to do the heavy lifting. I could send you a PM to talk more if you're interested.
 
I

icuurd12b42

Guest
@icuurd12b42 Would you possibly be interested in working on a Nvidia Physx extension with me?

If you'd be able to guide me in the right direction I'm more than happy to do the heavy lifting. I could send you a PM to talk more if you're interested.
I can offer some tips, but with studio I think the number of hacks should be way less than what was done in gm bullet in gm 8
 
M

Misty

Guest
Well icuurd, could you also help me with the wheel thing?

As the creator of Bullet physics, have you got the car physics to work in it, and maintain traction?
 

hippyman

Member
I can offer some tips, but with studio I think the number of hacks should be way less than what was done in gm bullet in gm 8
Awesome I'll keep that in mind. We'll worry about hacks when we need to. First I need to get at least a basic understanding of the framework. Give me some study time and then once I'm ready to move to GM I'll send you a message. Thanks buddy :)
 
I

icuurd12b42

Guest
My wheels do touch the ground, infact they sink through the ground half of the time (adjusting sus settings doesn't help.)
If they sink through then they are not colliding with the ground therefore not touching it. therefore the collision map/mask is not set right

As the creator of Bullet physics, have you got the car physics to work in it, and maintain traction?
I did not create it I helped in it restructuring and therefore probably played the most with it.

When you use ray tracing to position the car you are basically making a hover car... you cant use motors to spin wheels to have your car moving.

see if you can convert one of the multitude of example available for bullet physics vehicle. you should get your answers from the bullet physics users
 
M

Misty

Guest
If they sink through then they are not colliding with the ground therefore not touching it. therefore the collision map/mask is not set right



I did not create it I helped in it restructuring and therefore probably played the most with it.

When you use ray tracing to position the car you are basically making a hover car... you cant use motors to spin wheels to have your car moving.

see if you can convert one of the multitude of example available for bullet physics vehicle. you should get your answers from the bullet physics users
The Bullet Physics you helped make is out of date and missing vital functions.
I cant get any help from the bulletforums because it is missing the updated functions and it is also missing the traction function (I forget what it is called exactly, but it was called something like btSetCarTraction a different function than the gripfactor which is bundled with the SusSettings.)

I am not using motors to spin the wheels I am using the RayCar's Engine function to spin the wheels.

I said they sink through sometimes not all the time. When the wheels dont sink through they still have traction and center of gravity problems. I cant increase the weight of the car to increase the traction because if I do it causes the wheel to sink through (and once the weight is past a certain value tweaking the suspension settings doesn't fix anything.)

That is why I would like to see your code that produces a car that has proper grip and movement handling, because I don't think it can be done using the port of Bullet that you helped provide.
 
M

Misty

Guest
Didn't answer my question exactly...are you saying you have never made car physics using the bullet port that you helped make?
 
I

icuurd12b42

Guest
Didn't answer my question exactly...are you saying you have never made car physics using the bullet port that you helped make?
I had a ray cast car yes. but this is like 10 years ago
 
M

Misty

Guest
I had a ray cast car yes. but this is like 10 years ago
Hmm did it behave like a Ferrari (or any other generic sports car model) Or did it have several issues.

And if it did not, is it possible to recreate your code?
 
I

icuurd12b42

Guest
I remember I had to manually add momentum for movement and vary the motion damping according to the angle of the car vesus the angle of motion to simulate the tires not being in line with the direction. really it's pretty much all I remember. there also was no restitution or friction related code in there because at the time there was no way to get data from the object the ray trace collided with.

And that is about the time the guy making the dll vanished...
 
Last edited by a moderator:
M

Misty

Guest
Don't you remember the "The best car physics engine ever made in GM!" thing? Happened around Jam19 if I remember correctly... and I can see several similarities between that member and the specimen we're dealing with here.
Whoever this is, it was definitely me.
I'm sure that there is only 1 person on planet Earth who has an interest in car physics, and in fact that person is me.
 

hippyman

Member
@Misty I think the main thing you should be getting from all of this is that this extension is incomplete and extremely outdated so you should probably drop trying to use this. The source code is available so if you know you're way around that stuff, you could try to update it or use it as a reference for a new extension made with the most recent bullet release.

But constantly asking questions and dodging the fact that the extension is basically no good anymore won't get anything accomplished. I'm sorry if this seems harsh, I'm not trying to be. I just want to get this point across.
 
M

Misty

Guest
@Misty I think the main thing you should be getting from all of this is that this extension is incomplete and extremely outdated so you should probably drop trying to use this. The source code is available so if you know you're way around that stuff, you could try to update it or use it as a reference for a new extension made with the most recent bullet release.

But constantly asking questions and dodging the fact that the extension is basically no good anymore won't get anything accomplished. I'm sorry if this seems harsh, I'm not trying to be. I just want to get this point across.
Alright, fair enough. What extension should I use for this then?
 
M

Misty

Guest
As far as a full blown physics engine goes, there really isn't anything at the moment.

A lot of people use P3DC when they first get started since it's pretty simple to use.

Also if you're willing to cough up the dough, there's a pretty extensive 3D asset on the marketplace
https://marketplace.yoyogames.com/assets/1088/slayers-upgrade

Those are the two I know of. Otherwise you would have to roll your own.
No I mean for car physics.

In my opinion, Bullet GM is actually superior to P3DC for Fps collisions. I haven't tried it yet though, so I might be mistaken.
 

hippyman

Member
This specific extension, Bullet GM, is not superior to anything, because as others and I have said, it is outdated and incomplete.

P3DC isn't even a physics library nor is the asset I linked. They are simply 3D extensions that aid in 3D development.

There are zero 3D car physics out of the box things already made. You have to make that yourself. I don't know how to be any clearer.
 

slojanko

Member
Hey,

If you're interested in 3D raycasting with physics support then I can share a project which uses GmNewton. Even though the physics are relatively slow compared to modern engines you can still get good results on a "GM" level!
Link
I didn't write the GmNewton wrapper. I was only making a sandbox game and realized this was too slow so you can study it if you want. The project had a couple of things to offer at the point where I stopped working on it:
- spawn blocks with keys: 1, 2
- clicking mouse buttons close to an object causes an explosion OR "picks up" the object (like in Amnesia)
 

Roa

Member
There was actually a couple of 3d collision DLLs, and I think there might be one left for physics. Nothing specifically for "car physics".

I personal use P3dC, its pretty basic and fast to learn, but some of the functions are completely busted like returning the normals of a collided triangle. Its also slower than another one I've seen around here. Check the recent topics in the archived forums under 3d programming. Its bound to show up in the first 3-4 pages. You could fake physics ontop of one of these DLLS.

I don't recommend slayer64's extension unless you are targeting non-windows platforms. Lots of good stuff in there, but its considerably clunkier to work around. Plus its not as fast as a DLL, at least, that used to be the case.
 
M

Misty

Guest
That's what I'm saying. The bullet physics would be faster than PC3D most likely if you just wanted to use it's collision functions to make an fps engine with.

So, bullet = probably good for fpses, and fps, questionable for car physics

I think Bullet is faster than Newton but I would like to hear slojanko's opinion on this.
 

slojanko

Member
Misty,
if you want to hear my honest opinion on this, I will tell you to use Unity any day as it has capabilities that go above GMS 3.0. Since you're interested in a "car" with physics I don't have a problem with showing you this:
Unity has support for vehicles which only requires you to model the parts of a car and attach the correct components to them for it to work. You have control over everything: torque, speed, friction...

But if you're going to stick with GM:S then I'll tell you something about physics in general: they're slow! They get even worse when you have multiple collisions between objects. I've done some testing with GmNewton and can guarantee it won't freeze if you have a small number of colliding objects but as soon as these numbers go into a few 100s you'll instantly freeze the game and won't get it to run anymore. To put in other words, 100 physically active objects with no collisions between each other will almost certainly run faster than 10 objects stacked on each other.
The main reason this happens is that physics engines have a state in which no calculations are performed. This is achieved by having a limit to which decimal value physics are calculated (the longer the decimal value is the slower the physics are). When an object is "influenced" to a point where the values become less than the engine has set to calculate, it goes inactive. If you have a couple of objects touching, you'll get something like the Newton's cradle effect in which it takes a very long time to stop.

It's also a pain setting up the collisions themselves if you have custom models as you need a .obj to .d3d converter because GmNewton only works with .d3d models. One other limitation is that the same model used for drawing can't be used for the physics. I believe the normals of a model have to be inverted on the collision model. Overall it's really annoying setting it up as you have no guidance when using GmNewton except some videos on youtube (not more than 5 I think).

Just so I don't criticize only, here's a short video you can watch on something that was made using GmNewton: YouTube video

Personally I haven't used Bullet physics and can not say anything about it but looking at what hippyman posted I'd say it has some power under the hood (I only checked the 3D platformer which doesn't do any intensive 3D calculations).
 
Last edited:
M

Misty

Guest
I am sorry to hear that about GMNetwon.

It seems this ancient Bullet port is a bit underrated. Now I can't say exactly if all of these objects were "active", but I can say this, I had 300 spheres in Bullet Physics with 300 fps. People get the false impression that Bullet Physics is laggy and no good, because of d3d_shapes being drawn. I turned off the shapes and viola, 300 fps. This was with old game maker, I wasn't even using Studio.

Now I haven't tested it's performance with large world meshes, but I suspect that a large world mesh with 8 player objects would be no problem for it. Car physics may be on the table, but fps physics with bullet seems like a valid idea.
 

hippyman

Member
How are you not understanding what I'm saying?!

Bullet physics is an excellent framework.

The current extension that you are using that allows you to use it in gamemaker IS NOT.

There are no impressions that the Bullet physics framework is no good and laggy (no idea who said that one). The extension that you are using is no good. Not the Bullet physics library. Please understand what I am saying, this is driving me crazy.

If you want to use Bullet physics in Gamemaker then you need to make a new extension that allows this. I'm done with this topic, because you're not even asking questions now. You're just saying "bullet physics is good, bullet physics is good" and it is going absolutely nowhere.
 
M

Misty

Guest
How can I not understand what you are saying? You keep repeating it over and over again.

You keep telling me not to use this port of bullet physics because it's useless rubbish.
And I am saying I doubt that it's useless rubbish and I have a sneaking suspicion it's useful.

Also Im not using the extension, the dll version for gm has more functions.
 

slojanko

Member
Misty,
what probably happens - which all good physics engines do - is this:

Green spheres are inactive objects while red are still in some sort of motion. You can also see how one sphere bumping into another can set of a chain reaction and really hit the performance if you go into a large scale simulation.

Also seeing your previous reply, both GmNewton and Bullet physics are both extremely old versions of popular engines. They're probably from around 2009 which is what makes it run so slow compared to their updated versions. But since this is the ONLY option GM:S has for 3D physics, unless you wanna make your own, it's a good option.
 
M

Misty

Guest
Im talking 1 world mesh (about 10000) polys, 10 spheres and 10 cubes.

Also, If I recall I think the spheres were mostly in red mode when I did the 300 fps test. But I'd have to double check and rerun the sim and get back to you.

Moderator edit: Posts merged. Please don't make back-to-back posts.

EDIT: Ok I will. Just was an idea that popped in my mind, saw slojanko do a double post right above me, figured it be easier just to follow his lead.
 
Last edited:

hippyman

Member
This topic is such a mess now. The start of this was you were asking about raycasting. Then it was car physics. Then you started going on about first person shooters and now you're just talking a world mesh and some cubes.
Can I ask what the goal of this topic even is? What do you need to accomplish?

If it is one of the following:

Raycasting
It does not work properly as far as I know and I've done some fairly extensive testing.

Car Physics
I've done no testing with the car stuff in the extension but you said you've had some issues yourself probably from incomplete features in the extension or errors or a million other things

First Person Shooter
P3DC is an excellent choice for a starter project and it has plenty of examples to get you going


If it's something else please ask what you need to ask.



I'm sorry if I'm seeming rude right now. It's just irritating when several people have offered advice and helped where they could but you just want to argue back to everything that others say.
 
M

Misty

Guest
Raycasting
It does not work properly as far as I know and I've done some fairly extensive testing.
Send me the gm6 and I may be able to fix it for you.

Tried pc3d it was laggy for me.
 
M

Misty

Guest
I don't see how anyone's arguing. I offered you a helping hand to fix your project for you. If I can fix it I can fix it, if I can't I can't. No brag just facts.

Sorry to repeat myself but I'm done here. Unfollowed the thread as the OP refuses to accept any help or advice.
You're the one refusing to accept help not me.

Your advice was, that this port of bullet physics sucks and I should use pc3d. I said pc3d was laggy, you didn't care, so you ignored my advice.

EDIT: Also, I just noticed that you did post your code from earlier, so my apologies for that.
 
Last edited:
M

Misty

Guest
Raycasting
It does not work properly as far as I know and I've done some fairly extensive testing.

"But constantly asking questions and dodging the fact that the extension is basically no good"

"...you should probably drop trying to use this."
I don't see what the problem is.

Ray Tracing works just fine for me. I checked out your gmx and your code looks iffy.

When it RayTestAllHit collides with a ball, it returns 1. When it doesn't collide with a ball, it returns zero. Convex Swept Ellipsoids seems bugged at the moment as it crashes the game whenever it is used. But it is not needed for fps games, the player object should be a physics object sphere anyway, not a convex swept ellipsoid test and the values aren't needed.

So Houston we are cleared for Take Off...we are on the tarmac, Tower Control we are ready, Bullet Physics's throttle is engaged and fueled, ready to deploy for your latest FPS (First Person Shooter games).

Also I asked a mod and he said it was ok to double post.
 
I

icuurd12b42

Guest
Some memory notes about the difference between GM Bullets and all the others.

Bullet support Islanding, where items close together form groups for collision checks reducing the number of collsion check per simulation steps
Bullet supports deactivation for non moving/colliding objects
Both these are now common in the 2d/3d physics realm.

Why was GM bullet far superior than the other GM implements at the time? This is my work in the project
We batched the API calls in ds list instructions. Reducing the number of call to 1 api call per frame, passing a list of instructions) as opposed to 8 api call per objects per frame whereas gm was limited to about 400 api call per frame before things started to falter. Even the resulting position was also converted to a return set of instructions for GM object instance... the list usage is by choice. you can still call the 8 api calls for each instances if you want...

If the OP is still using gm6 through 8.0 this dll is the best solution and there is no better alternative (bugs notwithstanding).

But you cant expect much help, even from the guys who worked with it... this is like 10 years old and in PC programming time it's like trying to remember your childhood when you were 2yo
 
M

Misty

Guest
If the OP is still using gm6 through 8.0 this dll is the best solution and there is no better alternative (bugs notwithstanding).
I'm usin Gm6, Gm7, Gm8, Gm studio, Gm1, al the GMs except GM 2 3 4 and 5. What solution is better?
 
I

icuurd12b42

Guest
I think the last version that supported the version of gmapi we used was 8... or 7.1. Which ever that supports the list system without blowing up
 

hippyman

Member
I'm not sure what's iffy about my code. From what I read in the documentation I was using everything correctly.

I tried single hit, all hit, convex sweeps, etc. If it had Raycast in the name, I tried it, several different ways (meaning i tried in x,y,z like the documentation states, and I also tried y,z,x like the forum posts says, as well as testing if the z coordinate was reversed in GM Bullet vs GM's built-in coordinate system) and never got any results from the functions. I'd love to see an example of the raycasting working properly. Perhaps I just don't understand how raycasting works although I'm pretty sure I have a basic idea on what it is.

Could you post a gmk or gmz with your example of raycasting working?

I should also mention that I strictly use Studio. Not sure if it matters.
 
M

Misty

Guest
I'm not sure what's iffy about my code. From what I read in the documentation I was using everything correctly..
You said yourself that the documentation is incorrect.

However, the documentation does tell you what value the Cmask variable has to be, either 29 or 31.
Your code seemed to have excessive parenting, but from what I could tell you used an enum{} other than the direct real() 29 or 31 for your cmask. I'm not too familiar with enums in game maker but, from what I can tell, it links to some cloudy constant in the gmx.
 

hippyman

Member
I'm not too familiar with enums in game maker but, from what I can tell, it links to some cloudy constant in the gmx.
The GM documentation explains it pretty clearly and better than I can.

"The enum entries can only be real numbers or expressions with previous enums, and by default are numbered from 0 upwards, so our example given above would default to red = 0, orange = 1, yellow = 2, etc."

https://docs.yoyogames.com/source/dadiospice/002_reference/001_gml language overview/data types.html

I'm not sure why you would assume it's a cloudy constant. I'm not even sure what you mean by that.

In this case I created three collision groups and a nothing group.
Code:
enum CGROUP {
    NOTHING, // 0
    STATIC,     // 1
    DYNAMIC, // 2
    KINEMATIC// 3
}
You then OR these together to create your collision mask. It doesn't say you have to have 29 or 31 for the collision mask. It says those are the default values that Bullet sets.

If raycasting works just fine for you, then please post your project.
 
Top