Jump to content
  • Advertisement
Sign in to follow this  
monophonic

Maintaining faction specific view of the world

This topic is 1157 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 am thinking of creating a game. So far I have a bunch of nice ideas, and one big architecture issue that's keeping me from even getting started.

What I want is for each faction to have their own idea of the state of the world. This idea should not match other factions' ideas, or reality as the world manager tracks it. So while a unit of one faction may be at location X, other factions might see it at Y or Z or even not see it at all. Generally this would depend on where a faction saw the unit last, and whether the seen unit or the seeing unit moved out of the location.

The game world consists of a number of discrete locations, and no gameplay would happen between these locations. Anything that needs a tilemap or some such doesn't seem fitting then. Too bad, as there's a lot of writing about 2D RTS fog of war out there. It was all I could find when I tried searching for any discussion about what I am trying to do.

I have hit a wall trying to figure out the best way to represent this imperfect knowledge in coding. Here by best I mean the simplest, easiest to understand and implement correctly architecture. Performance is of no concern to me at this point, avoidance of difficult bugs is.

I have come up three potential ways to implement this, but all of them seem somehow flawed to me.

  1. Each unit has a set of references, one per faction, pointing to the location where that faction thinks that unit is.
  2. Each faction has it's own world model, reflecting what that faction thinks the world state is.
  3. Each unit has a shadow copy per each faction, placed where ever that faction thinks the unit is. Each faction only sees the shadow copies and not the actual units.

1. seems to be backwards, as I would have to go through all the units in the world to find which units should be visible to a faction at a single location.
2. looks like too much duplication of information and code.
3. still duplicates information, but at least there's only one world manager to keep in sync with itself.

Well, I think I got my thoughts into words adequately. Thanks in advance for any responses!

Share this post


Link to post
Share on other sites
Advertisement

When I made a simple RTS, I didn't bother with anything complex, with a simple form of your option 1. Essentially each object just had a "seenBy" bool array / bit field, and in LOS updates Id set that appropriately for each object. This gave me the common fog of war type thing, as rendering, AI, etc, could just check the flag for the relevant faction when iterating through object collections. This however doesn't allow for misinformation.

 

One option is to just expand the bool to contain more info, e.g. if I was making a system similar to supreme commander, the states might be:

  • UNDETECTED: not directly visible, and not detected by radar,
  • LINE_OF_SIGHT: currently have direct line of site,
  • RADAR_DETECTED: only approximate unit type,
  • RADAR_DETECTED_KNOWN_TYPE: currently only seen by radar, but had previously seen details through line of sight

Or you could even include more complex info in that per-faction block, like having the last known position, essentially building up a per-faction "view" object that goes with the real object. You could even then make it so that the engine only gives other components (e.g. UI and AI) these per-faction view's, not the underlying real logic object, allthough not sure that provides much value unless you intend to have user-created UI plugins and AI's and want to prevent cheating.

Share this post


Link to post
Share on other sites
Generally speaking I worked on something kinda like this using a variation of #2. Basically we set things up in a client/server model where the primary game world was the server with 100% knowledge and each client has a view using areas of interest. The benefit to this for our implementation was that we could leave the master world view absolute without complicating it. The views into the world were very similar to networking concepts of interpolation/extrapolations, and we could manipulate such data completely divorced from the server. We were also able to do 'approximate' detection, somewhat like sonar, where you don't get perfect data and we could display this as area's of probability instead of absolutes.

You could do all of this without the split of client/server thinking but the benefits of keeping the separation to the devs was well worth the time. Additionally, it of course makes networking such a game pretty easy later.

Share this post


Link to post
Share on other sites

When you talk about factions, are you referring specifically about NPC/computer controlled factions?

 

What is the gameplay benefit from a player's perspective here?  What ideas of yours are going to make this imperfect faction view of the world not only apparent to the players, but provide compelling gameplay for them as well?

 

I'm not seeing an end goal here that would justify the effort in implementing this 'feature'.

Share this post


Link to post
Share on other sites

Thanks for the replies!

 

When you talk about factions, are you referring specifically about NPC/computer controlled factions?

 

What is the gameplay benefit from a player's perspective here?  What ideas of yours are going to make this imperfect faction view of the world not only apparent to the players, but provide compelling gameplay for them as well?

 

I'm not seeing an end goal here that would justify the effort in implementing this 'feature'.

 

I am still mostly thinking a level of abstraction above who controls what. As for the gameplay, I am planning a heavy emphasis on cloak and dagger type of ops, setting up spy networks, kidnapping or otherwise silencing enemy key personnel, sabotaging military facilities etc. All this as one of the higher-ups who plan missions to play together so you get the influence on the enemy you want. Regular units would be there mostly just to stand guard and take over locations already thrown to disarray by the special operatives.

 

Whether this will provide compelling gameplay, I am hoping it does. Maybe it only works for me and everyone else would find it boring? Luckily I am only investing my free time in this so I can afford to experiment and fail.

 

 

Generally speaking I worked on something kinda like this using a variation of #2. Basically we set things up in a client/server model where the primary game world was the server with 100% knowledge and each client has a view using areas of interest. The benefit to this for our implementation was that we could leave the master world view absolute without complicating it. The views into the world were very similar to networking concepts of interpolation/extrapolations, and we could manipulate such data completely divorced from the server. We were also able to do 'approximate' detection, somewhat like sonar, where you don't get perfect data and we could display this as area's of probability instead of absolutes.

You could do all of this without the split of client/server thinking but the benefits of keeping the separation to the devs was well worth the time. Additionally, it of course makes networking such a game pretty easy later.

 

 

Or you could even include more complex info in that per-faction block, like having the last known position, essentially building up a per-faction "view" object that goes with the real object. You could even then make it so that the engine only gives other components (e.g. UI and AI) these per-faction view's, not the underlying real logic object, allthough not sure that provides much value unless you intend to have user-created UI plugins and AI's and want to prevent cheating.

 

You two seem to have some converging ideas here. I especially like the client/server architecture, even though multiplayer through the internet is way bigger a job than I am willing to incorporate at this time. It would certainly facilitate playing against myself by having a different faction in separate windows. That would help test many cases in a controlled and repeatable fashion.

 

I appreciate getting such friendly and knowledgeable feedback. If anything else springs to mind, please let me know!

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!