My little web game has a large list of buildings that you can build, the completion of which allows you to start building new buildings...
the data base of buildings attributes holds amongst other things a record showing building A allows building B...
e.g. Building a textile mill allows you to build the shipyard or the water wheel...
the data is not linear though...for example, the waterwheel requires textile mill and engineering school..
attached is a jpg "build tree" which was done by one of the players, and i have subsequently updated.. however i have been talking to some colleagues and one mentioned it would be really cool to have the game draw the "build tree" showing different colours for which buildings you have completed, which are available to you to build.
I have been wrestling with tthe ide for a few months on and off, and i cannot think of a good way to display the data, nor a good way to iterate through the 141 records which denote the links between buildings....
here is a simplified sample set:
Building Effect value filter
Yard buildallow Quarry 1
Yard buildallow School 1
Quarry buildallow Mine 2
School buildallow Barracks 2
Mine buildallow Blacksmith 3
Blacksmith buildallow Armoury 4
Armoury buildallow Armourer's Guild 5
Barracks buildallow Fighter's Guild 5
Armourer's Guild buildallow Archery Range 6
Fighter's Guild buildallow Ranger Guild 6
Archery Range buildallow Ranger Guild 7
so linearly - yard -> quarry -> mine -> blacksmith -> Armoury -> Armourer's Guild - Archery Range -> Rangers Guild
but rangers guild also required fighters guild:
Yard -> school -> barracks -.Figher's Guild -> Rangers Guild....
i'd like function where an on mouseover "ranger's guild" would show it requires "archery range " and "fighters guild", which i can do, as it is currently done on the text page about the building.. but to make a graphical map of all the buildings, showing how they link together, is beyond me..
has anyone got any idea's which will help me?
Start Free Trial