Jump to content
  • Advertisement
Sign in to follow this  
polyfrag

Fog of war game logic

This topic is 2139 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

If you saw a building which is then covered up by a fog of war that gets destroyed, you still see it as being there but greyed out. But then you get your units within distance and it disappears.

How do you keep track of what players are supposed to see? And does AI need this too?

Share this post


Link to post
Share on other sites
Advertisement

Your question is quite broad, it really depends on your needs. Let's say that you have a data structure holding your level information. If the level is the same for every player, one instance is enough. But if you're saying that different people might see certain stuff, you might want to have an instance for every player, plus a global instance that holds all recent data. If a player sees more, his own instance is updated with the global one.

 

If you implement the multiple instances, be sure to read/write to the correct one at the correct time. To give an example: in Company of Heroes, path finding is (unfortunately) done on the global instance. This means that I can use this path finding to find out if a certain route is available. (let's say my map shows a bridge in the fog of war. When I give a move order to my troops, I can see if the bridge is available or broken by the path my troops will go, even before they can see the actual area).

 

Technically speaking, the AI should have the same resources as the humans. However, the fair method makes programming the AI a lot harder: you need to implement certain behaviours (such as "smart scouting"). While if you just give them the full map to see, they know where the resources are without scouting. Because creating a worthy AI is a very hard challenge, AI's are often have access to the global map.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!