Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 May 2007
Offline Last Active Today, 06:46 PM

Topics I've Started

Handling shaders without D3DX

28 April 2014 - 12:55 AM

Hi, I have a graphic rendering engine in DirectX9. Since D3DX has been deprecated, I'm working on removing it from the engine.


I was previously using ID3DXEffects to handle shaders. Without effect, it looks like I have to handle vertex and pixel shaders separately. This is not a big deal since I'm not using vertex shaders much anyway (2D game).


My problem is that, looking at the D3D9 API, there doesn't seem to be a way to access the different variables I am using in my shader. There is the IDirect3DDevice9::SetPixelShaderConstant family of methods, but they identify the parameters by index instead of a string. I'm not sure how I'm supposed to get the table that maps a variable name with its index? Another problem is I'm not seeing a function to set a texture variable in my code. I assume it has to do with samplers, but there's still an index I'm not sure what to do with.


Should I just assume that D3D9 is old so it's okay to use a deprecated (old) library (D3DX) with it, and stop worrying about having D3DX? Quite frankly, it looks like D3D9 shaders were designed to be used with D3DX, and it's hard to find doc about how to not use it since DirectX9 is starting to get old.

Map Editor: XNA vs SlimDX vs SharpDX

24 September 2013 - 03:21 PM

My game editor uses Windows Forms's GDI+ to draw levels, but it is kind of slow and limited so I'm looking at using Direct3D to draw my maps.


Simple question. Which API between XNA, SlimDX or SharpDX would be best suited for a 2D game editor. XNA seems a little overkill but it was built by Microsoft and tons of games have been built on top of it so it seems stable, plus it has the audio built-in too. Then there are SlimDX and SharpDX that are basically thin wrappers around the DirectX API and seem much more lightweight. Both seem to do the same thing. (Is one better than the other?)

Need advice on TDD approach

06 September 2013 - 06:20 PM

I'm trying to apply the TDD approach to an I/O library that I'm writing to manage custom archive files that contain my game's resources and assets. This is a learning process so I'm trying to follow the rules of TDD rigorously, but I'm falling on a few issues for which I don't see an easy way out without breaking TDD. I'd like to have some advice on this.



TDD says "test behavior, not implementation", but when the whole point of a class is its implementation, how does TDD go about it? I'm asking this because in my game's I/O library, I have the OutputStream class which is the base class for all stream objects that write output somewhere, and then I have the BufferedOutputStream that implements buffering and flushes the buffer when it's full. (Into another OutputStream that may be a FileOutputStream, a MemoryOutputStream, a mock object for unit tests, etc.)


Basically, I'd like to test that the buffering works, but this is about implementation, not about behavior. It's easy to test that the Flush method works by using a mock object for the buffered stream's output and checking that its Write method is called, but how do I test that the actual buffering works correctly? The simplest method to make every tests pass is to just not bother with buffering and write the input directly in the output stream. Or more realistically, I could have a bugged buffering algorithm that flushes the buffer when it is not full, and I don't know how I could write a unit test that fails without breaking encapsulation and knowing volatile and private implementation details such as the size of the buffer. This is obviously private stuff, and if I add public method to change and access the buffer, I'm breaking encapsulation, bloating the API and potentially adding more ways to break the object's internal state.




Also, I'd like to know if I'm right to assume that classes and methods that interface directly with the operating system cannot be tested until integration tests, and thus should not be written until then? Again, in my I/O library, I have the FileOutputStream which is a specializtion of the OutputStream that writes to files. Sounds like I have to break TDD principles, otherwise I'll never write that class without unit tests.


Between game programmer and content designer...

17 February 2013 - 11:29 PM

Hi folks.


I'm going to ask for some advice here. I'm currently working as a software engineer for a robotics company, but I'd like to eventually break into the game industry, and as I'm nearing my 30s I think it's now or never.


For a little background, a couple years ago, I have solo-programmed the engine of a 2D RPG very similar to Final Fantasy VI in C++, complete with a RPG Maker-like editor and all that jazz, and I really enjoyed it, but I realized that my favorite part of building that game was not programming the core engine with the graphics code and all that stuff, instead it was when the engine was done and I was creating the actual content, the skills, the items, the enemies, the maps, the story and characters, programming the gameplay (battle system, etc.), balancing difficulty with rewards, balancing characters and builds, etc, etc, etc. I hold a Google Docs where I constantly write new design ideas for new game mechanics, new game systems, new skills, etc. to implement in my game, so yeah I'm really passionate about that stuff. (I probably have over 200 pages of random gameplay and skill ideas with that Google Docs and a couple of txt files.)


However, I often read some game programmer AMA (like this one http://www.reddit.com/r/gaming/comments/11mz4k/i_am_a_programmer_for_guild_wars_2_amaa/) and from what I understand, it seems that all programmers do in big companies is building the game engine and the core systems for the content designers and artists to use, and that's not exactly what I have in mind. I have a programmer background but I'm far more interested in the designer kind of jobs. (Level, content, enemy, AI, gameplay, etc.)


So I guess my question is how much are game programmers usually involved in the content creation process? Do I have better chance just postulating on level designer jobs? Or to postulate on programmer and software engineer jobs and then try to work my way "from inside?"

Does MinGW support the C++0x libraries?

30 November 2011 - 03:30 PM

Was using Visual Studio 2010 but I'm sick of waiting for a C++ refactor tool or an IDE integrated C++ unit test framework (that doesn't only work in C++/CLI), and they're not even in the VS2012 preview so I made the jump to Eclipse with CDT and MinGW as a compiler and it worked awesomely for editing code. Problem is that I can't seem to be able to access the new libraries that used to work fine with Visual Studio 2010. For example, the <random> header file exists but a bunch of #ifdef macros exclude the whole file.

The C++0x features implemented in G++ (lambdas, auto, etc.) all work fine, it's just the libraries that look inaccessible.

Are those libraries actually implemented for MinGW? Am I just missing an option in the g++ command line? (I'm using std=c++0x, is there another one?) Help!