Reanimating CeGui#, Take II

Programming No Comments »

I took another go at CeGui# and got most of the basic stuff working again. Basic stuff means text rendering, clickable buttons and resizable windows. The more advanced widgets seem to still have some minor problems.

Rob Loach, one of the project managers, has granted me developer access to the subversion repository of this project, so I was able to merge my fork back into the main source tree. I even created a new theme from Mohsin Naqi’s SuaveOS which looks quite nice, imho:

CeGui# displaying a simple dialog in the 'suave' theme

Quite an improvement from the first screenshot I made :)

Reanimating CeGuiSharp

Programming 1 Comment »

First physics, now GUIs. CeGui is a well known GUI system for rendered GUIs, which makes it ideal for in-game display of dialogs containing buttons, checkboxes, sliders and even complex stuff like lists and combo boxes. Some time ago, the CeGui# project has ported this library to C#.

Sadly, with the fall of Realmforge, like so many other .NET game development projects, this library seems to have not been updated for quite some time. Plus the latest sources didn’t work for me. So I tried my best to get it to compile and then to work again:

Early screenshot of my forked CeGui sources rendering an ugly Direct3D window

Oh, well, isn’t it… uhm… fascinating?

I’ll try to fix the font rendering code next, hopfefully something useful will come out of it. Otherwise I might try porting my GUI system from the Nuclex Game Engine to .NET. It’s a bit cleaner than CeGui, but not nearly as powerful because I didn’t bother creating all the widgets. Besides, CeGui would be nicer due to its widespread use.

Want to try it for yourself?

Sure, just grab the April 2006 release of Managed DirectX (anything earlier won’t work, sorry!) and download this:
Download CeGuiSharp example application

Reference Types and Value Types??!

Programming No Comments »

Microsoft sure fucked up this one. Back in good old C++, you could decide whether you need value semantics or reference semantics right where you needed it: When the class or structure was used. In .NET, your entire data type is a so called “value type” or a “reference type”.

I don’t know what the guys were smoking when they came up with this “simplification”, but in the end, it doesn’t have a single advantage and causes loads of trouble. For example in object comparison: In C++, you had to override a single operator and you absolutely knew that this operator had to compare the values of the instances, not the object identity. That was clear, precise and implementation took only 5 lines at most.

Now .NET has “improved” upon this: You have object.Equals() and operator == and operator !=. To barely avoid code duplication is hard enough already. But then one still doesn’t know, as the user of an object, whether the object’s comparison operators will perform an object identity comparison or a value comparison, because its implementors are free to decide that on a case-by-case basis. All in all that takes you a good 20 lines of code on average - just to provide safe object comparison while you co-worker will still not know what kind of comparison is done.

And what happens if you assign one variable to another is no longer as clear and simple as it was in C++. Depending on whether you’ve got a value type or a reference type, the assignment might create a deep copy of the object or just reuse the reference. You can only be sure that a deep copy is made by explicitely calling the copy constructor — if the implementor has provided one. Again, there’s ICloneable to make it even worse. That interface is something like a brain misfire because it works for simple classes but will become utterly useless once you try it on derived classes.

Oh, and before I forget, there’s also IComparable, the ‘ref’ keyword which gives limited reference semantics to value types and from .NET 2.0 onwards also the generic version of IComparable…

Porting Opal to .NET — almost finished!

Programming 1 Comment »

This week I had a real motivation drive and ported most of the Opal sources to C#. What’s not yet working are joints and sensors, because my primary motivation had been to get the “simple” example from the samples folder to work. And so I did.

Screenshot of the

Oh well, it’s not like it is perfect. Imaging dropping a coin upright on a table. It would probably tumble and come to rest on its flat side. Not so in my example! Even if you dropped it so it landed on its flat side, it would magically roll around and come to rest in an upright position.

And boxes, oh, well, they land, come to rest, then start shaking like crazy only to launch themselfes skywards like grasshoppers soon after. Not really realistic, if you ask me…

I don’t really know anything about the complex math involved with physics, so if someone has an idea why this is happening (I have yet to check out if the original Opal library and native Ode do the same) and can give me any clues I’d be very grateful ;)

In case you want to try it for yourself, you can download a binary below. The example requires the absolute latest and greatest version of managed DirectX to run. Anything earlier than MDX 2.0 from DirectX 9.0c in the April 2006 release won’t do, sorry.
Download Opal .NET example application

Press the space bar to make a random object drop from the sky!

HowTo: PunBB with TinyMCE in UTF-8

Web No Comments »

I’m currently working on a small C# project with some friends. I’m very fond of Subversion and in combination with Trac, this is a real killer system. The only thing missing then happens to be a good discussion forum. Some time ago, I have considered using moreGroupWare with its forum add-on, but currently I’m thinking something very simple and clean would be the right way to go.

Regarding forum software, phpBB would be the normal choice you’d make, but lately this project has rather been known for its constant security issues. So I’ve been looking for an alternative. The best one I’ve discovered so far seems to be PunBB, a very light, fast and - as far as it seems - reasonably secure forum.

PunBB works great out of the box, unless you happen to be german, are running MySQL 5.x and require “umlaut” support (those funny vocals with two dots above them). Turns out that PunBB doesn’t handle this too well. Here’s what I’ve done to get the “umlauts” to display correctly:

First, I installed PunBB into a MySQL database whose charset was set to UTF8 General CI (created using phpMyAdmin). Then I changed include/template/main.tpl so its header says:

<?xml version=”1.0″ encoding=”utf-8″?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en_US.UTF-8″ lang=”en_US.UTF-8″ dir=”<pun_content_direction>”>

After that, I also replaced the iso-8859-1 charset with utf-8 in lang/English/common.php and any other files where it appeared. As the last step, PHP’s default_charset needed to be adjusted by adding the following line into PunBB’s config.php file:

ini_set(”default_charset”, “utf-8″);

Then, finally, my “umlauts” displayed properly and messages weren’t cut off anymore at the first non-ascii character (a phenomenon I oberserved before I did this).

For those of you who find this too complicated, I’ve packaged a special version of PunBB 1.2.12 with built-in TinyMCE and UTF-8:
PunBB 1.2.12 with TinyMCE and UTF8
Don’t forget to add ini_set(”default_charset”, “utf-8″); to your config.php once you’ve installed it!

Windows Vista Beta 2 (5384.4)

General No Comments »

On June the 7th, 2006, Microsoft has released the first public Beta of Windows Vista, build 5384.4 labelled as Beta 2. Anyone with a decent computer (and enough bandwidth) can grab it at the following URL:

http://www.microsoft.com/windowsvista/getready/preview.mspx

I just finished installing the 32 bits version and it’s a lot better than what I had experienced with build 5308 (the february post-Beta 1 CTP). For the first minutes after installing, my hard disk was constantly busy, but now everything seems to be very smooth.

Daemon Tools

Getting Daemon Tools to run proved to be a bit of a nightmare, thought. I couldn’t manage to install the current 4.0.3 release as this SCSI pass-through layer thingy will not properly install. The older 3.33 version will work, but will be blocked by Windows Vista because it is not digitally signed by Microsoft. To get it to install anyway, you need to follow these steps:

  1. Disable user account protection (UAP). To do this run %SystemRoot%\system32\msconfig.exe (just press Win+R and enter the exact line), go to the Tools tab, select “Disable UAP” and click on Launch.
  2. Disable integrity checks by running “Bcdedit.exe -set nointegritychecks ON” by entering the line in the box that pops up when you press Win+R as before.
  3. Reboot
  4. Install Daemon Tools 3.33
  5. You can now reactivate UAP of you wish to, however, that might cause the Daemon Tools tray icon to give trouble at system boot. If that happens, wait until Vista is fully loaded and then right-click on the daemon tools icon on your desktop, choosing “Run as administrator”.

    Soundblaster Audigy

    Creative does what this company does best: Being unable to deliver up-to-date drivers. Somehow, call it divine intervention, the old beta drivers from november 2005 (which stopped working since 5231) are working again. You still have to cope with clicks and scratches ocassionally, but at least you get decent sound.

    Even a clicking and scratching Audigy is much better than what my onboard AC’97 output could provide if you ask me. If you’ve got an audigy card, go here:

    Creative Labs Audigy 2/4 Drivers for Windows Vista x86 and x64

    In need of a .NET Physics Engine

    Programming 1 Comment »

    For some time now I’ve been toying with physics simulation under C#. There are quite a number of good physics engines available in the C++ world like Havok, PhysX, Newton, Bullet and ODE.

    My first attempt was to re-wrap Tao.ODE (which wraps native ODE as closely as possible) for my own purposes with a more .NET-like interface. This attempt was crowned with success after a mere few hours. But designing a good object model that could be used for other physics engines proved to be a lot of work…

    So why not make the one definite 100% .NET physics engine by porting ODE to C#. Oh well, the basic stuff ported quite well and I tried to keep myself from modernizing the code as I progressed to obtain a 1:1 port first, then I could still turn things upside down. But I nearly went insane when porting ODE’s integrator math, so…

    I decided to set my target a little lower and build my own physics engine that offered a nice object model but only basic features for the first version. Maybe I could attract some of the people that actually understand the more complicated stuff and collaboratively expand this engine. First I needed a strong library for the core math and geometrical stuff. This step is done, the fruits of this work are now available in Form of the two assemblies Nuclex.Math and Nuclex.Geometry. Still…

    Writing a physics engine on top of that is still an idea that I’d like to follow through, only that I’ll take months before anything useful will surface. That’s why I’m now back to Tao.ODE and my original re-wrapper. It’ll give me results quickly and not compromise portability to mono.

    Gentoo rocks!

    Web No Comments »

    Gentoo is just so cool. Even after 6 months, I’m still in awe each time I see how well it works to integrate even the most exotic packages into one consistent running system.

    Before I discovered gentoo, I’ve been using debian. Debian has the reputation to be very stable and therefore the right choice for servers. But that only holds true as long as you’re bravely continue using standard packages from the official mirrors.

    As soon as you come across something that does not have an official package, you’ve got three choices: Find someone who provides a trustworthy package, create a package yourself or bypass the packaging system. Creating your own packages is complicated, so choice 1 or choice 3 it is. Using inofficial packages has killed my debian server once and bypassing apt-get means that any update to your system could make your hand-compiled binaries unworkable and the package manager can’t notice it.

    It’s all different with gentoo. Everything is compiled on your own system, so the entire composition works together really well. Creating custom packages is also easy and portage (the “package” management system) will actually keep track of when your custom stuff needs to be recompiled. But that is seldomly required because as it is today, gentoo provides packages for just about anything.

    Gentoo gives you choice. In debian, the only sane option for example was to use the premade PHP package provided. Gentoo enables me to change everything - whether to support sqlite, to incorporate XML parsing or to build the apache2 module - and I still get a slim and consistent system.

    WP Theme & Icons by N.Design Studio
    Entries RSS Comments RSS Login