Hello,
I have visited gamedev forums a while ago with different epic game ideas and concepts. With my current understanding of programming I realize how complex can even a simple card game get with different interactions between players, cards and so on...
Since I am a physics student and a fan of 2D Worms games, I tried my luck at creating a physics engine prototype, with which I would hopefully make everything (besides characters,weapons...) out of tiny particles, thus destructible and uniform.
My current working demo using javascript and canvas.
If I risk of having some simulation bugs and weird particle behaviours, I could get almost 10 000 particles to be simulated at 30 fps. By fiddling with the speed of simulation and other variables I was able to achieve some sort of soft bodies that would break appart if they hit the ground with a too great speed.
The biggest obstacle to my goal is uncompressable fluids and solid objects. For example: if a solid box hits the ground, I would want it to stop almost instantly. My way of doing the simulation is to calculate only the interactions between nearby particles (usually one to six) per one interation. If my box is 100px tall and I want it to stop moving in 5 frames, I would have to do at least 20 iterations per frame to have it (the top part) compleatly stopped if the gaps between the particles is one pixel.
This rought benchmark demo tells me that only 5 000 000 simple calculation cycles can be executed by javascript per one frame, which is a lot less than I would need to simulate 2048*1024 particles (my goal for something like full HD playing world) with the previously mentioned fast responses. My reasons to have everything made out of particles are more game-play specific, but I am also keen on finding out if its at all possible.
I am looking into OpenCl to ("port") create my physics engine in. I am starting to get familliar with the kernels and all that good stuff, but before moving on I would like to know if there is a good way to estimate a worst case scnario performance of my game engine. Is it possible to determine if my engine would be possible with just a base knowledge of how many calculations I will need to carry out? Do I need to create a full physics engine prototype just to know where the unexpected bottlenecks appear?
I can give more details on how my engine works (its all in the webpage's source, as unique and precious as I think it is at the moment) and why I think it can be very easily parallelised, but my question is dragging already.
P.S. I would gladly discuss the physics of my engine (or the engine of my physics) more in depth, not sure where to do so.