Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store building metadata #87

Open
4 tasks done
spassvogel opened this issue Dec 20, 2013 · 0 comments
Open
4 tasks done

Store building metadata #87

spassvogel opened this issue Dec 20, 2013 · 0 comments
Labels

Comments

@spassvogel
Copy link
Contributor

The server should store all the building data in the database such as: costs, requirements, generates (how much resources it generates), build time, citizen capacity. If not in database, then in XML config files.

During the initial page request the server should send this to the client, who will use it for the GUI. (server should serve it as a .js file to the client (this is best imo..), parse in HTML, or a seperate AJAX request (probably easier..))

The benefits of this are:

  • Single point of truth: Not specificing game balance stuff in two places
  • Security: clientside stuff is SUPER easy to hack
  • The server needs to know the resource generation and build time information anyway
  • It also enables us to do a server side check to see if the player has enough resources to build a perticular building, if he/she managed to circumvent the clientside check.

This is the JSON signature of this data (subject to change):
structureTypes: {
"house": {
cost: {
wood: 1,
food: 2
},
requirements: {
culture: 4,
knowledge: 4
},
buildTime: 30000,
generates: {
wood: 1,
metal: 1,
stone: 1,
safety: 1
},
citizenCap: 4
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant