C programming experiments.

Targeting WASM & Win32. No engine. No libraries.




2021-06-9, reading user input such as mouse cursor, gamepad, keyboard.
input

2021-06-12, drawing images, filtered and not filtered as well as gamma-correct(ish) transparency.
images

2021-06-20, ray-box intersection in 2D
raybox

2021-06-20, ray-box intersection in 3D with texture mapping
texturecube

2021-06-27, depth buffer, 3d transforms for rotaton, camera projection and some optimizations. (still pretty slow tho)
cubescene

2021-07-11, ray-sphere intersection, simple lighting, some optimizations, better bounding boxes and faster loop.
spherescene

2021-07-11, skybox and more elaborate lighting.
spherescenelighting

2021-07-13, circle-box de-intersection and physics with angular momentum.
physics2d

2021-07-15, extended the physics thing to 3d. Not claiming it's good, stable or even fast. Janky physics, but it's *my* janky physics. :)
physics3d

2021-07-20, If there's any aspect of this that I still feel uncomfortable with, it's definitely threading. I'd love to keep going but it's eaten three days already, so this is where it's at. Need to focus on other things for now.
threading

2021-07-22, added editor features such as a gizmo, loading/saving of levels, persistent state (If you refresh, the camera stays in place), some more UI stuff like a slider.
editor

2021-07-24, added sound, both playback from files and ported over my string synth from last year.
sound

2021-07-26, Particle effects! not super much to say about them, just drawing images with a simple determinstic sim.
effects

2022-01-28, After a several month hiatus, and kind of getting burned out on making multithreading work, with a lot of help from a friend (doublescale) It now seems to work pretty reliably, both on windows and in this web version. As well as threaded rendering now working, this version also has some gameplay stuff! (gameply ideas shamelessly stolen from an old favourite game of mine called Ballance.)
gameplay


Todo
memory
blitting
user input
math
image loading
raycasting box
raycasting sphere
physics
persistent data
multithreaded rendering
level saving
level editing
sound
particle effects

Cleanup
Performance
Game
Performance

Networking? (winsock/web sockets?)
Go through all the code, rename structs to use consistent naming, merge all X, Y stuff into float2/flaot3s.

Maybe write an image loader so I don't have to read from a canvas. for security reasons some people disable canvas reading.
If you have problems with textures looking broken, allow the page to read from canvas. https://i.imgur.com/HsL2mOi.png

Physics!
de-intersection
thing put into motion tends to stay in motion.
gravity
rotation energy -> movement energy, movement energy -> rotation energy

Level saving!
generate C files that contain the entity data, include them? hacky, but will work everywhere. won't work if level data becomes too big.
make a level file, "level1.c" that has a function that calls a bunch of functons to spawn stuff.
makeBox(pos, rot, scale, mat)
makeSpawn(pos)
makeGoal(pos)
makeSphere(pos)

mechanics
switching balls
rolling against walls

enitites
block
ball
player
checkpoint
spawn
end
extra time pickup
gong
health pickup
statically movable object platform spiral linus on the line slalom wavy platform momentum side rolling grid platform rolling balls down to roll over rolling track staircase rolling onto side-rolling rails