Category: Uncategorized


Reading the second page of the opengl version 4.0 specifications www.opengl.org, I thought something was strange: the first paragraph state

(…) You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. (…)

Emphasis added by me. Notice the first part of the bold text. It clearly states that I (or anyone else) am allowed to implemented the functionality, but the rest of the bold text clearly state that I am not allowed to manufacture anything that it describes — implementing the functionality is manufacturing what the specifications describe. So which is it? Am I allowed to implement it or not? This may seem like a trivial issues — of course I am allowed to! — but the problem is that someone might, some day, decide that anyone who has implemented OpenGL, in full or in part, is violating copyright and those people (like, for example, one of the Khronos group’s voting member who would have interests in shutting down OpenGL) might start suing them for (imaginary) damages.

The Khronos group should change this ASAP to state the obvious: the document itself is protected by copyright, but you can use it to implement OpenGL 4.0 if you want to without violating any copyrights.

I have been running Fedora 13 on my computers since the day it was released, but have only just now realized that the experimental drivers it includes for nvidia gpus actually work. I initially thought it was just 2d that was accelerated and everything was done in gallium (it’s based on gallium :-) ) fallbacks (which AFAIR is not technically correct, but I can’t quite recall what the technical correct term is) when the driver doesn’t have it’s hardware accelerated implementation ready. This was based on running glxgears and comparing the result with what I have gotten with the blob from nvidia — where the nouveau driver (the free one) is outperformed by a factor 10 to 1 (that is nvidia does 10 times better than nouveau). Which just shows how good a benchmark glxgears is (it’s not a good benchmark). Running a few (World of Padman and OpenArena) free games with a 3d engine, I got two working which had performance in the 90fps-100fps range with everything set to the best quality (highest resolution, best filters, antialiasing, etc.). The only game I couldn’t start was Tremulous, for reasons unknown. I tried to compile the game myself but the Makefile doesn’t include an install target and I’m lazy, so I haven’t been able to test it.

Anyways — thumbs up to the guys working on nouveau. It certainly did pay off to give them all the data I collected for them through out the upgrades.

I like SPARCs. I find them to be far superior to the x86 processors on, at least, a theoretical level, if not also on a practical level. Having said that I will likely never get one, unless a meteor hit me in the head with one. The reason is simple — they are, by far, too expensive. The cheapest SPARC based computer I could find anywhere costs $14,750.00, which is about 4 times more than I would have to pay for a computer I could assemble using off the shelve components (and not the cheapest ones), resulting in a computer which is superior to the SPARC in every way. The SPARC I’m refering to is the cheapest one from SUN (or is that Oracle now-adays?): Listing price is $14,795.00, which buys you one (1) 2.75 GHz SPARC64 VII 2-core processor with a total of 4 threads, with 8 GiB of RAM, a total of 292 GB of HDD on two drives @ 10k RPM and a few other things (including Solaris 10 — but who cares?). I’m assuming some sort of support plan is included — if not, I can’t really justify the price at all and would consider this theft at broad daylight.

The system I propose as a superior replacement consists of the following components: two (2) Quad core, hyper threaded Xeon L5630 @ 2.33 GHz. This is slightly slower (in hertz) than the SPARC64 VII, but on the up side, there are two of them, and both have twice as many threads as the SPARC, for a total of 4 times as many threads. This won’t cost you more than $1500 total. The motherboard is an Intel Server Board S5500BC, which should cost you about $400 — this lacks a SAS controller, so you will have to get one. A SAS controller can be had for about $150. Faster, bigger drives with more cache can be had for about $200 per drive — if you want to use them for RAID 1, which is what I would recommend, that will be a total of $400 or so. 2 GiB sticks of paired DDR3 RAM modules running @ 1800 MHz can be bought for $150 per pair — a total of 8 GiB costs $600. The only thing missing is a case and a power supply — the case can, again, be had for about $100-$150 (I’m assuming $150) and the power supply will cost about $300 — the total is ($1500 + $400 + $150 + $400 + $600 + $150 + $300) $3500, or about a quarter of what the SPARC was listed at. Personally, I would much rather have four servers than one, and if those four servers are all better than the one server I could get otherwise, I would definitely pick the four servers.

Components I used to find the price:

Intel Xeon L5630, Intel Server Board S5500, Kingston HyperX 2 x 2 GB @ 1800 MHz DDR3, Fujitsu 450 GB (SAS HDD @ 1000 RPM), LSI MegaRAID SAS (SAS Controller), Ikonik Zaria A10 (case), OCZ Z Series 1KW power supply.

Have you have thought to yourself that you wanted to provide a readable version of a variable in the public area of a class in C++, but without providing a getter function? Well, that’s not possible, since you an only grant full access or no access to a variable, but you can do a hack that makes it look like you haven’t provided a getter function — the key is to use operator overloading.

The concept is something similar to this:

class example {
private:
int c;
public:
const int c;
};

The idea is to make c fully accessible in the example class, but only readable in the public. There are a few options to doing this — the union way and the other way.
The union way has the nice advantage that it doesn’t use extra memory (and it can even be combined with the other ways) but it’s not always a good option because you cannot inherit from unions nor can unions inherit anything. Unions therefor are only usefull if you are writing a class that you know will never be derived.

The union way would be:

union example {
private:
int c_;
public:
class { operator int() { return ((example*)(this))->c_; } c;
};

Reading example::c will return the value of example::c_, but doesn’t allow example::c_ to be written to. The union way is simple and neat. It doesn’t mess up readability of the code a lot. The only reason why it’s not perfect is that you can’t inherit from a union or let classes/structs/unions inherit from unions. While I’m still at unions, you can imbed a struct in the union if you need more private variables, like so:

union example {
private:
struct { int c_; int b_; };
public:
class { operator int() { return ((example*)(this))->c_; } c;
class { operator int() { return ((example*)(this))->b_; } b;
};

This will do the same as above, only with two members.

A more extensible trick, which is also far less readable and a lot more convoluted, has to be used if you want something you can derive from. I haven’t fully explored the effects of this yet (such as what happens if you derive from it), but here goes:

class example
{
unsigned p_;
public:
class p_traits {
example * o;
public:
p_traits(example * e) : o(e) { };
operator unsigned() { return (o->p_); }
} p;
example(int i) : p_(i), p(this) { };
};

This is not nice code, and it can be made nice, but then it will be a lot more convoluted and less readable (but has more features).
The code is a single class which has a single unsigned private variable p_ and a public member p. p is, just like the example above, readable from outside the class, but is only writeable inside the class. I have not found a way to have several readable entries but without having full object overhead. The real problem however is that you must have a pointer to the owner of the class, which, to me, is a waste (this is why I prefer the union way in all the cases I can do it).

Both these techniques can be expanded to allow assigning values to the public portion or doing anything to them really, such as calling doing calculations or sending a message to a server. It could for example be used to change the size of a window in a graphical environment in a more “natural” way than the regular window.resize(100,100) — instead you could do window.width = 100, window.height=100. This is, of course just bells and whistles and doesn’t make the language more powerful, but I do like the idea of setting values, rather than calling functions (even if there’s no real difference) — it feels more object oriented this way.

Oh, and I don’t use the above non-union way exactly. Instead I have the p_traits class outside of the class which inherits from a common base class. The base class is a friend of the owner class and so the traits can access anything they want to.

I got an HTC Hero in December — it’s a nice phone. I like it. I knew that Android 2.0 would be out not longer after I got my phone, so I checked the web to see if it would be possible to update the phone to the latest version (since frankly Android 1.6 is not that big a deal). Lo and behold — HTC promised that the Hero would get an update in December, so I figured it would be out in January or February. The update still hasn’t arrived and Android is now up to 2.2. HTC has, in the meantime, promised to provide 2.1 updates, but I’m not holding my breath for any update from them.

The main rant of this post however is not so much about the Hero or HTC, but more about Android and specifically why it won’t matter.

The Android operating system is in many ways similar to Windows. No, it doesn’t run your favourite first person shooter or Microsoft Office, and that’s not what I’m talking about. Android is an operating system and nothing else. It is not a list of hardware specifications, it doesn’t contain any details on how things are booted or how memory is managed or accessed the processor. It doesn’t say anything about how discs are organized or — and this is the important bit — how to install a new version of it. In those ways it is very similar to Windows.

Android cannot simply be installed on a phone or a device, and this one thing is the one thing that is lacking for Android to really matter. Since I cannot, in a simple way, brew my own version and install it on my phone, it doesn’t matter if it’s Android or Windows Phone 7 Series (or what ever permutation of those words make up the name of the latest version of the worst phone OS out there). Using Linux as the kernel specifically doesn’t matter for a number of reasons, the most obvious being that I, as a programmer, have no way of communicating with kernel.

If Android included a boot mechanism it would fix all the problems at once — but being that it’s google who’s developing the operating system it’s not likely that we will ever have that.

A better make

I’m implementing my own ‘make’-like build system in C — I call it builder. I’m wondering why people haven’t done it they way I (want to) do it. Instead of manually telling the builder what kind of project it is (library or executable) I determine that through the name of the project (if the first three characters is lib then it’s a library — otherwise it’s an executable).

I plan to (but haven’t worked it out entirely yet) to allow automation of compiler flags and what libraries to link to. The plan is to make it possible to link to a library simply by including a header file.

The PS3 has been around for some time now, and still it doesn’t have a lot of games. More annoyingly, most games for the platform are crap — either fully or compared to the Windows and Xbox versions of the games. A few of the games are decent — but they are not all over the place. A lot of developers have been complaining about the console — which may be one of the reasons why the PS3 doesn’t have a lot of games.

I think I have a solution to the problem. First of all Sony has to realise that to gain control over the market, they have to release (some) control over the console. This control will actually not be lost, but shifted, if my proposal is followed. One thing that’s bugging a lot of people is that you have to pay money to develop games for the console. That may seem like a minor problem as you also have to pay money to develop stuff for the XBox and the Wii. The difference (from the XBox) is that the XBox in many ways is just a stripped down Windows machine running on a triple cored Power 970. You can make a game for Windows and be reasonable comfortable that porting won’t be a too big issue. In some cases, it will be very close to just doing a recompile for the XBox. The PS3 is completely different. As far as I know, it doesn’t look like anything else. I have no details on the SDK, but there is no reason that it should look like any other operating system and the fact that it has a completely new type of processor, may seem frightening to some people. Of course the Cell processor should just be seen as yet another “GPU” like processor and the SPEs should just be treated as an easily accessable set of GPU cores — not like a real part of the CPU.

The first part of my suggestion is this: release the SDK to the public. Allow anyone to develop and publish software for the PS3. Then, make all game disitribution go through PlaystationStore. It is extremely convenient to buy games of PlaystationStore and it adds that you don’t have to have disks lying around or change them to play another game. Further it means that Sony is the only middleman from the developers to the consumer, which can result in two things: cheaper games or increased profit (both for Sony and for developers). If the cheaper games option is chosen, it’s not unlikely that it will also increase profits.

The second part, which is a bit more drastic is to revise the Playstation 3 console itself. Add a lot of memory — at least a total of 1GiB — and increase the harddrive capacity to at least 500 GiB. The extra memory reduces the problems developers have had with the PS3 operating system hogging up to 84 MiB of the preciouse 256MiB of memory it has. Furthermore it will make it feaseable to run GNU/Linux on the machine, which is rather painful at the moment.

4 times 28 minutes later

I’ve been playing a “Zombie Survival” mod on a Neverwinter Nights server a lot lately — so I decided to watch some “Zombie” movies and found out that I hadn’t seen “28 days later”. Well, while it was a great movie in it’s own right, it isn’t a Zombie movie for at least the following reasons:

  1. We know when, how and why people start turning into mean cannibals that don’t know when to stop.
  2. About at the end, we learn that life outside the British Isles have not been infected.
  3. The story starts after the infection period and people have already died. Society is gone — it’s not going.
  4. People survive. The two main characters (Jim and Selena) as well as Hanna all survive, at least to get the attention of what seems to be the US military (why not France, Spain or Germany who all practically are neighbours to GB?).
  5. Jim goes into a rage and kills all the soliders at the mansion.

The last part is actually the real plot of the movie, and is the actuall reason why I don’t consider it to be a zombie movie. The movie calls the virus that infects people ‘rage’ in the very first scene of the movie, which reveals that it is in fact not a zombie movie. “28 days later” reminds me more of “Alien”, which is about molestation, rape and similar assaults, than for instance “Dawn of the Dead”, which is about surviving an absurd situation and, more importantly, how people behave in said situation.

This however, made me think about making my own Zombie or Survival mod for Neverwinter Nights. Now, I’m not still thinking about it, but I did do some more thinking and found out just why I’m frustrated with the server I’m playing at — it all comes down to that I have a certain view about what Zombie Survival really is (which is also reflected in my critique of “28 days later”) and too many of the people who play on that server don’t seem to agree with me — more importantly, the DMs don’t. Now, here is the important thinking I did: Just what kind of view should people have, for me to enjoy playing a Zombie Survival game, with them. Now, I’m not saying that this is the view on Zombie Survival, but I do believe that it is a good one at least. Regardless, I think the most important thing I realized (I didn’t actually realize it because of this — I think it’s pretty obvious considering, well, at least my experiences with people) was that if two people simply cannot agree on how a game should be played, they should find other people to play with.

I did come up with a system of determineing if people should play with each other (for ZS games) that I believe would work out nicely. It’s rather simple and work on the concept of “double annihilation” — I made up 6 multiple choice questions that would be relevant to a zombie invasion scenario and rated the questions, where lower numbers whould be the best option, from 1 to the number of answers to a given question. If someone answered these questions, I can pretty easily determine if I would likely enjoy playing with this person (or at least, that’s the idea). If a person answers just one single question with an answer that has a score that’s too high, they “die” and turn into a zombie. If not, then they can join the ranks of survivors and become one of the peopl I would like to play with. Ofcourse, this isn’t fool proff and I haven’t actually tested it. I do believe, though, that it is a pretty good system, at least, to sort out the really bad instance of “survivors”.

I decide to play some Strange Adventures in Infinite space today and found out that the source code has been released under the GPL, and, that there has been made moves from the original authors to port it to SDL. According to them, it should be a breeze compiling it on Linux…

Now, this is a class example of just why stupid people should not attempt to do any sort of programming. While it properbly does compile on ancient compilers that doesn’t follow standards (Microsoft Visual C++), it does not compile on standards compliant compilers and certainly not on modern ones. The source code is supposedly a C++ program, but looking at it, it reminds me more of BASIC than even C. Not a single C++ header is used and no features (or misfeatures) of C++ is used anywhere. It’s all basic C, and poor C to boot.

On top of that, the project makes heavy use of non standard functions, that are only found on DOS decendent operating systems — i.e. I have to rewrite those bits for the thing even to compile. There are absolutetly no comments and symbols are being defined that are defined in standard C, meaning porting it is going to lead to bugs, bugs, bugs and.. oh yeah… bugs… I’m beginning to consider writing it from scratch instead of simply porting it — and at the same time letting the original authors know how to write real code. This looks like the work of a first year student who never looked at a programming manual before.

On the bright side, I’ve gotten most of the bad code compiled by simply replacing all instances of char * with std::string and a few modifications here and there to make sure things are used the right way. Some functions are kind of odd though and would likely require complet rewrites — especially the file handling functions, where wheels are being reinvented all the time.

More powers!

I just got my copies of the Dungeons and Dragons core rulebooks (technically yesterday — it’s 4 in the morning) and better yet, I also got a new wireless networks card for my laptop!

I am a bit dissapointed in the D&D 4th edition rules. Some of the things in it is pretty great — the concept of powers and rituals for instance is pretty awsome — while some of it is not quite as great — the concept of minions springs to mind. The idea that a level 1 character can land one, soft, lucky blow to a demon that has suffered battle after battle and kill it outright, just seems too ludicrous to me. Yes, it makes sense to have minions from time to time, but utterly barring some creatures from being anything but cannonfodder just seems stupid.

Anyways, the core of the rules are unaltered and it appears that the guys who made the new rules had a long hard look at other d20 systems like Iron Heroes — the concept of powers for instance reminds me a lot of how Iron Heroes works.

The new Dungeons & Dragons system appears to have been designed (by someone who doesn’t write computer software) to be adopted to computer games. There are some pretty dumb designs with regards to that, but mostly it is a great deal easier than Dungeons & Dragons 3.x. Again, the core is the same, the details are vastly different. Speaking of computer software designs, I have ofcourse decided to not make libd20 implement the dungeons and dragons 3.5 rules, but dungeons and dragons 4 rules. It is very likely however that I will never be able to release the software since the new licensing of the rules should be very strict — final word on this is yet to arrive though.

Follow

Get every new post delivered to your Inbox.