Post AV5Yod6qg2gcrYL6My by dioma@kiwifarms.cc
(DIR) More posts by dioma@kiwifarms.cc
(DIR) Post #AV4PWQz3vZYVIWzDHM by crunklord420@kiwifarms.cc
2023-04-27T07:22:09.006716Z
0 likes, 0 repeats
I'm reading about 3D collision detection. I don't know if I really want to implement a physics engine myself, even a simple one. I dunno. I'm looking at possible options, ODE seems like an option but it really would involve me figure out how to integrate in a non-soydevy way. Bullet3 seems like it's too C++. I'd rather them not do allocations on their own. There's also reactphysics3d.I haven't found a good lightweight library though, that's what I really want.
(DIR) Post #AV4QmCnmWVgDtunI9o by FF777@kiwifarms.cc
2023-04-27T07:36:46.080788Z
1 likes, 0 repeats
@crunklord420 do you do all of this low-level programming to challenge your self?..you seem intelligent to be able to do (and enjoy) all of this low-level work...... maybe i was reading some of your stuff during the downtime, including watching that mike acton video..this is going to seem completely sacrilegious to you since you like low-level stuff and so probably don't like the idea of high-level stuff?... but i've wondered before: if you can do all of this stuff with just low-level tools, what kind of complex things could you make if you used a high-level game engine like godot or some thing?.. then you wouldn't have to reinvent every thing and could focus on making some epic game instead of having to do all of the boilerplate stuff your self.. (i mean when you aren't making a game for templeOS, since some thing like godot doesn't support that at all)..
(DIR) Post #AV4RxpHhszSyONtdRY by crunklord420@kiwifarms.cc
2023-04-27T07:49:17.123268Z
3 likes, 0 repeats
@FF777 ITS FUN LMAO. Terry said it himself. He also said people sometimes obsess about how big they can make something, instead of how small they can make something.
(DIR) Post #AV4T1D7bogCl92LoXY by i@declin.eu
2023-04-27T08:01:54.235973Z
0 likes, 0 repeats
@crunklord420 https://github.com/gszauer/GamePhysicsCookBook is a pretty good intro that's end up with a workable but basic rigid body physics engine without too much codehttp://ndl.ethernet.edu.et/bitstream/123456789/24446/1/Gabor%20Szauer_2017.pdf
(DIR) Post #AV4Y3KF8oFFta7hZNA by dioma@kiwifarms.cc
2023-04-27T08:58:18.901747Z
0 likes, 0 repeats
@crunklord420 I don't know of any lightweight 3d physics engine, only 2d ones. What do you need physics for? Preventing the player from walking through walls? That's easy enough to implement as long as you stick to only a few basic collisions shapes (aabb, sphere). The hard part is simulating real physics objects with rotations and constrains, but you probably don't need that.Maybe there is a library that only implements the seperation of axis algorithm.
(DIR) Post #AV5Wh12nbYuyrzgeAK by crunklord420@kiwifarms.cc
2023-04-27T20:17:10.663568Z
0 likes, 0 repeats
@dioma you're mostly right. The main concern is I want to prevent tunneling. So maybe I need to implement a moving sphere-tri or moving sphere-obb check but I can't find good examples of this. Alternatively maybe I just do a hacky check where I do a ray check to see if the center has tunneled through something.
(DIR) Post #AV5Wkqt7J6aYWszH7I by Trollcow@sneed.social
2023-04-27T20:18:29.067005Z
0 likes, 0 repeats
You’re surprisingly decent at programming.
(DIR) Post #AV5WlcCDPunBFjHguW by Trollcow@sneed.social
2023-04-27T20:18:37.549299Z
0 likes, 0 repeats
I’ve read your GitHub
(DIR) Post #AV5WuY7lvOPnENSxto by crunklord420@kiwifarms.cc
2023-04-27T20:19:29.095474Z
0 likes, 0 repeats
@dioma I really like how he didn't include sample code unlike most things for the one thing I actually need. I don't know how to read, only copy and paste.
(DIR) Post #AV5X9sQki24SYLeXNQ by thendrix@social.hendrixgames.com
2023-04-27T20:22:58.872944Z
1 likes, 0 repeats
If you want simple you can hand roll a Verlet integration system pretty easy. That’s what I did for one of the fps engines I made. There is also Jolt if you want a literal AAA game physics engine that’s open source. That’s for multicore and heavy streaming use. :)
(DIR) Post #AV5XM8BnwZh0u4VKam by crunklord420@kiwifarms.cc
2023-04-27T20:24:07.023047Z
1 likes, 0 repeats
@thendrix @dioma oh great more math words I have to learn lmao
(DIR) Post #AV5Xa1XtRRx8LuSd3g by RustyCrab@sleepy.cafe
2023-04-27T20:27:42.236930Z
1 likes, 0 repeats
@i @crunklord420 the issue with physics engines is they tend to be extremely unpredictable due to numerical rounding, and for game objects participating in game logic you almost never want realistic physics unless that's part of the gimmick. At the end of the day, usually the only feasible option is to do custom "fake" physics for game objects and "real" engine physics for making things pretty (if you have them at all)
(DIR) Post #AV5Xq0M7dKN7INZinQ by dioma@kiwifarms.cc
2023-04-27T20:30:35.237990Z
0 likes, 0 repeats
@crunklord420 dunno how big your physics time steps will be, but on normal engines with normal movement speed it's usually not a problem.You could also divide the movement into smaller steps and do multiple colission checks on the path.Eh, I don't know too much about custom colission code. I've only implemented one for a voxel engine and that is pretty trivial.
(DIR) Post #AV5YDoxNfNBktMMJn6 by crunklord420@kiwifarms.cc
2023-04-27T20:34:19.359790Z
0 likes, 0 repeats
@dioma well at a certain point the frame delta will become limited if a major hiccup happens. Right now a frame delay maxes at 1 second but it's arbitrary. Perhaps I could run game updates on a tick system and include physics with that.
(DIR) Post #AV5YYfTe6egJZZOKSO by dioma@kiwifarms.cc
2023-04-27T20:38:40.767534Z
0 likes, 0 repeats
@crunklord420 have you heard of gjk/epa?Doesn't solve the tunneling issue, but it's a robust algorithm to resolving colission between all kinds of primitives. (every shape that you can write a closest point to algorithm)I've implemented those for my own engine based on these articles before doing something simpler for the voxel engine. The code is all there. Worth checking out. https://blog.winter.dev/2020/gjk-algorithm/https://blog.winter.dev/2020/epa-algorithm/
(DIR) Post #AV5YinIhsD4sjV6Sau by crunklord420@kiwifarms.cc
2023-04-27T20:40:04.642182Z
0 likes, 0 repeats
@dioma yeah, I could potentially use libccd and it's a GJK implementation. But that doesn't solve my main issue of tunneling. I'm honestly fine with OBB/Sphere collisions, I don't need actual mesh collisions.
(DIR) Post #AV5Yod6qg2gcrYL6My by dioma@kiwifarms.cc
2023-04-27T20:41:32.139731Z
0 likes, 0 repeats
@crunklord420 you should. Decoupling framerate from game updates is always a good idea. Your physics engine needs to run at constant simulation ticks. The whole math breaks down if the delta time between ticks changes too widly.
(DIR) Post #AV5ZPNYbSmR3LIqQtc by RustyCrab@sleepy.cafe
2023-04-27T20:48:11.496183Z
0 likes, 0 repeats
@dioma @crunklord420 oh yeah absolutely never tie updates to graphical framerates or you will literally metaphorically die
(DIR) Post #AV5ZUu9dh7GrtCnq6a by dioma@kiwifarms.cc
2023-04-27T20:49:13.004467Z
1 likes, 0 repeats
@crunklord420 gjk/epa can be used for any shapes. It's just a neat algorithm that gives you:- collision check- shortest vector to resolve penetrationYou need that latter one to actually know how to resolve the collision. It's not enough to know if two objects overlap. You also need to know how to best resolve that overlapping. (okay for spheres only that is trivial. But spheres and boxes?) Gjk/epa does that.
(DIR) Post #AV5aEMGq0RR47ZqNYu by dioma@kiwifarms.cc
2023-04-27T20:57:24.800489Z
1 likes, 0 repeats
@crunklord420 also once your physics engine is guranteed to run at a certain tick rate, tunneling can only happen when objects move really fast and not because of framerate drops anymore.Then you can just not allow your player to move at the speed of sound and the tunneling problem solves itself.
(DIR) Post #AV6IF4t2WJmyTkrkB6 by crunklord420@kiwifarms.cc
2023-04-28T05:10:02.052801Z
0 likes, 0 repeats
@dioma I think this was the right direction. I integrated libccd into my codebase but I found a bug trying to stack cubes. Though the MPR implementation seems to not have the issue. I found this old bug report: https://github.com/danfis/libccd/issues/25Kinda surprising this is a bug considering stacking cubes is literally the first thing I tried.
(DIR) Post #AV6eFNKK9t8Qf4AuBc by dioma@kiwifarms.cc
2023-04-28T09:17:08.804985Z
1 likes, 0 repeats
@crunklord420>This function only uses basic arithmetic but - and / are not well behaved in a floating point context.Oof, I'm getting shadow volume flashbacks. Precision errors are the absolute fucking worst. I have personally wasted days on those.How big are your boxes? Could help to make em bigger if they are especially small...
(DIR) Post #AV75fjnpugeKf2m3Qe by crunklord420@kiwifarms.cc
2023-04-28T14:23:40.544187Z
1 likes, 0 repeats
@dioma literally 1x1x1 cubes sitting perfectly flat on top of each other at origin.
(DIR) Post #AV7y3gSlNTBGmFmi1Y by Kluehouse@kiwifarms.cc
2023-04-29T00:32:17.896299Z
1 likes, 0 repeats
@crunklord420 If I understand your problem your Main Issue is Tunneling which is objects not being detected in a collision. I'll say unless an object is small or traveling really fast this shouldn't be too much of an issue and maybe you can get away with not doing something fancy or complex. You can bring up the speed of checks for collisions to increase your margin of error until you find something that is acceptable. If you have any math problems for something like integrals you need solved like once you should post it here me and probably several other people here can do that stuff in like 5 minutes.