If the spell has an area of effect, can't you just apply the normal recalculation to the area of effect, be it an AABB or circular radial effect?
Well, that was the general idea of splitting the map up into sectors; to try to easily restrict the recalculations to the smallest area necessary.
Just hypothesizing that maybe splitting the map into squares or w/e would be a practical way to do that.
Something to be aware of though is if your spell directly affects a specific area, is there any 'falloff' region past the edges of the area, where there is still slight deformation of the terrain, reducing to none?
Possibly. In the sense that I'm speaking in a very general sense where all we know is that the terrain is changing somewhere somehow and the normals have been invalidated. Though I was thinking along the lines of such falloff areas counting as the total region of the spell's effect for terrain purposes.
Another thought that enters my mind, how do you prevent spells creating broken terrain, e.g. holes in the mesh and such?
I assume you'd just allow raising and lower vertices, probably cap it to some kind of reasonable value, and have some sort of minimum height, beyond which would be bedrock or perhaps water.
TBH, I find Magic Carpet a very impressive game for 1994 in retrospect. This was a time in the 16-bit era when even the Amiga was still very much alive (though only just...) and Magic Carpet has all kinds of terrain deforming, castle-building weirdness. Probably a bit ahead of its time though which is where it may suffer... haven't actually played it in many many years tho, and even then only on PS1... but I digress.
There is a lot to the subject, it depends much on what you want to achieve/simulate.
As a thought... I remember Tiberian Sun (which was 2D, granted, but if we wanted to achieve it in 3D...) had the ability to deform the terrain, e.g. by repeatedly bombarding the same spot with artillery.
Let's say we have a perfectly flat terrain mesh, and we just want to create some sort of simple crater or depression; it might not be necessary to create any new vertices, and the effect might be achieved just by lowering a few vertices by certain amounts.
- In that case would you just use a static VBO and simply give it new data, then recalculate the normals based on whatever method you have of narrowing down the normals to be recalculated? Or maybe the VBO should be dynamic, or does it depend on how many times you expect the terrain to change? (I see stream is another usage hint for data that changes often, but static seems not to necessarily be the worst choice for data that changes in all cases, if I'm reading it correctly).
- If we wanted to increase the amount of vertices to create a more detailed crater, I suppose that would involved complicated code in a geometry shader?