GameMaker: Studio

GameMaker: Studio

View Stats:
Question about 'room speed' and 'step event' and 'delta_time'
I am making a gun ballistics simulator and one of the major requirements is that the bullet calculates it's position MANY times every second. Everything else doesn't matter that much. Basically, there is a gun object that point towards the mouse cursor and then you just point and click. There is also recoil with spread as well. My goal mostly is to have the bullet's physics calculated 480 times per second, where everything else is claculated 60 times per second.

I don't want to set the room speed to 480 becuase i've done that before and it's a disaster. If you use delta time it's going to tell me the time it takes to get from frame to frame and if the room speed is 60 and the delay between each frame will obviously be bigger then then deley between 2 frames at 480 times per second.

I don't know if I explained it that clearly but I know that what I want is pretty clear. Thanks for any suggestions.
< >
Showing 1-9 of 9 comments
Blind Jun 6, 2015 @ 1:38pm 
If you are doing a realistic simulation then the room speed doesn't really matter as you shouldn't aggregate position based on per step actions or even in real time, but rather based on the correct physics calculation in seconds (t/rs). ... such as Vf^2 = Vi^2 + 2 * a * (y-y0)

While your UI is running at a 60 roomspeed (or less even, it doesn't matter) your physics object will be correctly calculated at all time frames. You can even add the correct physics for rifling, stippling and spalling. When there is an estimated collision, you can again use the correct physics calculation to find the time index the collision happens and apply a force at that point, even if a step never happened.
Neko_Baron Jun 6, 2015 @ 1:46pm 
whats the point of only bullets being calculated at 480 and all other physics at 60?

If you really want to just code in the bullet movement in a step event and loop though it 8 times, so they are calculated 8*60 times a second
Originally posted by BBX:
If you are doing a realistic simulation then the room speed doesn't really matter as you shouldn't aggregate position based on per step actions or even in real time, but rather based on the correct physics calculation in seconds (t/rs). ... such as Vf^2 = Vi^2 + 2 * a * (y-y0)

While your UI is running at a 60 roomspeed (or less even, it doesn't matter) your physics object will be correctly calculated at all time frames. You can even add the correct physics for rifling, stippling and spalling. When there is an estimated collision, you can again use the correct physics calculation to find the time index the collision happens and apply a force at that point, even if a step never happened.

Ok so, will that make it so that the bullets physics is calculated often?? I don't exactly understand what you are saying. If the step event is based on the room speed then how would I make the bullet's physics calculate more often than 60 times per second if the room speed is 60. You probably already explained that I just don't understand that well.
Blind Jun 6, 2015 @ 7:59pm 
It's like a magic trick, what the user sees and what is actually happening don't have to be the same. You can derive the position of the bullet with legitimate actual real world physics without a need to update the game room itself...

I think I know what you mean, but. if the physics is calculated inside the step event and then step event repeats based on the room speed, then the game room updates every time the step event occurs. What I am trying to do here is make it so the distance between the bullet's last position and it's new position, because the bullet's position is being calcualted hundreds of times per second. Where as everything else is being refreshed less often to avoid lag. I'm thinking that I might set the room speed to somthing like 480, and make everything based off of delta_time so that only certain things repeat exactly 60 times in a second, but wait... waht about draw events??? Don't they also run every room update? So would I have to use a User event to put my "draw_xxxxxxxxxxx" command into or will that not work?? Becuase refreshing a draw event 480 times a second I know in fact will lag
and what does this equation do anyway?
Vf^2 = Vi^2 + 2 * a * (y-y0)

What are the variables?
Last edited by Andrew900460 .;UbErZ;.; Jun 6, 2015 @ 8:17pm
Blind Jun 6, 2015 @ 8:21pm 
Grade 6 physics. Velocity Final, Velocity Initial and so on
If were thinking of the same physics class, i took it in 8th grade. And I don't think we learned about this. And what is a and y? and why is there a zero next to the y? doesn't that make it zero anyway??? But this is besides the point...

I don't think i need this equation to help with this problem. I'm using the speed and gravity variables.
Blind Jun 6, 2015 @ 10:15pm 
If you don't need ultra realism, just use the built in Box2D physics since it simulates as I stated... it performs time/velocity/mass calculations mid-step independant of the room speed
< >
Showing 1-9 of 9 comments
Per page: 1530 50

Date Posted: Jun 6, 2015 @ 1:20pm
Posts: 9