Tag Info

New answers tagged

0

If you want to store a reference from the tile to the unit(s) occupying it, then just do it. As long as you remember to remove the reference whenever a unit leaves a tile (as you should do anyway, to mark the tile as unoccupied), the circular references will not affect the garbage collection of destroyed units in any way. The one situations where circular ...


1

First go though your list of obstacles an compile a list of fields that are currently unavailable for movement. This list could contain field IDs or grid references or some other way to identify a field that works for your data structures. Next perform your Breadth-First Traversal and for each field perform a check to see if it is on the list of fields ...


1

It sounds like you already have a walk-map which says which tiles are walkable and which are non-walkable based on the terrain: the static walkmap. What you need is a second walkmap which tells you which tiles are non-walkable because of object presence: the dynamic walkmap. This map only needs to be recalculated when there is a change, so you can keep it ...


1

This is very similar to how one might handle Achievements, or Challenges, or any other situation needing you to keep track of a series of events and counters. Simply coding the rules into a scripting language does work. You would need to be sure that all events related to conditions you care about are exposed to the language. You might also need to allow ...


-1

i'll be a bit abstract. Why don't you use a Observer pattern After each turn you call NotifyObservers that invoke the Notify method inside each observer. Every observer is a win/defeat condition. At the start of a stage, you "register" one or more observers.


1

We used hardcoded conditions with some variables in early days. That was working good enough, but quite cumbersome. There were standard objects (houses, army, citizens, time) and deeds (kill, preserve) connected with win/defeat goals. So for example we could have: kill houses of player 5 to win kill army of player 5 to win preserve citizens of player 4 to ...



Top 50 recent answers are included