Author Topic: Turn based - how you do it?  (Read 502 times)

Offline phpfan

  • Level 3
  • *
  • Posts: 6
  • Reputation: +0/-0
    • View Profile
Turn based - how you do it?
« on: November 13, 2011, 11:38:00 PM »
Hey guys..
ABout turn base / tick based.
I understood the following:
1) TURN - you get x amounts of turns per Y mins. And turns are used to perform certain actions - (Pimp games, The Reincarnation)
2) TICK - After Z mins or hrs, an action is automatically performed. E.g: attacking someone - (Bushtarion)

So how you trigger those turns and ticks?
I came with the following conclusion:
1) Do it via a cron job
2) Do it within a php page that gets the most number of hits for any user

How do you do it and based on your experience what are the pros and cons of them?
Thanks!
« Last Edit: November 13, 2011, 11:39:46 PM by phpfan »

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Turn based - how you do it?
« Reply #1 on: November 14, 2011, 03:59:48 AM »
1) Turn based - you move and click end turn, then you wait till all players do it. Very rare in browser games.
2) Tick based - you get x amounts of turns per Y mins. And turns are used to perform certain actions - (Pimp games, The Reincarnation)
3) Time based - after Z mins or hrs, an action is automatically performed. E.g: attacking someone - (Bushtarion)

Cronjobs for all global/shared data. For a single player only data you could update it locally when the player visit a page.

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: Turn based - how you do it?
« Reply #2 on: November 14, 2011, 04:18:56 AM »
I thought too that Turn based is a resource-based type and Tick based uses mass resolution in certain time intervals

As for cron, probably agree with Chris


The Tick based (as you and I understand it) - I see it rarely used, although it's an interesting concept, I'd like to try it some day.

I somehow tend to use real-time mostly in games set in today or future, turn based for fantasy, somehow *feels* to fit better, but it's up to you.

Tick base has the worst time accessibility for players though. When you're not in game, the ability for your account to do something is just lost.
If you set the interval to be long enough to allow all the players to play - then most of the time the game will remain frozen...

With realtime, you can often initiate long taking actions, go to school/work, come and continue playing.

Turn-based has the best accessibility - you save up turns when you're gone and spend them when you have a time and mood for playing. It does not enforce players to come back to game, but it should be the fun and excitement what should invite the player back, not punishments



I would also note, that the systems does not have to be used exclusively, you can use two or even all of them, but you should have 1 core one (actually many turn based games have some realtime elements to it, it works well).
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Turn based - how you do it?
« Reply #3 on: November 14, 2011, 04:44:51 AM »
Note that tick based are often advertised as turn based (since these have "turns"). But from programmer's perpective these are tick based.

Quote
Tick base has the worst time accessibility for players though. When you're not in game, the ability for your account to do something is just lost.
If you set the interval to be long enough to allow all the players to play - then most of the time the game will remain frozen...
Why frozen? My Lords allow accumulation of turns up to 4 days. I never heard that it has the "frozen" issue.

Quote
Turn-based has the best accessibility
Not really, the turns are daily at most, it means you can't skip even one weekend.
(of course this depends on what kind of pace we are talking about, for some a day is like an ethernity :D)

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: Turn based - how you do it?
« Reply #4 on: November 14, 2011, 04:56:26 AM »
I used the switched terms as I and OP understand it (tick based with ticks in intervals, turn based = accumulating resources), guess it clears that out
(frozen = nothing happens with the game state until the tick; turns are most accessible 'cause they're accumulated and used when one wants)
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Turn based - how you do it?
« Reply #5 on: November 14, 2011, 05:00:38 AM »
We should make some sort of official BBG dictionary, otherwise we will never understand each other with all these confusing terms :D

Offline Mutant

  • Level 10
  • *
  • Posts: 55
  • Reputation: +5/-0
    • View Profile
    • Kingdoms
Re: Turn based - how you do it?
« Reply #6 on: November 14, 2011, 04:59:31 PM »
I use x amount of turns per hour (I guess you could call them "action points" or something). They're refreshed via a cron job. I have a huge amount of stuff run from this job, triggering at different frequencies and times of the day (i.e. not just refreshing turns). It uses a plugin system, so I can easily add new actions with their own cron string defined (the actual script runs every 5 minutes, but often there's nothing for it to do). For instance, battles can happen offline (if the player leaves themselves logged in in a dungeon).

I think a cron (or some sort of scheduled process) is the best way to do it. Otherwise you might find certain users have to wait for ages when they trigger the popular page (as you refresh all your turns). And what if no one happens to visit or 2 hours? You need to add in extra logic to deal with that, and you'll end up re-inventing cron in a PHP program.

Offline Barrikor

  • Level 21
  • *
  • Posts: 248
  • Reputation: +3/-0
    • View Profile
Re: Turn based - how you do it?
« Reply #7 on: November 17, 2011, 06:52:46 PM »
Tick-based: allows time-units to be stored
Turn-based: uses either "I go, you go" or same-time turns
« Last Edit: November 17, 2011, 06:55:53 PM by Barrikor »
Projects: Pith Framework (at 0.5), CactusGUI (at 0.3)

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal