Where do we start

Hi, and welcome to the first article in my series covering the technical side of NeREIDS development.

Here we will recap what had been coded prior to the creation of the blog.

I had a fresh new project set up under VC2012. I tried not to copy/paste much code from other stuff I did in the past.

I’ve decided to design most of the primary tools so that they’re tailored to my needs, but not NeREIDS specific. Those would go in libraries that for some reason I prefixed FL. Currently there is a FLCore, FLMath, FLGraph and FLUI lib which are being refined as needed.

I did lots of research beforehand on the subject of being cross-platform using C++. At one point I considered the idea to go fully cross-platform with NeREIDS, but I soon dropped it : For one, I’m confident enough with Direct3D, but I almost never used OpenGL. And second, doing anything cross-platform with C++ is still a nightmare.
And yet there are currently some efforts being made with the C++11 specification to cope with this very issue of cross-platform complexity, so I’ve decided to give cross-platform its chance, at least for the server process. To my knowledge, there is indeed a lot of dedicated hardware servers running under Linux among the gaming community. Allowing those to host for NeREIDS server process seems like a good idea.

The FLCore lib is thus responsible for dealing with the issue of cross-platform, and provide some primary tools such as string encoding, some stuff about memory allocation, containers, etc. I was inspired by the way Qt is implemented in that regard, but I do not use parts of Qt code.
As of now, I do not yet know if I really need half the stuff I coded in there (most of it trying to reinvent the wheel, I confess), or if classes directly from the c++11 stl would be better suited.

The FLMath lib holds, unsurprisingly, classes and types dealing with math operations. A lot of my effort here was getting a handful of algorithms (such as PRNGs) which would deliver the same results across all platforms. But it has also a very weird particularity : half of this lib is indeed dedicated to my implementation of a fixed point math system.
There are a couple of reasons I spent a lot of time trying to get this work (and I think it does work, by now, as those classes are quite well covered with unit tests). As for FLCore classes, I do not yet know if I will really use most of it.

The FLGraph lib stands for “FL Graphics”. It covers all things related to displaying stuff on the screen. Since the screen is only useful to the player, this lib will typically not be used by the server process. Being a client-only lib, its current implementation can then be full Direct3D11. It took me a while, but I finally managed to extract pure D3D11 stuff from current DirectX SDK samples (which use more of a keep-all-versions-around philosophy, sadly). This in turn delivers me from a lot of headaches, as D3D11 makes the handling of some previously complex cases much easier, e.g. what to do when the game gets alt-tabbed, or goes full-screen. My FLGraph code benefits from it by being a lot cleaner, now ! But as we will see, using D3D11 in its present state also introduces issues of its own.

The FLUI lib deals with the management and display of a user interface, as well as retrieving and processing user input. While the input classes (dealing with the gathering and notifying of keyboard and mouse events) are quite well covered, much less so is the GUI. But I had a quick-and-dirty implementation of an Immediate-Mode GUI running, so that I can fast prototype things and keep the workflow going. FLUI uses Microsoft Windows-specific functions to implement an application abstraction for a Microsoft Windows client, running an event loop based on the WindowProc callback. It also uses FLGraph for GUI rendering. Obviously it is not linked with the server process either.

Developping a FLNetwork lib is currently where my efforts are at. Guess what this lib will be about ?


In later posts, I’ll try to cover all those libraries in more detail, as well as discuss each decision presented here.
Stay tuned !

Leave a Reply

Your email address will not be published. Required fields are marked *