Hi Guys!
I'm currently working on adding impact response to trees/bushes etc in my game (2d ARPG).
Exactly what I mean is that when a tree, for example, gets hit it springs back & forth to create some more dynamics in the game.
I have one solution I've come up with but I'm not really sure if it's a good choice so I would love to hear if you have som feedback on the proposed solution and If you would have done it differently, and if so, how?
I'm just going to hadnwave the general code, although i'll be more than happy so supply it if anyone wants but at this point I think it will only clog up the post.
Here goes:
The game is oriented as a server/client using TCP/IP with the map divided up in blocks. Since motion of trees etc is really only a visual aspect right now the server detects any collisions done to a block and sends a description of this impulse to any nearby players.
On the clientside the game records any received impulses and applies a decaying oscillation to the relevant blocks. (Right now it is fixed but my plan is to have different blocks/trees/etc have different spring constants and decay time for variety) which then is rendered
Pros/Cons I Can See
The main reason for the approach is to reduce load on the server, collisions are handled anyway so the actual physics calculations can be dumped to the client
However, this increases the datarate (albeit at a small rate) since now these impulses has to be sent to the player
Also, there might me some discrepencies between clients
I currently have no predictions clientside (I know, very latency sensitive but havent gotten so far yet, working solo here ;) ) so the server-side map has to be involved somehow
A small video showing the current performance/behaviour
[media]https:
Any suggestions? Good? Bad? Clobber it with a club until it is no more?