You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

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

b/PC, Mac & Vintage Computers Started by c4ooo, July 22, 2016, 07:40:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

u/Dream of Omnimaga August 03, 2016, 04:48:13 PM
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.
u/c4ooo August 03, 2016, 06:12:43 PM
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 :)
Last Edit: August 03, 2016, 06:14:46 PM by c4ooo
u/Dream of Omnimaga August 03, 2016, 06:38:34 PM
What I would suggest is maybe add speed throttling l.

Also I lost. :P
u/Snektron August 04, 2016, 11:47:30 AM
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.
u/c4ooo August 04, 2016, 06:00:52 PM
Yea that's exactly what ime doing. "Speed is 1 m/s at 60fps, you will be going 6 m/s at 10fps" ;)
u/Dream of Omnimaga August 04, 2016, 08:25:21 PM
Sometimes it's better to not go overboard with the frame rate. You don't need more than 60 fps normally. :P
u/c4ooo 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.
u/c4ooo August 06, 2016, 11:34:51 AM
Heres a picture of a bed model i made:
Ime still so cing unsure if i would be able to turn this into a good looking game :/
u/ben_g August 07, 2016, 01:39:12 PM
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.
u/Dream of Omnimaga August 07, 2016, 04:26:26 PM
I like the bed. I think shading would be enough for it.
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal