Going multi-platform, part 3 : First throwback

Last weekend I worked on getting the lazarus / free pascal build of “Phase 2” to look and play exactly the same as the delphi build. I had to change some small things here and there, but after a few hours you can now no longer distinguish between the two builds, maybe except for performance. It looks that some stuff that’s pretty fast with delphi is kinda slow with fpc, for example accessing stringlists and stuff. But that’s nothing that can’t be easily optimized, so the first goal of getting the different compiler builds on par is done. This also means that the game is fully playable under linux.

But during my playtestings on linux (I ditched my ubuntu installation with it’s horrible ubuntu one interface btw., and now use mint) I noticed that all descriptions of nations, units, technologies, etc. were missng, as well as the whole credits text. And after hours of debugging, checking encodings, creating test applications, etc. I found out that NativeXml is not able to load text contained within XML nodes on linux. So a node like this :

[xml]<unit name="test">
<description>This is a test description</description>
</owner>[/xml]

Will return an empty node value on Linux. No matter what I tried, accessing it directly, via the first childnode, etc. it was always empty. At first I thought I’d be doing it wrong (though it worked fine on windows), but then I did a very simple test that failed : I loaded up the XML with NativeXml and directly saved it to disk afterwards. And guess what? All texts within the xml nodes were removed by the library!

So it seems that I can’t use NativeXml for linux due to this severe bug. Their forums seem dead (registered there the weekend, but haven’t even been unlocked there so I couldn’t post the problem), and finding people that use it for linux is almost impossible. So all the thousands of lines of code I replaced to get the xml stuff to work on windows were just a waste of time, and I’ll have to remove this library again. I took a look at other xml libraries, but most either only supported delphi or were too bloated (dozens of units, huge source files, different dependencies, etc.). But well, that’s part of the learning process that makes programming so much fun (and sometimes so frustrating), and for the next external library I’m going to use (I prefer to write most of the stuff myself anyway) I’ll first check and see if it works on all my intented platforms.

And what now? Is the linux port in danger? No, rest assured, it’s not! Instead of relying on an external library for loading and saving xml I have written my own xmlwrapper that abstracts free pascal’s and delphi’s different xml interfaces into a single structure that I can use in my game (and coming projects). So now I load up an xml document via my own wrapper and compiler directives control wether delphi’s xml interface or free pascal’s DOM is used to fill this dynamic xml structure from the given file. The syntax is leaned towards the style of delphi’s xml implementation and parts of the game have already been changed to use my new xmlwrapper. So in my code it looks like this to get values from the xmlwrapper :

[delphi]VFS.LoadXML(‘data\xml\nationinfo.xml’, TmpXML);
for i := 0 to High(Nation) do
begin
Nation[i].History := TmpXML.Root.NodesByIndex[i].Nodes[‘history’].NodeValue;
for j := 0 to LocalizationDB.LangID.Count-1 do
Nation[i].Name[j] := TmpXML.Root.NodesByIndex[i].Attributes[‘name_’+LowerCase(LocalizationDB.LangID[j])].AsString;
Nation[i].Stronghold := TmpXML.Root.NodesByIndex[i].Attributes[‘stronghold’].AsInteger;
with TmpXML.Root.NodesByIndex[i].Nodes[‘basefactor’] do
begin
Nation[i].BaseFactor.Growth := Attributes[‘growth’].AsSingle;
Nation[i].BaseFactor.Loyality := Attributes[‘loyality’].AsSingle;
Nation[i].BaseFactor.Ressources := Attributes[‘ressources’].AsSingle;

[/delphi]

So much for an open source xml library that was supposed to work with linux. So I guess this weekend will pretty much look like the second last one with me replacing lots of lines of xml-related code 🙁

Going multi-platform, part 3 : First throwback

Weekend posting

It’s weekend and my last posting was almost a month ago, but don’t worry, I’m not idle at all. As for “Phase 2” of Projekt “W”, I finally got around writing the manual to it, and while doing so I noticed that it’s actually pretty hard to write a manual for such a complex game. And even worse if it’s your own game, as it’s extremly hard to write a manual that can be used to learn the game by someone that has never played it. So this is a pretty tiresome process that takes a lot of time and patience. But I won’t get around this and I think it doesn’t make any sense to release a beta to the public without a manual on how to play it. Though this time it won’t be a single PDF as it was for “Phase 1”, but instead it’ll be an HTML manual that I’ll also upload to this page so people can take a look at it online, since it’ll also include the technology tree, unit types, building types etc.

In addition to that I also finally found a good foundation fo the whole datanet espionage (and sabotage) part of the game. I’v been dodging this for months (or even years), as it’s almost a completely new game inside Projekt “W” with a lot of stuff to implement. The first parts of this are already in the game and it’s looks like this could become a valuable addition to the game’s other new features that people will use often. You’ll be able to get a lot of data from your enemy nations, but not without a risk and you can even sabotage stuff like their research or global projects.

And as you may have heard, Embarcadero have released a new Version of Delphi, XE3. And once again they decided not to include our up-to-date OpenGL headers and instead went again with their old outdated one. So if you want to see our headers included in Delphi and own an EDN account, you may want to vote on this report. As for XE3, it’s pretty much what I expected (tested the trial in a virtual machine). If you do OpenGL-related stuff or are into game development, you can easily skip and stick with your old version or move (if you haven’t) to Free Pascal and Lazarus, which would be my choise anyway if I’d were to start a new game. And yes, I’ve been thinking about porting Projekt “W” to Free Pascal so I could port it to at least Linux (and maybe MacOS), but that’ll be a lot of work, so that’ll have to wait until after the beta.

Weekend posting

2010 – Final posting

Welcome to my last posting of 2010! I haven’t been doing regular yearly recaps on my blog since launching it like 5 years ago (time flies by, eh?), but I think it’s a good idea to do a little recap on what happened in 2010 and on what I plan to get done in 2011. Please note that this posting may contain some personal notes and/or ramblings of mine!

2010 in general was a very busy year for me, but sadly not when it came down to coding. Real life is taking away a lot of my precious time, and I often think about how life would be without all those little unnecessary things in our western world that make you waste time on stupid things (I mainly refer to all the administrative stuff like finances, government, vehicle-related things and all the hassle I had with the fubared health inssurance company of my grandfather). If those were left out, people would have much more time concentraing on more important things like being creative, as in my opinion every human being should do something creative (may it be inventing things, coding games, building something, etc.), which is sadly not the case for the majority of humanity. Maybe this is not only down to all the little unnecessary things in life that distract you from the essence of the human being but also because our mostly degenerated culture seems to have forgotten what life is about (yes, life is not about wasting all your time at work/in front of a TV until you die). Sad but true.

But still, “Phase 2” progressed a lot in 2010. A lot of the planned features are in, there is a whole new GUI and all the people that saw the game in action (either on youtube, or in real-life at my home) liked it and often even asked if it’s a commercial game. Just recently I also got around adapting the new GUI to some of the game’s windows like the transfer market (which got a complete overhaul), and currently I’m in the process of redoing and updating the whole espionage feature of the game (if you remember this will be one of the features that’ll get a lot more functionality in “Phase 2”), which is taking a lot of effort but progress is steady, and espionage is one of the biggest features that’s still unfinished. So once it’s done this will be a big step towards the final release.

As for 2011, I hope to have at least a (more-or-less) final beta of “Phase 2” ready for public testing and (mainly) balancing. For “Phase 1” many people complained about bad balancing, and so for “Phase 2” I want to conclude a (maybe public) beta test in order to get the balancing right, as balancing is one (if not the) of the most important things in a game.  I don’t have a date yet, cause depending on several factors it’s even possible that 2011 will give me less time for coding that 2010 did. But don’t worry, I have no plans to cancel Projekt “W” anytime soon, as it’s actually becoming more and more like my swansong. Though I hope to code games after it’s release, so don’t take this statement too serious, though I don’t think I’m ever going to do such a big game again (or at least not alone).

In terms of gaming, there have been many games I enjoyed in 2010 (I prefer gaming after a day of hard work over watching movies or even TV), but only a few of them stood out. My personal game of the year is, without a doubt, Heavy Rain (PS3). This is the first real mature game I’ve played, telling an interesting mature story, using very interesting gameplay mechanics and having characters with real depth AND all of them have problems of some kind.  It’s nothing like all those stupid Call of Dutys out there with their braindead tube-like levels, childhish storys and oh-so-perfect american soldiers. And despite all odds Heavy Rain sold much more than expected, and so we’ll hopefully get another game from it’s makers. Though it’s still sad that the CoDs, MoHs, Halos and so on sell much better than a fantastic game like Heavy Rain. I think this should be a warning sign for the whole gaming industry, cause it looks like a huge shooter-bubble ready to burst (like the music game genre did this year). Other than Heavy Rain, I was also impressed by the recent God of War III (Greek mythology shown the way it’s supposed to be with a total badass character), Red Dead Redemption (Rockstar sure knows how to tell good storys in open-world-games, and the ending is just pure genius), and currently I’m also enjoying Gran Turismo 5 (yeah, I really like sim-racing, I’ve been racing on PC for years using a Logitech Wheel and the racing mechanics in GT5 are awesome, though it’s far from the perfect game that Mr. Yamauchi promised us!). My personal disappointment of the year was Final Fantasy XIII. FFXIII shows the state of the japanese gaming industry, trying to open up to a western audience, resulting in very bad games.  With the exception of one chapter the game is like walking along a single predefined path with some rendered sequences thrown in here and there, a boring fighting mechanic (just take a look at Resonance of Fate, a JRPG with an extraordinary good battle system and and interesting setting), and the first 20h feel like playing some kind of tutorial. It’s sad, and after recently revisiting FFVIII on the PC I noticed just how bad it is. Maybe they should take a look at Demon’s Souls, hands down the best RPG that came out of Japan for years (followed by 3D Dot Game Heroes from the same developer and Resonance of Fate from the Star Ocean creators).

So that’s it for 2010, therefore I wish all of you a happy new year and we shall meet again in 2011 (as long as Cthulhu doesn’t decide to wake up from it’s eternal sleep to devour us all…)

2010 – Final posting

100k visitors and some Projekt “W”

Since relaunching my page with WordPress back in march 2007, there have been over 100,000 visitors to my page. Although this does not sound much at first, I guess it’s pretty good for a personal page (together with the fact that there were roughly 75,000 visitors to my page before that relaunch) and I hope that all those visitors enjoyed my projects, demos, applications and tutorials. And for those interested in numbers, I just saw that the traffic generated by my page for the first five months of 2008 (including views and downloads) has topped 1.5 terabytes, with most of the traffic coming form downloads generated by my games. In my eyes this is a nice summary, and I hop that it’ll continue like that!

And now back to my current work, “Phase 2″ for Projekt “W”, this time with some stuff from behind the scenes (aka the code, mostly this will only be interesting for programmers) :
You may remember the battle selection screen I’ve been showing off that’ll allow you to select if you want to battle it out yourself (on the hex-based battlefield) or if you want to have it simulated. One not-so-easy part in terms of coding was to implement this for when the AI attacks a human region. The AI itself is placed in it’s own unit (ProjektWeltherrscher_AI.pas) and has several procedures and functions for doing construction, army management and so on.
As with most AIs out there, the one in Projekt “W” is using a lot of loops (and is basically a finite state-machine) and within one of those loops it attacks enemy nations. In “Phase 1” there was no problem as it would only have to simulate the battle and output a message to the player’s message log. But in “Phase 2” the player should be able to choose whether to fight manually or to simulate the battle, even if he is attacked by the AI (and not only when the player himself is attacking a region), which meant that I somehow had to add a way for the AI to change to the battle selection screen without breaking out of the AI’s loop.
But this AI class is now used by the game’s main class (located in ProjektWeltherrscher_Global.pas), which means I can’t access the game’s class from the AI’s unit (this would be a circular reference, something not allowed within Pascal/Delphi), but I didn’t want to sacrifice my clean project structure by just moving the whole AI class into that unit in order to be able to access the game’s class from the AI.
So after a lot of thoughts on how to deal with this, I decided to go for a simple callback function. Most programmers should know what a callback is, it’s a function that is declared like a variable which can be assigned. So now the AI class has a callback that is assigned from the game’s class (remember, the game class can assign the AI class, but not otherwise) and that get’s called whenever the AI attacks a human-controlled region. That function now switches to the battle selection screen, waits for the player’s choice and then opts out to give control back to the AI loop. It’s easily implemented, but not often very obvious and a lot of programmers get headaches on how to solve such circular references, so hopefully this will help one or two of you guys out there!

100k visitors and some Projekt “W”

New page

As you may have guessed from the complete new layout and design I redid my homepage (again, this is the sixth iteration since I went only 4 years or so ago). My old web-package only included 200 MBytes of webspace and that hasn’t been really enough to hold all my projects which forced me to delete old things when uploading new stuff. And therefore I decided to upgrade to the next bigger web-package with 1 GByte of webspace but this one also includes MySQL (5 databases) as well as PHP.

So I also decided to get rid of a static HTML website and move on to a dynamic page that’ll allow people to comment on my stuff like projects and will make updating and adding content easier. To help my with that the page is now running WordPress (which is a great thing and I therefore want to thank it’s authors), and I’m using it not only for blogging but also as a CMS to e.g. organize downloads. So that also means that I won’t update my old blog anymore but instead blog on my own page from now on (and news on Project “W” will be coming within the next days).

But converting all the old static content over is a lot of work (and there is a lot of content on my pages) so there is still a lot missing here. Therefore if you need some of the content of the old page you can’t find here, please visit the old page over here. It’ll remain online until I moved over all content.

New page

Some infos about gamedesign

Maybe some of you want to know how I do the design for my games, so I thought to write down something on this.
Note : I’m no game designer and I never work
ed on commercial titles (though my freeware games and apps are rather successfull), so take the following stuff as my personal view on this matter, don’t cite me on this in a fiery discussion or so.

Most important notice about gamedesign :
>Your PC is the most dangerous enemy of creativity! <

Why you ask? Plain simple : you can do so much stuff with your PC (surf the net, read mails, play games, watch TV, listen to music, and so on) that it’s v
ery easy to get distracted. So it’s (at least for me) often the case that I try to do some gamedesign and then think “ah well, you haven’t read your mails for an hour or so, just quickly do it and then carry on”, and then you also think “now that I’ve read my mails I should take a quick look through some forums” and this goes on and on, and at some point you notice that you have your game design document open for hours, but haven’t written down a single line. And what’s even worse is the fact that due to all the distraction your mind usually won’t be able to spill out great ideas for your game. All my good ideas came out of my mind when I turned away from my PC (just switch the screen off) or was doing something totally unrelated. So maybe if you’re running out of ideas, turn away from the PC and try to relax or do something else, as the ideas then tend to come in by themselves. But don’t forget to write them down later!

The best tool (or call it “application”) for game design :
>Plain Pen-And-Paper<
This goes directly together with the above point. The best tool for doing game-design related stuff (may it be writing down ideas or drawing graphics) is a piece of paper (or a memopad, so that your stuff won’t fly all over the place) and a pen. At least that’s how I did all GUIs for my recent games, and most of the time those designs made it (with small adjustments, on paper I only do rough outlines with descriptions) into the final game, and that is also the case with my current game. Now you could also do all those fancy drawings in applications that were designed for this, like Photoshop or Corel Draw, but you’ll mostly suffer from what I wrote above. If you do those designs on paper it’s like a flowing river, you start drawing and the ideas start to flow through your head, go down your arm and drop onto the paper via your pen (literally, don’t take this too serious 😉 ). Something that usually won’t happen when you sit in front of your PC after you have opened up your favorite drawing application.

So much for now, hopefully some of you also see the above things the way as I do!

Some infos about gamedesign

Back again

Well, after a bigger break I’m back at coding again (at least hobby-coding, already did some “serious” coding during the last months) and I have started to work on something new that’s actually rather old :
Back in 2003 I started on a roundbased strategy-game and wrote a rather big design document and also made a working prototype (but with no actual gameplay in it). But soon I realised that the design of this game was too complex (both in terms of gameplay and in terms of content I had to create), so I dropped it.
But some days ago I read through the old design document and decided to stream-line much of the gameplay and content, so that it’s more fun to play and that my chances of finishing it someday are much bigger than with the old concept. But for now I won’t reveal much more, except for this mysterious screenshot (click for some bigger view), maybe some people know at least a tiny bit about this project.



Stay tuned, I’ll have you updated on this. And I also plan (after finishing it) to do a write-up, where I also want to tell a bit about the process of streamlining my first game design to make it more interesting, as this is the first time I did such a thing with an older project of mine that I initially wanted to stop forever.

Back again