News for hackers. Stuff that matters.
Re:My first game with Carimbo, my homemade engine by PretzelPirate on Tuesday October 08, 2024 @01:58PM (#41780007)
If I run all the way to the right side of the screen past the enemy and shoot in any direction, the bullets immediately hit the enemy.
Re:My first game with Carimbo, my homemade engine by delduca on Tuesday October 08, 2024 @02:05PM (#41780068)
Yes, the collision mechanism is incomplete, which is why I’m using the bullet position > 1200. Since you passed that threshold, any bullet will hit.

My next step is to work on collision and physics; maybe I’ll use something like Box2D.

Re:My first game with Carimbo, my homemade engine by dakom on Tuesday October 08, 2024 @02:15PM (#41780174)
FYI, I recently posted about a 2d game I made, here: https://news.ycombinator.com/item?id=41761517

Putting aside the politics and all, focusing on the tech- one thing I came across when trying to do my own collision detection was the idea of using the GPU and occlusion queries for pixel-perfect results.

I didn't come up with the technique, but it's super cool, and since you're not taxing the GPU with tons of 3d triangles, it's perhaps a bit more free to do stuff like that.

Re:My first game with Carimbo, my homemade engine by delduca on Tuesday October 08, 2024 @02:23PM (#41780258)
Using the GPU is always interesting, although in my case I want to maintain compatibility with browsers through WebAssembly.

Nowadays, it’s very rare for a user to download and run a binary.

Re:My first game with Carimbo, my homemade engine by hedvig23 on Tuesday October 08, 2024 @03:01PM (#41780604)
Ignorant question, but I assume that means there is no "browser-facing" or accessibility to the GPU for a web based application in this way (WebAssembled or even otherwise)?
Re:My first game with Carimbo, my homemade engine by __m on Tuesday October 08, 2024 @11:45PM (#41784321)
There is WebGPU, but support isn’t widespread yet. Compared to WebGL it does allow you to create compute “shaders”
Re:My first game with Carimbo, my homemade engine by dakom on Tuesday October 08, 2024 @05:02PM (#41781784)
Yeah, the game I linked to is in Rust/wasm, running solely in browsers :)

The interesting part of the collision detection code is here: https://github.com/dakom/not-a-game/blob/main/src/collision/...