Broswer Games - Javascript question

Soldato
Joined
20 Oct 2002
Posts
6,212
Location
UK
Hello,

Im looking at creating a standards complient, cross platform, browser based game for my final year project for uni... I've been looking at some online games a fair bit recently and am a bit unsure as to how some aspects of them work (im a bit of a Javascript novice!).

could anyone enlighten me, via pseudo code or just a brief description:

How do the buildings get upgraded in a basic game like Ikarium or Travian?

I assume the building levels are held in a database, against a specific city ID... once the upgrade process starts the cities resources are changed and a counter starts... once finished the level of the building changes, an update is performed on the database and new functions are enabled at that building based on its level... ?

i've researched javascript counters which are passed a date and time, down to the second.. the script then counts the Days, Hours, Minutes, Seconds until it reaches 0... the bit that confuses me is, how does the clients machine know, when completion is... would i be correct in saying the completion date is calculated in advance using something like previous levels build time * 1.2... stored in the database... requested... passed into the counter and the counter presented to the user?

the more i think about the whole process, especially 'battle reports' the more im starting to think i've bitten off more than i can chew.

thanks :)
 
sorry to drag it back up again but if anybody has some insight into this it would be greatly appreciated!

thanks,
 
still looking / thinking / planning if anybody has any resources or sites/forums that'd be worth me checking out?

Thanks,
 
yeah i'd most probably write the pages in PHP as im most comfortable with this... but wouldnt each players building levels need to be stored in a database ?

the user would surely start a process involving javascript which counted down the seconds, against the servers 'game' clock and upon reaching 0 would do a database write? would that be how it would work?
 
Back
Top Bottom