Limegarden.net Personal site of Wouter Lindenhof

29Jun/100

Lady luck is using a loaded dice…

The one thing that I didn't backup was Outlook. My email is handled by GMail and since Outlook also syncs with my mobile phone, I already had a backup of my mail and my contacts.

So being the adventurous type I decided against wasting my time and do a proper backup. Well, today, when I wanted to call someone, I found out that all my contacts had been wiped from my mobile phone and as a result my backup was gone.
I suspect that it has been my own fault, but based on the bad luck I'm having lately I'm suspecting Lady Luck to uses loaded dice to decide my chances...

25Jun/100

Wierd evening

Today went well, as far days go, that was until it hit 11 o'clock (I had been watching the football match between the Netherlands and Cameroon, which we won ;) ). I went up to my room to see if my laptop had completed some maintenance work and was surprised to find "The computer has been recovered"-message which is signal that something has gone horribly wrong. Clicking 'Ok' caused it to reboot and after swiping my finger (gotta love the fingerprint protection system) the computer logged in and Bang! Blue Screen followed by a reboot after which the computer tried to recover again.
I decided to let the computer have another try before I would try and find out what was wrong, but needless to say, this rant is not about how happy I am that it has been fixed but that I didn't complete it.

To make a long story short I decided that it was quicker to just reinstall everything so as I was busy back up, my mom asked me to pick up my brother who had gone party. It was already the next day (it's now almost two in the morning) and to my suprise I found out that my bike (who he borrowed) was suddenly a folding bike and I'm prety sure that was not possible when he left. Apperantly he had to evade something which caused him to ride in to a low wall. The result: Bike broken and my favorite brother had a few scratches.

So now I'm reinstalling my system for the first time I bought it (almost four years ago, which is a record) and I'm without a bike. If the sky would drop on my head right now I wouldn't even be suprised. :-D

Tagged as: No Comments
22Jun/100

Only one more day

Tomorrow I will be defending my graduation work and if all goes well (it must be a strange turn of events if doesn't go well) I will know if I have completed my graduation.

Only one more day :)

9Jun/102

Reverse updates

It has been a while since I last posted something, but that is because I have been busy with my graduation (in case you were wondering).

Anyway, today, while I was walking the dog, I suddenly realized how to fix a bottleneck for a certain game idea. The game idea was that the hero can interact and affect lives of other characters in the game directly, the bottleneck however was that each character affects another character, which affects another character and so on. A simple example would be if you decide to buy a weapon or not. If you do buy a weapon the merchant will be able to stay in business, buy some bread. When he buys bread, the baker will be able to buy the next shipment of grain from the miller and the miller we be able to pay the farmer and everybody will be happy. Now if you don't the miller might not be able to some bread (he needs to eat also) which means that he goes out of business. Since he is the only miller in the entire region, there will be no more bread for quite some time and everybody dies from the hunger.

The problem with that game idea is that if you even simulate a small village (say 25 people) you will have a lot of relationships to go through. Even if it goes in one direction it will still be 1 hero times 1 person times 25 people times 24 people times 23 people et cetera. The total amount of relationships within the village would be 1.6E+25 (16 with 24 zeros behind it). Even if we say that any action will have not have any affect after 7 relationships that would still be 2.4 billion relationships that are affected. If we limit the amount of relationships to 7 for each person (so 7x7x7x7x7x7x7) it will be 823543 of relationships that need to be updated when the hero does something. And maybe one of those persons affected will need to perform an action that affects the community which means the entire process starts over again.

Of course the game is real time and the other people in the village don't require you to perform any action so if you have 3 or 4 villages you will have almost a constant rate of large social updates. Until this morning it was my firm belief that the above game idea should be hard if not impossible to execute unless you have some monster system.

I always thought in forward direction, what happened now dictates the future, until I thought about reversing the flow, the past is dictated by the future.

Lets take the previous example of buying a weapon or not. Although this is a fact now by the player, the game does not have access at that information at the current time. Let's say you meet the miller and find out he is alive. No matter what happened in the past, the future dictates past events that no matter what the miller survived and kept his job. And the only way that he has kept his job if the baker bought his grain and the only way that the baker could buy his grain was if some paid for his bread. If you made a major investment by buying a weapon (say a gold weapon) then he might credit you for it. If you weren't the cause something else must have happened for the influx of money that allowed the community to stay alive.

Now lets take the same example but the miller is dead. The past generated from that point on could dictate that the hero not buying could have caused it. Or if he did buy the past could credit something else (disease, war, bad crops et cetera).
So what is so different about the reverse update compared to the forward update that it allows us to compact information in such a manner that the above game idea is possible?

Simply put: Forward updates are simulations, calculating exact future behavior, while reverse updates are emulations, imitation of past behavior. A forward update always has one cause (generally the hero) but has many effects (the merchant, the baker, the miller and the farmer). A reverse update has one effect (the baker) and will look for one cause for its current state which is a linear path.

I'm not certain if the solution always works as the past needs to be consistent (you can't undo the past) and certain actions always have a forward update, but for now the game idea seems possible again.

26Apr/100

Evil dutch internet law proposal

This morning I got a mail which was about a dutch law proposal. In the mail it said that the proposal basically means that you need to pay more when you download certain things from the internet. (the proposal can be found here however it's in dutch)

I haven't read it as I don't know the original and basically 21 pages of legal stuff is not what I see as entertaining. But after asking around it seems that the dutch government wants Internet providers to split. If you want access to certain things (like filesharing) you will need to pay extra.

Besides the fact that this is entirely evil, I only wonder "why?".
Does the government (because that is where your money goes) need the money so bad, that they think of this?
Or is it because to counter file sharing?

In either case there are tons of ways around it and besides: File sharing is legal. Sharing files you don't have the rights to (like the latest movie) is of course illegal. But using bittorrent, DC++, emule, IRC, Kazzaa (god forbids) or whatever tool you use is legal. Uploading material which you don't own (the "legal own" not the "physical, I-have-it-in-my-hands, own") is also not legal, and that seems common sense to me.

But if this change in the law is accepted than it means that legal sharing (for example sharing huge files to the other office overseas) requires you to pay extra for it. Even a kid would think of this as unfair and any adult should know better.

Sigh, I'm ranting but the Netherlands is slowly turning in a police state, where it seems you have to proof your innocence. :S

26Apr/100

Large scene rendering

There is one thing I don't like about floating point and integers and that is that they consist out of only certain amount of bits. An integer is at least 32 bits (on 32 systems at least). A float is also 32 bits. A double is 64 bits.

Since I'm currently thinking about a space game, I was wondering how to create a huge battle field (a whole solar system) in real time while having all the precision I need.

Doubles are not fast and take a lot of space and although I don't worry about space, speed is a bigger issue. If I want a huge battle and here I'm going to throw some numbers: One side can have as maximum 85 huge ships, 3010 fighters, makes 3960 weapon slots, which makes 19800 bullets flying around. And that is only one side. Since I need two sides for a war, I need to double the values (190 ships, 6020 fighters, 7920 hardpoints, 39600 bullets). Lets say that everything is represented by one location (which a 3D vector) it would mean 53730 locations. 53730 locations times 3 would be 161190 and that times sizeof(double) would be 161190 * 8 bytes = 1289520 bytes (about 1MB) which is a lot to start with even if you ignore the fact that the problem is more that I have a lot than the doubles are bigger.

As I was considering the problem I realized something else. When I'm rendering, I will need to use floats. DirectX 9 requires floats and although I could send doubles it would half my data bandwidth. So what ever I choose, in the end I will need to use floats unless I want to have some penalty.

Using doubles for vertices are is a bad idea for the sake of precision alone.

But then I started thinking...

I don't need to render using doubles, I can simply render everything with floats and to ensure that precision is maintained. If something is not within the safe area of floating point rendering (let's say floats can have a maximum of 1024, and yes I now it can be a lot more) but the object in question is 2048 units away, I still want to render it. You can't simply let a sun disappear because it is beyond the range of your numbers, that would be weird.

Instead everything that is more than 1024 units away will be rendered first (farthest away first) and the distance also scales it down. Than I clear the Z buffer and render everything in the 1024 range.

1
2
3
4
5
6
7
Sun has a size of 100
Sun is 2048 units away
Sun needs to be rendered.

To render it but maintain the correct look:
Scale sun down so that at 1024 it would have the same
size on screen as if it was rendered at 2048.

It was so simple that I thought it was silly I never thought about it. How you scale it however depends on the view and projection matrix.

I'm still not certain if I want to use doubles, but for my second problem I have a solution. Now I need to find one for my first.

15Mar/100

The programmer IDE

Everyone in the game industry knows the console wars (also because it is a recurring war ;) ) but not many know about the editor war. The editor war was a war that played between two major editors (mostly available on Linux) which were vi and Emacs.

When I look at how code is written I always find myself a bit annoyed as the IDE (Integrated development environment) is basically nothing more than notepad with some extra features. Nothing wrong with notepad or the many IDE’s out there.

But I have always thought that code has one major weakness: Code is always written in a linear fashion. This is not inherent to only code, but a facet of how language works. In the majority of the languages we write from left to right and then from top to bottom. Some languages write in a different order, but always in one direction and then in the other.

I have always wondered why this has to be. Ok, I admit the fact that code is often a language (Like for example C++) but most languages have features like branching (if-else for example), and sub functions.

Recently I came across “Code Bubbles” and honestly I love it, it’s because I’m not a Java programmer pure sang (I did Java a long time ago), but this wants to me to make Java my primary language. Anyway here is a screenshot which demonstrates and I think any developer would applaud this.

8Mar/100

Broke the installation already

When I yesterday said that I don’t give Linux the 99.999% expectation to work I was not kidding. Just this morning I decided to use synergy and because I don’t want to run the command everytime I decided to add to the startup scripts, after some looking around I finally found how to do it and it was easy to understand, so I decided to give it a go. Once all the configurations were done I decided to reboot.

And then I noticed that something must have gone wrong somewhere. I simply get the console login instead of the graphical interface which I was expecting. Controlling Ubuntu from my laptop was of course also no longer possible (it was before, I have tested it). :(

So what went wrong?

Well, first of all I have been messing around with files I thought to understand (as a matter of fact I do understand them) however had I not done that the system would still have worked. Although the rule here is “If you don’t use it, it won’t break” is being applied, it is something a rule that remains true. In this case I did touch it and it did break.

Anyway I did a few more things I didn’t like so now I’m installing another Linux distribution just to see if I prefer this one.

Within a month I will get a netbook (a small laptop, that is actually too small to use) and then I intend to put some of my work on my current laptop on that. With a bit of luck I might actually set the laptops up in such a way that synergy uses thee laptops (oh and I get one monitor which I can use to increase the amount of screens to four).

Tagged as: , , , No Comments
7Mar/100

Installing Ubuntu on my old laptop

After cleaning up my room. I found one of my old laptops (which have been passed to my mother and back again) and wondered what I should do with it. It was my first laptop and although I don't intend to use it, I don't want to throw away a good laptop (well, there is a line of pixels who always have red on but that is besides the point).

Before I decided to install Ubuntu I wanted to take one last look at what my old laptop had stored on the computer. A wise thing since I came across a few old applications and some documents that all had some kind of emotional value. But more important I found my old music collection. :D

Copying my music collection from one computer to another wouldn't be such a big problem except that the library was/is around 10 GB. To give you an idea my current library is 27 GB which means I can let the music being played for almost 12 days before I encounter the first song in the playlist again. Anyway, copying from one system could be done in a few ways. One would be using an USB stick (which means I would to do it many times before everything would have been copied). The second method would be using the windows file shares to copy things over the network. Besides the fact that both devices are on wireless, the way windows copies a lot of files is not really fast.

In the end I decided to try something new: Bittorrent. Ok, I admit I have used bittorrent before but never to copy files from one device to another. Simply create a decentralized torrent, copy that to the receiving computer and run it. Besides that it worked (I tried it once before) it was rather fast. Of course once I decided to give the seeder a wire it was a whole lot faster (2.5 Mb per second instead of 500 Mb per second)

Once I copied a few of the other files using dropbox I decided to install Ubuntu. First downloading the live cd and put it on an usb using UNetbootin. The live version worked nice, so all that is left is installing.

The reason I decided for Ubuntu is because Windows XP is rather old and I have missed around with it a bit too much (somethings have been broken) and since I don't want to pay money for something I'm rarely going to use I decided to put ubuntu on it.

Although the live version run perfectly, once I tried the installed version I got a flickering screen and couldn't do anything anymore. Thank god, I'm not a complete Linux noob so after half an hour I finally fixed usplash problem (reinstall the graphics driver did the trick), but it at least demonstrates one the reason why I prefer Windows over ubuntu. When I install Windows I expect it to work 99.999% of the time. Linux on the other hand doesn't get that amount of trust from me.

Long story short. Ubuntu has been installed and I'm thinking of using it as my backup and for word processing. My good laptop is slowly becoming an software development only laptop and the occasional game laptop. However on both occasion I see it as work and there are times I simply one play around. And for that reason I use my old laptop.

Tagged as: , , No Comments
6May/090

Developing for the iPhone

For those who follow me on twitter this post is old news or it might be a minor refreshment as the majority of the content has already been posted on twitter.

At my internship I have been developing for the iPhone and boy oh boy, can I make a list of things to complain about. Luckily there are also a few good things and they balance each other but it’s a pain when you cannot unleash every bit of skill you have. Let’s start with the sour part.

  1. There is no stencil buffer. I think that the stencil buffer is as old as Duke Nukem 3D, which was released in 1993. It’s used for shadows and a few other things. However for some reason it is not supported on the iPhone (at V2.2.1 but this might change in the future) and it makes no sense.
  2. Secondly the iPhone is under clocked (meaning the CPU is running at lower speed than what it should run at). The majority of the hardware these days are able to dynamically set the clock speed of the hardware. I can accept the reason why apple has done it (preserving the battery) but when it comes to games it’s like with racing cars. You don’t want a F1 car being capped at 120 KM/H because you aren’t suppose to go faster than that on the highway. In apple’s defense, the iPhone has never been intended to be primarily a gaming device.
  3. Third is apple is really strict in what is allowed or not and some parts of the iPhone (like the photo camera) should only be accessed by calling a function and then except you have no longer control until a picture has been taken using the graphical user interface apple designed. Using it directly in some other fashion increases the chance that the application will be rejected. On the other hand some applications are allowed because some big guys back it (google is one of the companies that ignored the guidelines of apple and still got accepted).

There are still a few other problems (no multitasking for example, API might break with new firmware update) with the iPhone but let’s move on to the sweet part of the iPhone.

Actually the only one I can think of is that the distribution of applications can only be done through the apple app store. There is no such thing for the windows mobile or symbian. This way apple can also guarantee the quality of the applications, however I find it a mood point since an application that is poorly written is unlikely to be successful.

Actually there are a few more things, the emulator is good (better than the one for the Nintendo DS) and the API is reasonable documented (inconsistence in quality, but overall reasonable).