May 30, 2009


I have been working on a special project several months ago, which was really fun to develop and apparently the guy I've been doing it for loves it, so I present you proudly:


But first, a story for ya: We were working on a project which needed scripting support for users, but not harm the system or data. The available sandboxing php script was very unhandy and no other options were around. We first thought about implementing other scripting languages (Lua, python), but realized that integrating them as php extension would be a lot of work. So we sat around and developed a specification for a custom language, which we thought was a some awesome way to do this, we gave it the name AwesomeScript :)

Now, AwS (as we started to call it) is designed to be very similar to JavaScript, and blocks all invalid function calls to an undefined or not allowed function. It currently doesn't have any class support, but that is open for the future. We might also publish the specification to AWS if you are interested enough. The test file in the repository has everything you need to know about it, but feel free to contact me if you have additional questions.

The repository is available at github:

Have fun and feel free to fork me on github!

PS: There are no released projects available, but I'm working with Cpojer on several, so stay tuned!

Mar 15, 2009

Lempel-Ziv-Welch algorithm in ruby

Here is a small script I wrote for the fun of it. Originally I wanted to put it on twitter, but it got a bit too large for it. This made the code very compact, but also quite unreadable. However, I just made a blog post on it, and don't plan to expand or modify it any further. Pretty simple being, it converts a string to a Lempel-Ziv-Welch (LZW) encoded (semi-human-readable) string. Enjoy.

# Variable initialization
s = 'to be or not to be. ' * 100
t = ''
d = ['']
c = ''
l = false

# Algorithm
s.each_byte do |b|
l = true
t << b.chr
unless d.include? t
d.push t
c << d.index(t.chop).to_s << t[t.length-1].chr
t = ''
l = false

if l == true
c << d.index(s[s.length-1].chr).to_s

# Output
puts 'original: ' << s.length.to_s
puts 'compressed: ' << c.length.to_s
p c

The benefit of this 'compression' isn't high, but it's something. For example, "to be or not to be. " is converted from 20 to 27 "compressed" characters. However, the same phrase, but used 100 times in succession (as in the example) gets compressed from 2000 to 846 characters.

Sep 5, 2008


Oh well, I've been doing it lately, but I didn't write about it at all in my Blog.

A few months ago I started to get interested into Wii homebrew development. Homebrew means that you are running code that is not signed by Nintendo and not done with any help of them at all (as for example source code and documentations). The kickstart actually was made by the homebrew channel, which is just a really good piece of sofware I recommend to anyone who has a Wii. In fact, some of the developers even helped with some source code snippets, for wich I am really thankful.

So I've been getting into this whole scene, which was really fun. There was something magical involved to develop on a completely different platform. You had to learn lots of new stuff, most of which was undocumented and any kind of information was only barely available. So here I went, started to do stuff here and there, and as we know me, I started to work on a Tetris Attack clone. The basic went off pretty quickly, as I already had one done for my mobile phone, and in a very close timeline I made some blocks moving upward. I was quite proud of myself to do such feat, and I sat about 2 hours just designing the tiles.
I was happy until I saw what the rendering library had done to my images.

First you had to run it through the images some converting program to do your bidding, and then you had a stripped down version of it, with too-bright colors and such. This was maybe done to save some memory, but in my opinion the Wii has enough memory for some simple homebrew developer needs in 2D, so that decision was made irresponsibly and resulted, in fact, in lots of crappy games. There was a point in the homebrew scene where most of the best developers said just "no" to that rendering library and told everyone else to not use it. The main reason for this abandoning was, that it did not use the graphic processor of the Wii, but just one processor, which resulted in slower games than usual.

So there was I, with a half-assed start for Tetris Attack clone and no rendering library I could use anymore to successfully launch that game. Since I was still always thinking about Galaxy Stations, and just somehow liked the Java Mobile game rendering library, and thought I could even improve on it. So I found some guy who just finished a game with the rendering library now everyone learned to hate. So I was here with feesh, and we started somehow from scratch writing that rendering/game library. Since I love OOP more than my right foot, it was coded in C++, and the first version was done and released in about a week, if not less. We called it libwiisprite, since that was essentially what it was. Quality was the main thing we had in mind for the library, so we had an extensive documentation ready from the first day.

But that was not our main feature. Our library ran on the graphics processor for rendering actions. We had extensive options on how to display different images differently with zoom, rotation, and clipping. Our library featured even the ability to load any 32bit png if it was in the correct dimensions. That meant even the alpha layer got displayed correctly on the pngs. The object oriented design also allowed to develop games blazing fast, and our demo game was made in just a few hours. A video of the first version can be seen here:

(note that this version is really outdated)

Now libwiisprite supports lots of other features, for example transparency or special alpha blending for particles, stretching, and loads even loads 24bit and 16bit pngs. It has grown up, but it's still growing. A fun fact is, that it allowed for the first physics-based homebrew games on the Wii. As you may see, I'm quite proud of it. The last versions for example fixed a lot of bugs in memory handling, and is now considered memory-leak-free, which was accomplished with the help of a lot of people, to which I am really thankful.

You can check out the current version of libwiisprite (0.3.0b) on the wiibrew wiki. Please notice that libwiisprite is not even a release candidate yet, but simply some library to play with. Polish is very important to this library, so before the 1.0.0 release there will be many revisions. This is however a base which will probably stay the same throughout the life of libwiisprite. The documentation is still on feesh's page, even though he is not developing the library anymore. In fact, even I can't sit so much on the sources anymore, since I have a job now, and I'm studying software engineering at our university here in Vilnius. And I still somehow manage to find some time for my girlfriend and my friends... And some game development here and there.

Note that libwiisprite is not the only one rendering library available, but it's just a very good one. Libwiisprite actually spawned some kind of competition. The old library for example, which used to be really bad, had a version update, and now also uses the graphics processor. It is however, C based, and game development is only easy and easy to maintain if the game is really small. It is still an alternative, which shouldn't be avoided, it all should depend on the needs of the game.

So yep, that's what I was doing these few months. It was a really fun time, and I really learned a lot by doing this project. So to anyone who would like to have a specific program for anything: just program it. You learn a lot by even doing simple stuff. If you're working together in a team, you are also able to teach others your knowledge, as others are able to teach you. Working in teams is really nice for any kind of project, so let's that be my "hidden" message in this blog post.

Aug 23, 2008

What makes browsergames so addictive?

Everyone knows them, some of them play them. Who starts to play, can't stop. It happens with every one of them. Browsergames. Since I'm a freetime game developer, one thing that has been stuck in my eye is the sheer addictiveness of these browsergames. This is one of my few articles which will analyze gameplay and provide a simple reference for those who need it. I will go into detail why browsergames offer this kind of strange bond between the player and the browser and what can one do to improve upon it.

First of all.. What are browsergames? They are most often some text-based games with some images you can play straight from your browser. There are some games like Travian (I will reference this game later, so check at least the screenshots out), OGame, or to name a completely different one: Runescape. You can play all these games in your browser, which qualify them for being a browsergame. Most of these games don't require any plugins, as for example Runescape does (it's still a Java applet), so I will discuss these, which just require the integrated browser renderer.

As most of the guys of "the scene" know, there are a lot of strategy games. In fact, you really have to search to get to play an RPG or any other type. The main reason might be that the strategy games do not only prove to be very easy to create (think about it: some units, some map system, and voila, it's playable), but they also are somehow the king of addictiveness. My girlfriend for example tried several RPG browsergames until she just stuck to Travian, as it's much more immersive as the former. I'd say she even got lucky to see the RPG games first, as now she will be probably lost in the whole mix of strategy games. To get yourself started: Legend of the Green Dragon, Duels and Gladiatus. This is kinda sad for myself, as I'm a huge fan of RPGs. One thing though is, that most of the strategy games are in outer space for some reason, which is awesome, so I'd say touche. (I won't go into much detail to these, as they are there en masse.)
There are also games like football, basketball managers, or stock investing games. I have not so much experience with those, but maybe some day. My favorite of the nonstandard bunch is Slavehack. Make sure you check it out.

Having played lots of different games and analyzed them, I can provide a small list of what makes games addictive and what makes them just plain good. I made this list with help from some friends, so it's not purely my own opinion. Keep in mind, that these points are meant for game developers, or probably those who want to start developing these kind of games.

What is addictive?

1. The simulated passiveness.
If you are a vivid player of these games, you may see that all these pages are saying that you can play when you want and how often you want, so you can play it just when you are hungry for some quick game. Together with some ridiculous build times for buildings and units if you compare with realtime strategy games (Warcraft 3 ~1min, Travian ~30min, other games go even as far as to caculate build times in days), you have a truly passive game. However, as you may notice, there are only few players who actually play it this passive way. Most of the people I know just sit around all day pressing F5 or start integrating themselves into a community. Your just plain passive game gets absolutely active. Once somebody else is say, attacking your base, from a simple 20min building plan you may start to use these resources to add some more soldiers. After the fight you start to build again. If you haven't got the logic behind it: A player may wait 20 minutes, but he checks every 5 minutes if he should change his plans to something more defensive or not.

Now you have the completely unintentional effect of your browsergame being actually active. And here lies the trick: The user thinks he can play where and when he wants, but in reality he is constantly thinking about how to defend himself on a possible attack and integrate into the guild more to get a good defense shield, whatsoever. This is of course only an example, but it already tells how far a game can go.

2. PvP and Social Networking
Most of the browsergames include some kind of PvP system. This is most of the time even the essential part of getting forward, even playing the game. Strategy games emphasize creating guilds and raid other guilds and their bases, and even RPG games these day must include some form of PvP. The kinda addictive game Duels mentioned earlier is on a complete PvP basis, as there are only a few bots to fight against, and the rest are players to get your experience from. This creates, contradictive to the name "Player versus Player", a stronger bond in the community, and you have a sense of progress and may get a ridiculous amount of self-esteem. However, PvP does not only mean fighting against each other. There are a lot of forms of PvP.
  • Trade. A good trade system can make the difference between sucky game and good game. As far as trades go, they have to be easily accessible (maybe only with an upgrade to mark the status of entering the community?), and easily understood. Some games seem to implement a trade fee to stop swapping items back and forth, but this just hinders the gameplay, and you just often see in those games that the trade system does not flourish as good as it could have. A suggestion of mine is to make user created items of high value to keep everyone interested, but more to that later.
  • Leaderboards/Highscores. This is probably the oldest form of PvP. Who doesn't remember the unbeatable highscore in the arcades from yesteryear? This concept got in the fast few years more popular, as it was lost for some time, but came back with huge success. People love leaderboards, and the more you have the better. Have a overall leaderboard. Have a leaderboard for all classes/races you have in your game. Have a leaderboard for your guild. People love them. Give them what they want. Just make sure it's really not just one, as a big leaderboard with 100.000+ users can simply scare people away.
  • Ego. There is always the factor of "my stuff is better than yours", and the more diversive your items are, the harder the good items can be obtained, the better this effect is. However, they should still be obtainable, we don't want implement a hard scripted AI fight, just to have everyone get their army killed there. There is also something, which can be easily implemented into any game, and can even make lots of fun to do: Ranks. Say if you have enough experience you gain the rank "soldier", or if you complete a special event you gain the rank "walrus". It can be completely nonsense, but if you have a player asking another player how to get that rank and if he actually starts questing for that rank, the game designer wins.
  • Fight. This was already discussed, but it's for most people understood as the primary form of PvP, if not the single one, which is kinda sad.
PvP can be very diversive, but PvP is nothing without something like a cooperative mode. Group play can often be a huge reason to play a game, and game developers should often encourage group playing, as for example give away bonuses for large groups or something like that. People will get together, stick together, and most importantly: the player can make friends, and get even more addicted to the game. Everybody wins! Group play should be a main focus for lots of the games, but most seem to miss this one. If you are a browsergame developer, please make sure you don't forget this point next time when you're imlpementing a new feature. It can catapult your game from a playable state to sheer awesomeness.

3. Clever backstory, but...
Most of the games have a quite complex and interesting story behind them, but lets be honest. Who reads that stuff? You can do that when you're waiting to get some buildings done, but even then you won't spend more than 5 minutes on a nice, but several tome long story. Luckily, most games seem to understand this and offer a nice alternative: Have a story, but don't force the player to know it, or even understand it. Gameplay first, and the story should just support it. Give the player the choice to read/understand the story, or just play the game. We want something addictive, not something that needs to be read first. RPGs can get a bit deeper than strategy games for example, but that's only because of their storytelling-like nature. In the end of the day the game with the easiest to pick on gameplay wins, so don't pay a writing team if you can get some additional programmers to make your game even better.

4. Customization, or just standing out of the crowd
When you play a game, do you want to be like a sheep, the one which is just like all the others with some different hair? No, of course not. (There are exceptions, but pleaaase) Strategy games have their method of having the player decide which unit or building they want to upgrade and so support the guild their in. Some people in the guild provide defensive units, the other ones offensive, and by swapping some of them, the players not only get significant roles in a guild, but also a quicker and better way to get a full hardcore army for kicking some asses. That's just a basic level of customization. In fact, when one says "customization", the others don't have the image of building or skill trees, but putting a logo onto a spaceship or such. If your technology allows that, put it in, but for example being able to design your own spaceship out of different parts into a decent fighter can be much more fun and engaging. If you have such a significant feature, make sure the user learns it early, so one does not get bored until the point when he finally "gets to the awesome feature they write about everywhere". What a big nono for customization is, is a customizable UI. The UI should everywhere be consistent. Not only is there lot of development hell associated with it once you upgrade your game, but if somebody for example shows a screenshot of your game, you lose the possibility for fast recognition. You don't want somebody in a "Your Game" related forum to post "Woah, which game is this?". However, if somebody makes a Greasemonkey script or Stylish css style, make sure you track the popularity of the modification, so you can possibly add the most popular features to your own version of the UI.

5. Accessibility
This one should be the most obvious, but it's not. Often game developers create their games with no obvious introduction whatsoever. Most of the time it's just a lame link to a forum post where somebody states that you should do this, that, then that first and then you'll see. The user shouldn't even leave the game to get this information. He could maybe get a dramatic message with "we are crash landed on this site, let's make sure we have enough energy supplies", which also generates a quest. (More to that later) Players automatically engage the whole system and start to understand it. Thankfully, in the last years this point got more attention, so you can see fewer games implementing this cumbersome style. In the course of the game every new element to the gameplay should have a short explanation of what it does and how to successfully use it, but don't overwhelm the user with too much information. Sometimes even a label with a quick explanation and a link which throws a popup where you can get more information is sufficient, but introducing the gameplay while playing the game is much more immersive, and well.. addictive.

These points are just to make the game more addictive, but you can't have an addictive game without actually having good gameplay. Which game you will make is still your descision, but here are a few pointers which may help you play your game even better.

What feels good?

1. A living, breathing, changing world
In browsergames you have the possibility to create lots of environments without much graphics by just using text. You may be on a planet, and an indicator for "It's raining, grain generation+" can always make a player more happy. Some browsergames implement some sort of map, where every planet/building/field has a different color code to quickly distingish which type of environment we have here and what we can do with it.
Very clever developers may even implement a day/night cycle into their games, where at different daylight times there may be different events or even some new gameplay options (for example a black market for stolen equipment). The possibilities are endless, and the player gets a feeling that the world he plays in is real. If the NPCs don't only fly around, but if you say have a bad reputation with the pirates and they start attacking you often, you succeeded in making a living, breating world.

2. Analyze how people play, evolve around it
This is actually very hard to pull off. Say the players found some workaround on how to do a thing easier, and you as game developer don't want that sort of thing in your game. Stop. Make sure you discuss that with the players. Why did they do it the easy way? Was the original way not fun enough? Does this new way actually support game play? Also, say if people always go kill in an RPG in some zone where some weak monsters drop good items. You may modify the zone monsters to drop something less powerful, but you can place a hard to kill boss in there, who drops even better items. So people now not go kill alone these small little useless monsters anymore, but may switch to a new target, and for example even finally form groups.
Also, log as much as possible from the players. Don't invade their privacy, but check out which skills get used the least, which one more often, and then you are able to balance them out, if you please. Before any change though, make sure you talk with your already established player base, but don't be too soft on them, as you may do something that is good for the overall game.

3. Achievements
Oh yes, the fun part. Todays game always seem to have some kind of goal tracking system. It's fairly easy to implement and absolutely supports the way how people approach that game. There may be very easy achievements for everyone, and some hard obtainable for hardcore gamers. These are as easily implemented as ranks, so the more ridiculous, the more fun you will have developing the game, and the more fun the players will have playing it. Some addition to this achievement system would be to have them to have different levels, so you may get a bronze badge if you kill 10 monsters, and can upgrade it to silver if you kill 100 monsters. Achievements should be easily viewable by everyone, so players may ask each other "wow, how did you get THAT?" and that is one form of social networking which is very pleasant to everybody.

4. Everything should just feel overpowered, but not actually be overpowered
This may sound strange, but it actually can also differentiate between a good game and a mediocre game. This is actually a point where each game has to find the perfect balance point for itself. For RPGs for example you can have a powerful skill in one minute, but in the next you are overwhelmed by a very strong enemy, so you upgrade your skill to take that enemy down. The curve has to be steady, but not too much.

5. Quests are good for you
Now this is just one part which everyone likes. Somehow people like to have goals and at the same time float around and do nothing. With a quest system you can have that freedom of doing nothing but still everything. They can even keep a player stuck to that game if his friends for example are all offline. Quests should have a nice descriptive text, but the quest message should always have a short explanation of the quest for quick reference as well as a peek at what he gets when he completes the quest, so the player is actually motivated to do the quest. The perfect quest is a quest chain, where the player has to find a larger group of players to get the last reward. A friend finder this instant! Sadly, I played some games, where you get only 5 or so quests when you start the game and that's it, only 3 more through the whole course of the game or so. It's kinda strange to see that, especially if the game revolves around doing the same thing over and over again. Quests can give that diversity the game probably needs. If one stays all the time in his base, a quest can move the player to attack an unknown zone, and so explore even more gameplay possibilities.

So that was my small article on how browsergames work and how one could improve them. I was very sleepy while writing it, so please excuse any errors you may encounter. I also hope to see more games to implement some of these features mentioned here, as that would help us to see games of even better quality.

May 17, 2008

Ubuntu 8.04 on the Eee

Recently I saw a website about Ubuntu on the Eee PC, and I thought hey, why not install it? They said two weeks ago that they will release the whole package, but then they got wifi driver problems and so the release was delayed.
I grew really tired of using my Xandros-based system, with upgrade-complicated unionfs and quite old software, thus I was really willing to do the switch to anouther operating system, especially Ubuntu.
Anyway, now I am using it, and I can really recommend it to others. There are (at least on my Eee) no problems whatsoever, and even Compiz works very nice out of the box, which was impossible with Xandros.
Anyway, once I installed it, I also had to do some tweaks to make it perfect for my Eee (most of the stuff can be found on the hardy configuration page, but still look for what you really need when doing the configuration), and that used up a half hour of my time, which is quite fast for a complete configure for a PC. Then I could start the tweaking, which I personally looove.
Even though it is awesome, the better system does not come without a price. The system loads up significally slower, but not as slow as some youtube videos where Ubuntu loads almost 2 minutes. The system is still usable after a short amount of time, and it works really nice.

That makes me think.. Why even bother with the default system and not install a system, one is familiar with like Fedora or Ubuntu. With some simple tweaks you can get not a crippled system, but a full working, complete system, with a real good userbase and regular updates (unionfs made updates eat up too much space). After my install of Ubuntu (I made a 256MB swap), I had 1.5GB free space, which was even a bit more than Xandros gave first. With removal of additional programs, I had now even more space, which was impossible on Xandros.

Anyway, as you can see, I am quite happy that I installed Ubuntu, and I recommend it to any other EeePC user, who is unhappy with his default system.

Right now I am at Ubucon'08 in Lithuania, which is quite a nice experience. I haven't thought there were so much Open Source supporters here, and I will probably go again next time. I even got a free CD with Baltix, which I will try at home, just to see how different it is from the standard Ubuntu distribution.

Next time I will finally talk about my mapeditor. (screenshot above)

(logo made by waffel)

May 3, 2008

What's up in the mobile MMO world?

As many of my readers probably know, I am developing "Mornomia Mobile" (codename), an MMORPG for mobile phones which simply have J2ME (Java) and possibly even a low resolution. It is made to run on low end platforms, with a flexible codebase to automatically adjust even for high end phones. This provides a maximum possible userbase for a quite high-spec'd genre.

But developing such a game also requires to know what other products are there on the market. For that purpose I did a research on some other mobile MMORPG's to find out what these games have to offer and where Mornomia Mobile can improve, if it even needs to improve, based on our current concept.

1. TibiaME
(Symbian, J2ME)
The only one really similar to Mornomia Mobile in terms of 2D MMORPG. TibiaME has a simple real time combat system, has two classes, allows interaction with NPCs, like quests, and some other features. I would really play it longer, if it had just a little amount of... depth. Yeah, it plays a little weird. You just walk around, and walk against stuff. Thats the main interaction of this whole game. The combat system is really basic, as in "You have a weapon, you kill stuff" basic. Getting quests is also not so enjoyable, because the text of the NPCs displays too slowly and sometimes you can't even skip what they say. Also a hassle for the first time user is the really weird GUI ingame. It's so weird, I can't even explain it. Just try it.
That said, the community seems quite large, and they are still expanding the game, so even if this game has flaws, I recommend to try it out. Even if it is just for checking out how mobile MMORPGs look and play nowadays.

2. Shadow of Legend
(PC, Windows Mobile)
This one is quite interesting. According to the website, players of the PC version can play simultaneously with mobile devices and vice versa. This is accomplished by making a complete port of the game to a mobile device, which was quite a nice idea. I imagine playing this game at home,and when on the road with my mobile phone. These possibilities are quite nice. I would try it out, if I had a mobile device (or the PC version if I had a subscription). The game seems quite feature rich, with some races and classes to choose from, and it even looks like it has a decent combat system. But then, a Windows Mobile device is almost a full working PC, so this should be the minimum for such a type of game.

3. Old Wish III

A Chinese MMORPG. Even though the Koreans are known for developing a lot of MMO's, this time a Chinese company got first. The game looks really nice, with nostalgic SNES-like graphics and a round-based combat system. I haven't played this game, but I believe it's quite good, because according to the publisher, it has 300.000 registered users, which is quite an accomplishment for a mobile MMORPG. Any additional info of this game is very hard to get, even though I would be very interested in a feature list or other possible information.

4. Era of Eidolon
Less realtime MMORPG than a strategic RPG. There is no real overworld to walk on, as there is only a town with some buildings you have to select. You start pretty basic, as you just have to go to the arena and fight. This staright-to-the point style is quite nice, if it only was realtime. Apparently they have about 200.000 users, but the last update they had was on October 6th. And I don't even know which year they mean. The idea of the game seems nice, and the roundbased strategic combat system is a good design choice considering the low-bandwidth and hyper-laggy mobile world. This was the only mobile MMO with a page to try it out first.

It may seem strange, but many of the mobile MMORPGs that once were (Era of Eidolon, Sphere..) ceased to exist, or at least at the time when this post was written, down. Comments I could get about these games were that they sucked and/or had horrible bugs. As with Mornomia Mobile, the server nears the 3.0 status, as my second rewrite progresses. The rewrite is now gameplay-centered, not connection-centered, to allow faster modifications of the game itself, and so enhance the playability. For example, instances are now implemented very nice in the server, without any needs for change of code in the client whatsoever. Implementing instances is very nice, as you can also include single player elements in an MMORPG, and such enhance the experience and fun of the game. And I won't even start talking about replayability...
As you could see maybe, was that the combat system for me in a MMORPG has highest priority, and I really hope I can reflect that in Mornomia Mobile. In fact, should and will not differ too much from a standard MMORPG for the PC, at least that's the goal.

The next post will possibly brag about the new mapeditor, but I guess the post won't appear soon, but we'll see.