The shoutbox is currently out of service. Join us on Discord instead.

c4's 3D Game Engine [3d][lwjgl][java]

Started by c4ooo, July 22, 2016, 07:40:10 pm

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

DJ Omnimaga

Hm you really need to make collision detection non-dependent on frame rate and performance. Maybe add frame skipping while still calculating positions but just not rendering the frame? Maybe someone else like @ben_g , @TheMachine02 , @tr1p1ea or @catastropher might be able to help, especially that they all worked on calculator-based 3D polygon engines.

c4ooo

August 03, 2016, 06:12:43 pm #31 Last Edit: August 03, 2016, 06:14:46 pm by c4ooo
Well the collision issue is caused becouse everything in the game moves faster as FPS drops. So if your usual speed is 1 m/s at 60fps, you will be going 6 m/s at 10fps. That way objects in the game always move at the same speed regardless of FPS, but this causes inacuracies.
Also, got textures working :)

DJ Omnimaga

What I would suggest is maybe add speed throttling l.

Also I lost. :P

Snektron

You should make the update loop independent of the game loop, so the update loop runs at a constant speed and the render loop can vary. You could also use the time change since the last frame. For example if the last frame was 16 ms ago (a typical time in 60 fps games), and you have an object  that goes 1 m/s then you would add 0.016m.
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


c4ooo

Yea that's exactly what ime doing. "Speed is 1 m/s at 60fps, you will be going 6 m/s at 10fps" ;)

DJ Omnimaga

Sometimes it's better to not go overboard with the frame rate. You don't need more than 60 fps normally. :P

c4ooo

The problem is happening because frame rates are *too low*. The higher the frame rate the more accurate the collision, as object move less per frame if frame rates are higher.

c4ooo

Heres a picture of a bed model i made:
Ime still so f***ing unsure if i would be able to turn this into a good looking game :/

ben_g

Quote from: c4ooo on August 05, 2016, 05:37:31 am
The problem is happening because frame rates are *too low*. The higher the frame rate the more accurate the collision, as object move less per frame if frame rates are higher.

If 60fps is not enough, then you can 'simulate' higher framerates by handling the collision in multiple steps: If an object moves from point A to B, then first handle the collision as if the object moved to the location in the middle between A and B, and then handle it for location B if no collision occurred. You can increase the amount of steps as necessary, and you can even make it depend on the framerate.

If you don't reach 60fps, then you could try to optimize the rendering, since LWJGL should be more than capable of rendering a scene like that at 60fps even on very slow computers. If you don't have a lot of experience with shaders, then also try to find out more about how they work, since they work a bit differently than software that runs on the CPU. For example, branching (if's and loops) can cause a big performance drop in shaders, and it's often better to do extra calculations in order to avoid branching.

DJ Omnimaga

I like the bed. I think shading would be enough for it.

Powered by EzPortal