Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Jan 23, 2018 12:17 pm

All times are UTC




Post new topic  Reply to topic  [ 1 post ] 
Author Message
 Post subject: Server - Main Game Loop
PostPosted: Thu Dec 07, 2006 5:58 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Fri May 26, 2006 3:54 pm
Posts: 221
Location: Perth, Australia
When the game is being run, the server acts like a black box and just does stuff while looking really dull.
Code:
while (game == active)
{
   tickframe()         'FPS nominal?
   if newday then tickday()   'day = ? ticks
   if newmonth then tickmonth()   'month = 28/9/ 30/1 days
   if newyear the tickyear()   'year = startdate + yearsplayed
}

if game != active
   tell everyone the game has finished
   clean up
   end

tickframe()
   update all vehicles
      broken down?
         update counter
         counter finished?
            make no longer broken down
      at station?
         just arrived?
            add $ if del. complete
         load/unload

      otherwise - move
         

tickday()
   will vehicle breakdown today? (should breakdown probability be in days?)
      make broken down, reset counter
   stock market stuff
   update daily town stuff

tickmonth()
   update industry
   update monthly counters
   update economic indicators
   interest repayments, etc
   update monthly town stuff
   
tickyear()
   update year counters
   update all yearly depedent parameters

I want to leave discussion about server <-> client interaction until later...

Have I missed anything? (I know I have...)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.