I was really annoyed by the little mistakes in my models such as incorrect size or floating models and couldn’t really be bothered to open it up myself then do the small change, export it, start the game, and see if it looks good. So I really needed a small model editor/previewer for my game.
Not only it’s useful for the modelers but I think it’s going to be a great tool for modders as well =)
It’s a scary and yet exciting step. Leaving this whole feature-full, documented, full of examples XNA to that weird, unpopular, open-source alternative called SlimDX.
What’s the worst thing that can happen, right? Now that XNA is going more towards console/phone apps, SlimDX is the future ! People will start using it and soon a huge SlimDX community will appear, helping thousands and thousands of people !
That’s what I thought would happen, years ago.
I decided to stop waiting and port it myself.
You may think that SlimDX is completely different from XNA, but they’re pretty much the same, while XNA gives you all these high-level functions ( like Game class, SpriteFont, DrawInstanced, Ressources, etc.. ) that make things much easier and sometimes force you to use them ( Content pipeline ) , SlimDX gives you all the tools in order to make anything you want.
Porting my code was surprisingly easy, what I first did was comment out all the graphics codes. Once I was done with cleaning all the XNA code, I started implementing things one by one starting with an empty SlimDX window which was based on the sample’s code.
After that I began searching for equivalents for XNA’s functions, they were all pretty much the same, with some time I had most of the code readapted to SlimDX. Textures were kind of tricky to understand as well, instead of rendertarget, SlimDX has surface ( just like in DirectX API ) and in place of Texture2D it has a plain Texture class. In general it had almost all the functions that XNA had.
The annoying part was the lack of game specific features, such as MathHelper, BoudningFrustum, SpriteFont ( SlimDX has the normal DirectX one but it isn’t really efficient ), SpriteBatch ( same problem as for SpriteFont ) and of course the input managers. Within a few days thanks to the Internet I managed to put them all back in.
I gotta say that this was kind of hard, especially implementing the missing features. But in the end, the whole porting process was kind of interesting and I learned many things on the way.
Good thing I separated the graphics code from the game code before I started doing this =)
A picture I found of my old abandoned 2D RTS =)
( I was probably doing stress tests on that pic )
This was actually few years back before I started working on Faction Command =)
I guess it had pretty much everything done: path-finding, economy system, networking support and even the ability to mod ( using a .ini based system like in the old Westwood games ).
The only real reason why I stopped making it is because of the insane work required in order to make those little animated sprites. It might sound stupid, but sprites are a big deal in any isometric game. Imagine you want to put this idle animation on a unit, in order to do that you have to first draw the idle animation and then do the same thing for each possible angle you want him to face !
( An animation with 10 frames, in 8 angles already equals to 80 frames to draw ! )
As you make more animations the amount of frames increase to a point where you have this huge enormous file containing more than 500 frames, this becomes an horror if you plan on later changing a small detail, cause you got to do it for every single frame !
Luckily, 3D games don’t have that problem, because you don’t have to worry about doing any boring repetitive work =)
Got to study for my exams, so the progress will be kind of postponed for a week or two.Just saying =)
Got to study for my exams, so the progress will be kind of postponed for a week or two.
Just saying =)
SlimDX porting progress #5Fixed up some stuff, increased the performance by at least 100% ( The game runs now officialy twice as fast as it...
SlimDX porting progress #4
I finally decided which model format to use and wrote a parser.
I previously experimented with the open model format named Collada and surprisingly the support for it was awful, every exporter gave different results and I had lots of problems making it work.
SlimDX porting progress #3
Implemented a font system, removed the GUI blurriness, added HQ water, added shadows and fixed some more stuff.
I’m almost done now, all I need to do is code a model loader from ground up ( XNA had an internal one, SlimDX doesn’t ) and then make some small & important optimizations/adjustments =)
I’m pretty sure I’m not the only one here who thinks XNA framework as a great tool for learning how to program in DirectX. Isn’t it great to be able to use the power of DirectX with C# and have all these thousands and thousands of tutorials all around the web? It sure is.
Sadly the more XNA progresses the more simple it becomes , all those low-level functions are removed and we’re forced to use those weird functions that we’ll never encounter in the real DirectX API. How are we supposed to learn how to use DirectX if we got functions like LoadThis(), DrawThat() and DoTheFancyMysticalThingWeWillNeverKnowAbout() ?
This is where SlimDX comes in to save us in a lame ridiculous way, we could consider XNA like the successful wealthy bald guy with a huge proud smile on his face while SlimDX being that guy with glasses, looking bit tough, following everything, being up to date but who hides constantly in the shadows and not to forget : we don’t know shit ‘bout him !
From now on I’m calling SlimDX Clark Kent. We all know Clark exists but we have no clue who he really is, he isn’t popular either, no one interviews him, no one helps him and people aren’t comfortable being next to him. Luckily Clark Kent doesn’t care about popularity, so whether you know him or not he’ll still be as powerful as ever and he’ll keep getting stronger.
He isn’t that different from us and once you get to know him you’ll see how great he is and how amazing his powers are, powers beyond -Luthor-XNA.
(Now that I written this useless post, next one will be about how the porting went.)
Particles are now working, unit brackets, decals too. Still got to finish up the GUI stuff