Ladies and Gentlespoons,hobos and tramps,
Cross-eyed mosquitoes,and bow-legged ants,
I stand before you to sit behind you
To tell you something I know nothing about.
Love that poem. Anyhow, I’m a little unsure of how to best solve the following problem and I’m welcoming all feedback from anyone who reads this post.
I have a daughter in 9th grade whose economics project / science fair project is due in February and she has decided to do a little ‘tycoon’ simulation. I have to code it of course. So, here’s what I agreed to do for. Allow her and her classmates to run a simulation for ten to thirty days depending on when I can finish. Each ‘player’ will own a truck that they can ship freight with to earn an income. The only cost is fuel, but it takes time to travel from one city to the next. The truck is operated by a driver who never sleeps, so it can run for 24hrs straight. That’s the bulk of it and is just that simple.
Now for the feedback as I’m still prototyping this in my mind. I’ve been developing Java since day 1.1 and have learned that just because this is meant for 25 or so people, it won’t always be that way. I say that because issuing and tracking a few TimerTasks are fine, but would cause me a few headaches if I wanted to scale this. So, I’m thinking that I should just monitor a timestamp column for various records in the database.
- Send freight from Jacksonville, FL to Nashville, TN
- Calculated time is eight hours
- Add timestamp to player_action table
- When details related to player are queried, check the timestamp.
a. If shipping time has passed … drop freight … collect pay … top off fuel
b. Calculate remaining time for display purposes
I played around with some MUD programming in my youth and wrote a sidescroller or two, and even implemented a few model simulations as course work in college, but I always used Threads or Timers because nothing was multiplayer centric. Can someone suggest an alternate approach or a better way to implement what I described? Thanks in advance for your suggestions.
One more thing. This is text based or I’ll implement something via the web for the players to choose which jobs they want to perform and it’s at best a ‘piece of a game’.