Jump to content
  • Advertisement
Sign in to follow this  
DogCity

Spheres of influence...

This topic is 4836 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want a system to calculate and very crudely simulate the spread (and reduction) of influence over a grid. Each point has its own influence cache, which is acted on at each tick, to increase, decrease or remain the same, based on its own influence and then, the points adjacent to it... Oh dear.. Take a look at this, i'll try to explain. Each square represents a different kind of land tile that produces or looses influence. B2 is a city. Without any distribution each turn, in five turns time, B2 would have a cache of 50 influence, C2 would have 5, A2 would have -10. Each square would have increased or decreased based on its own influence per turn. But I want to show the distribution and balancing of each squares influence on the ones around it. What should happen here, is over the next few turns B2 (my city) should distribute a few of its influence points to each of the surrounding points. For example, (Without counting any other interactions) B2 would shed 1 influence point to A2 each turn, and assuming A2 had enough negative points in its cache, B2 would loose a point each turn. In time, A2's cache would become positive, even though it still produced negative influence. Influence should be taken from each squares cache, and distributed to each adjacent squares cache. The answer to calculating this strikes me as requiring a similar approach to rendering an isometric scene. But to work line by line would fail completely because of the adjacent distribution... Any ideas? edit: Fixed image tag -SiCrane edit: thanks :)

Share this post


Link to post
Share on other sites
Advertisement
If I understand you correctly, you want to do the distribution "simultaneously" rather than sequentially (tile by tile), in order to prevent feedback effects. There are a number of ways of doing this. For instance, you could first determine the number of points to distribute from every tile, then apply the distribution in a second step.

To illustrate, assume two neighboring tiles, one negative and one positive:
A=20 B=-4

Let's say the distribution algorithm divides the value by four and moves that many points to the neighbor. If you do this sequentially, the result is incorrect as B is being affected by A before it will distribute its negative points:
1. distribute 5 from A to B (A=15, B=1)
2. distribute 0 from B to A (A=15, B=1)

If the distribution amount is determined at the beginning of turn and applied separately, the system becomes more predictable and B actually affects A:
1.a. distribution amount from A is 5 (A=20)
1.b. distribution amount from B is -1 (B=-4)
2.a. apply distribution from A (A=15 B=1)
2.b. apply distribution from B (A=14 B=2)

Another example would be to set both values to 20. Unusual things will happen using the first method :)

Share this post


Link to post
Share on other sites
Thanks Fingers_ simultaneous distribution makes sense. I was having trouble getting my head round how any method could work... I've just done a dry run on a 4x4 grid and it worked nicely!

Now I want to scale it up, and find a way to stop everything equalizing over time... Oh crap.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!