The ‘tick’
This has been a rather popular post and seems to be a big question and topic of debate among developers. I, for one was confused about how to appoarch this when I first posted about it. But after reading comments made by people smarter than me, and learning more about databasing and scripting I feel I am ready to touch the submit again. Some of this will sound very similar to comments made in my original post on the topic mainly because I feel those people had the right idea.
You may call it a cron job, a timed event, or something totally different. I prefer the term tick. I like it because I think of it has an internal clock where each tick of the clock is defined by the creator of the game. So a tick may be a minute or an hour. But the subject of the this post isn’t exactly about what a tick is, but more so how a tick works.
Let’s start with an example. Every 20 minutes I want to give the player 10 more energy. If I were to use a cron job, every 20 minutes the server would grind to a halt pretty much as the cron ran through ever users entry updating their energy field. There is also the possibility of using AJAX. When some people hear this they think using a javascript timer that updates the database every few seconds… That’s a worse idea than the cron job for bring your server running into a wall. You could use AJAX to update the players data every 5-10 minutes or so. But I think this is still a a rather inefficient way of updating the data since it only works while the player in online.
The method I am adopting is the last click. This style of ‘faking’ a cron is from what I can tell the most efficient on the server, will cut back on lag, and can handle server down time in a method of your choosing. The gist of it is that every time a player perform an action in game, it will store the a timestamp of that event. Then on the next click you compare the difference between the store timestamp and the current timestamp and perform the according game functions based on the time past.
“But what if I interact with another character?”
Thanks for asking. Say I go to attack a player that has been offline for 5 hours. As soon as I view that player in a way that is more than their name, it will update their data (you will likely want to use a different method when looking at score lists or ranking so you don’t have 200 people updating every 15 seconds). You may think this method would be difficult on the server, but with a properly designed database (at least 2nd normal form) and some well written script, this method will allow for your game to be very scalable. In other words, you could have 2,000 or 40,000 members without the need of rewriting all your crons or updating servers every few months.
“But who would I manage a searching or score lists?”
Say you update the top 100 players in several fields every 20 minutes and the search tables every 5. All you would need to do is simply create a small table containing the last updates timestamp. You compare the two, if it fails to equal for than your set interval, ignore it. You just saved yourself updating all those users unnecessarily. A different method may suit you and your design better, you be you the general idea of it.
The last click way of doing this does take longer to be designed and built but in the end this will pay off. Instead of updating 5,000 members in a row all at once you now update 5 every few minutes. You are performing more updates but the requirements on your side won’t be as near as depending, eliminating lag before it occurs.
I hope that was all was clear and addressed some of the questions I have been receiving.
Oh, and by the way; if you disagree with me, please share your method. I write in the blog not just because I want the attention (
) but also because I want to help the community grow and develop. So please, share your thoughts and comments… unless they are negative. Then you keep those ^^
Goals and Achievements
Have you ever signed up for a web game and played for about 15 minutes, stopped and asked yourself what the hell is the point? I have. Too many times. And this is because the game lacks a way for the player to feel like they are are growing or making any form of impact on the world. I know I have discussed this before, but I am going to try and go deeper than I did then.
I’m going to break this post up into two categories: Round based strategy games and persistent RPGs. This is because I feel that these different styles need to be approached with the fact in mind that we required customized needs. Not every game is going to have the same goals, since that obliviously isn’t something that will help you stand out but hopefully this will help the creative process.
Round-based strategy games (RBSG <- I’m coining that acronym
)
So just to be clear, a RBSG is a game that lasts a month or two (sometimes longer) where players usually battle for high ranks. And it works. Many good games of be based of that, but I feel there is always room for improvements. One of the first things, is persistent accounts. Many of the RBSGs I’ve played require the player to sign up each round with a new account. This eliminates the possibly of players having a personal record to show off their accomplishments. So when a round ends, their latest stats are record to their profile and during the next round people can view where to placed the round before.
And why just record their networth rank. Make it so that their total kills are shown, or their efficiency at research or maybe their attack/defense ratio. Giving players multiple ways to compare themselves to their friends/enemies will just provoke more competition; that is, if your game is design to allow for more than one style of play.
Persistent role playing games:
A RPG that doesn’t have any resets. You character never resets.
Games like this get very, very tricky when you start trying to plan out different ways for players to reach achievements. This is part of the reason you want to design a semi player driven goal system. But I’ll touch on that in a little bit.
So with a RPG where your character does not reset, the easiest way to compare your character to others is by level or rank, or total stats, or best equipment. And these are tried and true methods of competition, but it brings nothing new to the table. A lot of this for a PRPG will depend on your design since these can vary a bit more than a RBSG.
You also need to take into consideration that new players will be joining a long time existing world, and they still need to have goals. And this is where a player driven goal system comes into play. A well designed game will allow for players to play the game differently from others, which means that won’t all be trying to achieve the same thing. For instance, in a RPG, I may be trying to get the Sword of a red headed amazons Shin while one of my friends is attempting to collect all the dung beetles in town so they can make a hight level potion to attain a new skill.
As you can see using just number of skills or best armor wouldn’t do justice in a situation like this. Which is why I feel that each player should have a dynamic profile to display their goals/achievements. So if I were a warrior, I would go into my profile and want to show of my equipment, stats, and my current quest. So I would have a series of check boxes that I could click to display that. While my mage would want to display their best spells, their rank in the wizards guild, which spell they are currently studying and what quest they are performing.
As you see, developing your game with all this in mind and that you want your players to possibly play the game in a new, you can promote competition beyond just seeing you can be the biggest, strongest and spend the most time online playing the game. I think is a step that PBBGs have been needing to take for sometime now and hopefully they will soon enough. I personally will be developing my games with these thoughts in mind.
I’m back…
I finally feel that am I ready to start writing again. Over the past few months I have been fighting with pain-induced depression, and it just sucks the will out of you. But I think that I have finally crawled out of that slump with the prospect of finishing one of my projects (finally). A friend said he would help and I think that was the boost I needed to help myself get out of the rut I was in.
Also, the large amount of Advil I’ve been taking lately and small amounts of self medication probably have helped bring some of the pain under control. And it’s not emotional pain before someone calls me emo. I suffer from almost daily migraines from being hit by a minivan.
Anywho, I will hopefully be back tomorrow with a new post. I’m thinking of writing about goals and achievements, not only in round based games but in continuous ones.
I will also be posting up rules I am working on for an RP battle you can play on a forums or on Facebook (which is the platform I’m aiming it). It may take me a few days to get those up since I need to create playing docs for the other coder on my project. But I will be back with more posts soon!