Hi all,
This is my first post here. Anyway, here is my problem. I am developing an open source game in C# and was advised not to use DirectDraw objects due to the imminant depreciation.
What I need to do it to make a deformable landscape, similar to the one found in worms. This means that I will need to add and remove from a texture.
The obvious way could be to do this myself by locking the texture (which I have no idea how to do) and erasing or adding pixels to it (e.g. explosions erase and shotgun shells add). The critical issue is that this is a liero clone, which is alot like worms with the addition that you realtime (not turn based). The weapons in this game are very exxagerated we can expect hundreds of small (16 x 16 to 32 x 32) explosions per second, the above mentioned method would just be too slow.
The most important detail is that the holes and shells come from other textures as the holes are not nessecarily round. Another issue is that I am using the texture to do collision detection, this adds even more to the mix - I doubt I could use shadow volumes (I don't know how to use them in any case).
If you make any suggestions an url for a tutorial on the techniques used would be much appreciated.
Thanks for your time,
Jonathan Dickinson
Deformable Landscapes
Started by carebear, Oct 11 2005 01:19 PM
1 reply to this topic
#1
Posted 11 October 2005 - 01:19 PM
#2
Posted 12 October 2005 - 11:59 PM
This is an oldschool 2D graphics problem. You have no use of "modern" graphics like shadow volumes and textures.
I reccomend you to have a look at SDL for some pixel manipulation.
Read some older turorials on graphics programming in 2D, to get more familiar with the concepts.
For the collision, just check every pixel in the path of the projectile (google bresenham) and stop when you find the first non-empty pixel.
Collision response is slightly more complicated, but is basically mirroring the velocity of the projectile by the tangent of the surface. The tangent is perpendicular to the normal, wich can be found by summing (and normalizing) the vectors from the collision point to the surronding nxn pixels, weighted by their transparency. (n should be small, like 3 or 5.)
I reccomend you to have a look at SDL for some pixel manipulation.
Read some older turorials on graphics programming in 2D, to get more familiar with the concepts.
For the collision, just check every pixel in the path of the projectile (google bresenham) and stop when you find the first non-empty pixel.
Collision response is slightly more complicated, but is basically mirroring the velocity of the projectile by the tangent of the surface. The tangent is perpendicular to the normal, wich can be found by summing (and normalizing) the vectors from the collision point to the surronding nxn pixels, weighted by their transparency. (n should be small, like 3 or 5.)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











