Creating an items table
Today I tried to do a little work on my game but I got stuck on a table which I have been pondering about for a little while now but today it stopped me so I need to address it.
In the game I am working on, players will have items, and will be able to use these items on themselves or others. And these items must be able to have an equation that manipulates the users and the effected players stats. This equation should be able to manipulate multiple stats of each player. I will eventually want to add splash damage but let's start out easy.
So, you have the user who we will call player 1 (p1) and the player that is going to be effected by this item; let's call them player 2 (p2).
Based on this idea I have been able to think of two solutions, one which I ditched almost immediately . But I don't know if the general idea behind this one is any good. So take a look and let me know what you think.
Items table
- id - 1
- name - bardic's staff of unimaginable penetration
- equation - eq{target:10*(p1.str+p1.dex) / p2.def-50}
- target - 0 // 0 = enemy , 1 = allies, 2 = all
As you can see, I am storing the equation in a JSON like object and would simply do a search on the search and replace the bold variables with player 1's and player 2' actually stats. This method I think would allow me to easily keep the equation dynamic and clean.
Now lets look at something like area effects (splash damage, group shields) and how I would go about store such an equation in the table. This example has 3 equations in the equation object but only would be be used at most. I would either use target and others or all but I put all three is just for example.
- equation - eq{target:10*(p1.str+p1.dex) / p2.def-50, others:10*(p1.str+p1.dex) / p2.def-20, all: 10*(p1.str+p1.dex) / p2.def-20}
With this setup I can have multiple equations and multiple stats in either set up. I did have an option 2 which was to bust out all the stats into their own tables but the more I thought about it in comparison to this it just seemed clunky and overly complex for something that shouldn't be that crazy.
Now, to prove to myself that I could actually do this I wrote some a simple script to do such a thing. Right now the script is messier than it needs to be but I wrote it kinda quick just to prove that I can do that I'm talking about here. I will eventually clean it up when I have some time.
But the gist of the script is it hide's the p1.stats and replaces them with actual numbers. This would naturally all come from a database but for the example I just have everything there.
I'd like to apologize in advanced for the lack of formating. I've tried three different highlighters and they break things worse than how they appear here. So till I find a better... sorry >.<
$eq = 10*5 / p1.str + p1.dex / p1.chr;
replaceHoldersWithVals(createStatArr(getHolders($eq)),$eq);
function getHolders($str)
{
$statArr = array();
$pos = 0;
$i = 0;
$len = strlen($str);
while($i != strlen($str))
{
if(stripos($str,"p1",$pos))
{
$pos = stripos($str,"p1",$pos);
array_push($statArr,substr($str,$pos+3,3));
$pos += 6;
}else{
$i = $len;
}
}
return $statArr;
}
function createStatArr($statArr)
{
for($i = 0; $i < count($statArr);$i++)
{
switch($statArr[$i])
{
case "str":
{
$statArr[$i] = array("str"=>10);
break;
}
case "dex":
{
$statArr[$i] = array("dex"=>7);
break;
}
case "chr":
{
$statArr[$i] = array("chr"=>2);
break;
}
}
}
return $statArr;
}
function replaceHoldersWithVals($statArr, $str)
{
$pos = 0;
$len = strlen($str);
for($i = 0; $i < count($statArr);$i++)
{
$str = str_ireplace("p1.".key($statArr[$i]),$statArr[$i][key($statArr[$i])],$str);
}
eval("\$e = $str;");
echo $e;
}
Gameplay Types – Rounds, sandbox, story
A problem with many games that I have come across is the issue of replayability and length and this issue isn't limited to PBBGs but has been affecting PC and console games for the last few years. But since this is a blog primarily about PBBGs lets explore this aspect in relation to them.
Many games have a limited story due to the difficulty of constantly producing new content. Many games approach this many having 'rounds' (SK, NZ,), where after a few months or after a certain in game event happens, the round resets along with all the characters and everyone start new. Some games don't have a story and just provide a sandbox world where the players run the show (kind of like TC or RK). And then you have games that have a set story with quests and when you finish you're character restarts (like KoL) and you start the game quests again with a 'new' character, often with some new unlocked content.
So which way is the best way to your game? I really have no idea but lets look at the strengths and weaknesses of each type.
First up, round based. A round based game from my experience works best for strategy game. In a strategy game you have a set goal; Defeat your enemies before they defeat you. And because there is a set end and the fact that a strategy game can be enumerated on actions, you can make the game challenging by having players try to defeat each other can achieve high scores before the round ends. And with the knowledge of a set end, players know how long they have before they need to start attacking and defending. Through in factions, round persistent leaderboards and round carry overs, and you have a game that with minimal content changes/additions can continue to be fun for a player for several months. Offering round updates and slight changes each round and the chance for players to show off their achievements from past rounds will help retain players for a long time.
With this style of gameplay, you will likely need to split your development time between features and content. Keeping balance is important here, since you want your players to be able to play the game differently each round and see something different or new.
Next is the sandbox style game. If you are unsure what exactly I mean, think of simcity, or gta where your goal isn't really anything in game but to play and see what you can do. These games can be highly addictive (at least for me anyways) but without regular updates and in game events, they can stagnant quickly. This is because the game itself doesn't direct the players but the players direct each other. As you can see, this format can lead to a lot of player activity until most of the content has been viewed or played through. The more freedom and options provided to the player, often, the better this style of game is.
Let`s look at TornCity and Renaissance Kingdoms; both games have open ended play, the players control the game play, both have limited gameplay, but both still exist and gain new players due the high level of player interaction. This level of player interaction is often difficult to get right in strategy games and even more difficult in quest driven games. So, if you are planning a game that is a sandbox, keep in mind player interaction should be on the top of your list for features and future development.
And finally we have quests driven games. These games are probably the most difficult to keep players playing. This is mainly because everything is game and content driven. Without constant content development these games can quickly lose there appeal. Many games try to solve this by some form of 'ascending', meaning that your character and quests are somehow reset to the beginning and providing you with slightly different content or new avenues you can play. While this can be fun, there is limited playability due to the repetition of content and the lack of player interaction. Sure, many of these games have clans or factions, but much of the time the communication and new elements they add for the player isn't enough to make up for the lack of content.
So with a quest game, almost constant content development is a most. Feature development isn`t as important because the point of the game isn't what you can do, but playing the story.
What do you think? These are simply my opinions and views I have gathered through the last number of years playing web games and would be more than happy to debate or be corrected on any of them ^_^
And on a side note: I know itès be ages since my last post. So if anyone has any suggestions for posts or anything they would like to write about let me know. Fire off an email to bardic(dot)knowledge(at)gmail(dot)com or leave a comment.
Can Flash be used for PBBGs?
In short, I think the answer is yes and I will explain myself as I write this post.
This post is in response to a comment by jmucchiello on another post. He has suggested that I write this, and since I have been looking for topics, here it is.
Lets define what a PBBG is.
A persistent browser-based game, or PBBG, is a computer game that satisfies the following two criteria:
- It is browser-based. The game is played over the Internet using only a web browser.
- It is persistent. Progress in the game is achieved over multiple playing sessions.
PBBGs merge the depth and longevity of an application-based game with the accessibility and portability of a browser-based game. PBBG can be spoken as pee-bee for brevity.
And by extension should not involve being continuously connected to the host system
Ranger Sheck's PBBG Design Blog
Through the comment left by Ranger Sheck on the previous post here at OpenBracket, I found a link to an extremely nice site focused on the design of PBBGs. Ranger Sheck's home page is a blog about designing PBBGs in just the same vein of discussion as this blog. Some of his most recent posts include a post on interface design, statistics, and a nice javascript library for maps. I strongly suggest checking the site out and following it. To prove the authenticity of Ranger Sheck's discussions, he is working with a team to design a role-playing PBBG called Pioneers of Aethora. I have been playing it recently and find it a quite satisfying game though still in development. As a side note, the game is being written in Ruby through the Rails framework. This is compelling for me as I am just beginning to learn Ruby on Rails and hope to write about my learning experience as it applies to game development right here at OpenBracket!
PS: My name is Jake and I am the 'new guy.' I will be posting a news article on a PHP PBBG engine soon as well as discussing database design. I look forward to a discussion with our readers here! And thanks for bringing me on board, bardicknowledge!
Player Controlled Economies and Player Created Items/Quests
Sorry for the long absence. I lost my job and fell into a nasty slump. Its just one thing after another... But anyways, this isn't a blog about my life. It's about PBBGs! And so lets get to it.
As you can guess from the title, I am going to discuss player controlled economies and what would happen if the power to create new items and quest/goals were given to the players. This may sound like a crazy idea, but this level of freedom is not impossible. Difficult and time consuming, yes, but not impossible. Perhaps through this post and the discuss to follow afterward, we will think of a more efficient way than I may describe in this investigation of the subject.
Player Controlled Economies :
This is something that most often seen in Strats I've noticed but a few RPGs have managed to pull it off beautiful. And the first one that comes to mind is Renaissance Kingdoms. In RK all goods on the market are created by players. Wheat, flour, corn, swords, gold, stone... everything. Excluding beer. Thing only makes a player happy. But the point isn't to describe how great RK is, but instead to see what happens when players control the price of goods.
So what happens when you let people price good at whatever they want? They will naturally try to sell them at the highest they can possibly make a profit at. This will eventually settle down to the perceived value of goods as more people start to sell their wares and figure out the amount of effort need to create the good compared to other goods. In these economies the rarity + time spent dictates the value of the good. So that ring of a fallen Gods son that is plus forty million to every stat and takes a two months to learn the skills and gather the materials will obviously cost one hell of a lot. Whereas the copper pretty ring, that doesn't do anything but look pretty, is going to be very cheap.
Allowing the players to price their own goods gives the community more of a sense of power over what is happening in their world. Making it so that the players create all the goods (or any of the good ones) gives them an level of involvement that you just don't get when dealing with NPCs. It makes them feel like they have a place in the world and with skills, gives them a sense of progression with their character.
This is something I believe we should all look at closely. As I've stated in the past, player involvement in your game world is a very important feature, and its hard to get more involved than when you are the only baker in your town or the best sword smith in the county.
Player Created Items/Quests
What is one of the biggest limitations when playing an online RPG? In my opinion it's the lack of player actions shaping the world. None of the quests I complete change anything, or none of the items I get are really all that rare. Others will complete the same quests and get the same items. But what if players could create their own quests, or create unique items? That level of involvement is something most commonly seen in pen and paper games where the players can directly communicate with the Game Master.
But say I wanted to create such a system for a web game. How could I even start with it? What would I need to do to make it work in a fair and balanced way? Wells lets see.
I'll start first with the creation of items since it is the easiest of the two. I have designed two such systems in the past for games that will likely be a while yet before they get to see the light of day. But the systems work something generally like this: You're character has a list of stats and skills. Lets use generic RP stats: str, dex, int, wis, con, and char. And lets say my skills are miner, jeweler, crafter, forging, lore, weapon knowledge, armor knowledge, and imbuing. As you can guess, each skill is connected to a stat. lore to int/char, miner to str/dex and so on. Now say that to master a skill or two is really difficult and there are 100's of different items that can be used. So you database all the items, each one's properties using equations based on the players stats to get it's numbers. But you also have an rather advanced system where each item has a relation to all the other items on how they mix based on a number of variables such as level, stats, skills, qualities, quantities, etc.
With a system of this size and complexity, you have pretty much created a world where even items of the same kind are unique due to the makers skill. And while players will be producing similar some of the time, players will be exploring and constantly working to find the best combination of skills and materials. And if you level all the properties unknown to the player or what the possible out come may be when combining 2, 3 or even 10 items, you will see a lot of player interaction just to get others recipes, or failed experiments.
When I said this was the easiest, I didn't mean it would be an easy thing to achieve or even design. This would skill take ages to design and develop but why not put the time in? I know we are for the most part more hobbyists than professionals making a living at this, but this is the time to start. With advance in technology, and an increase in the number of people using the web, now is the time to make PBBGS from a hobbyist thing to full scale game development. This is a plausible system, but design and creation are hugely time consuming.
Let's now look at player created quests. This is the hard one. This is not just because of the code, which will be difficult, but because as of now, the best system I can think of to do this requires a human to go over each player submitted quest.
*pauses to go make a rum and coke* it is st. patties day after all. ^^
So, this is a similar to another system I design for another game that will be a while before seeing the light like my other ones. But I have thought most of the system out. And one of my first thoughts of developing a system like this was how many quests the players would flood me with and how many would be just crap. So I thought, what if I only allowed donators to create quests? That would cut back the number of quests I would have to filter through. I then thought what if I only let the donators do this twice a month. That would be great! I'd have players create the quests for other players. All that I needed to do was build the system.
*pauses for another drink*
I'll try to remain as coherent as possible through all of this lol.
So what would the system look like to do such a crazy thing? Well let me describe what I had thought of. First I would have the basic type of quests, where a player can pick a NPC by city, give the type of quest, the place the quest would take place, and the reward. Several different type of quests would have to be offered and many many goals for each quest would need to be available but so its not always go and gather 10 bee wings for the spellcrafter.
The second type of quest that I intended to offer was one that allowed the player to create a boss-like creature and to give a back story. These ones would offer better experience and better loot, but requires the players to put in more effort into their creation. Uses the same idea, pick a city, then the NPC to give out the quest.
And thirdly, a story arch. This one requires far more effort on the players part to create this quest. First, the quest would need to fit into the worlds story and history, since a quest of this type is meant to be a story, but just a fetch and deliver quest. This type would all the player to create NPC's if need be, a response based dialog and make it several tasks long. Such as one where a player needs to stop a small kobold raiding party that is attack outlaying farms. Upon destroying the kobolds you find that more will be coming, and you are given the quest to go and kill the kobold chief that is controlling them and to return with his head.
You can quickly see why a human is needed to ...
*pauses for another drink*
needed to review each quest before allowing then to be approved and made part of your game. You could of course discourage this by using a strike system or something of the sort where if you purposely create bad quests you get a strike. Too many strikes and you can no longer create quests.
This system, while not as complex code wise as the items, is still difficult because it requires someone to check each quest. Limiting the number of players that can create them and the number those players can create saves the humans much trouble.
So as you can see, while both these methods are difficult to develop and can be time consuming to manage, it is possible to do. I would now like to open the floor to hear your comments. I am very curios to hear your thoughts on these idea's and what you think about the longer development times.
And as stated in my earlier post, we have a new writer here at OpenBracket. Hopefully this will prompt me to write more ^^
Happy Birthday OpenBracket!
A year ago today, I wrote my first post here. I never thought I would actually make a year or have people read and comment. So in honor of OpenBrackets one year, I would ask that if all readers could have a drink, and take a picture of themselves with OpenBracket opened on their screen.
It's been a great year and I hope to continue this. I'd like to take all the readers and the regaulr commenters. You guys are the reason this blog keeps going. Thank you all.
bardic aka Thomas Gillis
Sun buys MySQL
Well... I don't know what this will mean yet, but the news was released about 12 hours ago that Sun Micosystems is going to buy MySQL for a grand total of 1billion dollars (I shit you naught) of cash and stock options.
You can find the announcement here on the offical Sun website.
With Java going open source about a year about and Sun having heavily contributed to OpenOffice and other open source projects, it makes me wonder what exactly their plans are with MySQL. Supposedly they intend to optimize the LAMP stack across all platforms. This could be great if it happens. As long as they don't just sit on it or charge for licenses I think MySQL is in pretty good hands.
For those out of the loop, MySQL makes up the majority share of databases online, and is the main database used amongst PBBG developers because of its ease and that it's free.
Graphics
So I've been looking at a bunch of different games lately and some have amazing graphics, some no graphics and others possibly the worse graphics I've seen in a long time. Also, I was talking to someone about a game he is designing and he was saying how the graphics were a key component of his game.
I'm sure as most people you have read this blog for a while have realized I personally don't care about a game having flashy graphics. My primary concern is game play and layout. Graphics in many web games I find hindering. But I've been thinking. Does a web game need a bunch of fancy graphics?
I think if a player were only drawn into playing the game because of your graphics, I think that player would likely quit not long after sign up. I do think a game needs to look nice, and it can be part of the hook for a game, but to make the graphics a core component is something I don't agree with.
A web game, for several reason I believe, should be graphics light. And I will explain
1) Speed. People want to play the game first and foremost. If there is delay because of loading graphics or even lag do to transfer rates, players are going to become frustrated quickly.
2) Bandwidth. Saving yourself come cash
3) Simplicity. Some graphics may make it easier to navigate a site. But some also make it difficult and cluttered. That is that must be avoided. If your navigation of the site is cluttered or confusing, not just because of graphic but they can quickly add to the mess, players are going to quit. Or worse... complain.
I sternly believe that graphics should be used to make the the layout function better and make the game not look like crap. Clean, simple, small graphics. Nothing crazy. If the graphic proves to be any form of hinderance, I think it should be deleted or recreated.
So what are everyone's opinion on this?
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 ^^
OpenDisccussion
You may have already noticed the new page up there (^). It's is what it sounds like and the page describes it as. Want to talk about things that haven't been mentioned, ask for help etc, go post in the comments on that page. The idea is to not just have me guide the topics of talk, but to give the readers here some control and input on what topics are raised.