Reprojection experiment

I was just playing around with this strange idea I had. When walking around, the old image information is recycled to compose the new image. That is, until you press a button to refresh the information for your current position.

Can you get a feeling for where you are in the environment?
I’m not sure what I will do with this. I have several ideas to turn it into a game, but I’ll have to investigate what works best.

(Model is the public domain Sponza model, by Crytek.)

Porting a 3D XNA game to the Mac using MonoGame

When making a cross platform game, XNA is generally not a good choice because it depends heavily on the Windows-only .NET framework and DirectX. In my case, the Mac OS X port came as an afterthought. After creating the game Seven Dimensions for the 7 day FPS challenge, some people requested a Mac version. I thought it was impossible to recompile an XNA game for Mac OS X, but a friend of mine said it could be done! I decided to go for it. If it worked,  it would make XNA a lot more versatile.

Step one: Get a Mac

At first I tried to use Mac OS X in VMware. Running Mac OS X was surprisingly easy, thanks to a pre-made solution found on the internets. But I didn’t succeed in running any type of 3D game at all. I guess the VMware graphics driver can’t handle slightly more complicated graphics. On top of that, Xcode seemed to be impossible to install. Fortunately, I could borrow a Mac from a friend.

Step two: Setting things up

There’s an excellent guide here (part 2 here) which describes everything you need to download and install. However, that guide is aimed at 2D games (using SpriteBatch only). There are some small differences if you want to use 3D graphics with custom shaders. Most importantly, you need to use the develop3d branch of MonoGame (at the time of writing).

Any shaders you want to use have to be compiled into an intermediate MonoGame format. To compile the shaders, you need a Windows computer. Open the 2MGFX solution found in the develop3d branch under Tools. This solution depends on additional dependencies which you have to download separately. Go to the develop3d branch of the github repository and go to the ThirdParty folder. Click on the green “Libs” folder, download that as a zip file and place it in your local ThirdParty/Libs folder. Now you should be able to compile the 2MGFX solution. The compiled program is the command-line tool you have to use to convert your .fx shaders to .fxg shaders. Make sure to open the .fxg shader in a text-editor to see if there is shader-like code in there.

You should test your setup using the CartBlanche sample Particle3DSample. If it compiles and runs without crashing immediately, you’re ready to port your game.

Step three: Porting your game

Prepare your project as described in part two of the guide mentioned above. Your code should compile almost directly. But unfortunately, you will encounter problems when running your game. The problems are very project-specific. These are the problems that popped up in my project:

  • The Game class was destroyed instantly causing an exception that the Game class was used while it was disposed. It turns out that Mono handles the “using (game = new Game())” syntax  in program.cs differently. Simply rewrite this code to avoid the “using” syntax.
  • EffectParameters were not found. This can be caused by two things. First of all, if a parameter is not used in the effect, you can’t set it. Secondly, texture effect parameters cannot be found. The texture should be set using the texture sampler EffectParameter instead.
  • The sampler settings defined in the shader were lost. You should set these settings from c# using the GraphicsDevice.SamplerStates collection.
  • The Mouse.SetPosition function does not work. I worked around it, maybe it’s fixed in a later version of MonoGame.
  • The viewport position offset was mirrored vertically. This is easily fixed by correcting the offset of the viewport you create.

Step four: Hope for the best

MonoGame uses OpenGL instead of DirectX, which can cause obscure problems. Your game might behave strangely on some hardware for no clear reason, especially if you use uncommon graphics features. Seven Dimensions uses line-drawing in combination with depth testing, which is very uncommon. The depth testing didn’t work for the line drawing, so I had to rewrite the game to use triangles instead. There are still other problems on older hardware which I haven’t been able to solve yet.

In total, I spent one day (8 hours) on the port. That’s very little considering that most time was spent on figuring out how to use MonoGame for 3D. The resulting port is not perfect, but MonoGame is still in active development so it will only get better!

Presenting: Seven Dimensions

Seven DimensionsThe seven day FPS challenge is over, and my game is finished! It could be more polished, but I’m really happy with it considering the time constraints.

Seven Dimensions is a puzzle FPS where you play in seven dimensions simultaneously. Is your spatial reasoning capable of understanding these strange worlds?

Go to the page of Seven Dimensions.


I’ve joined the 7DFPS game development challenge. The goal is to make a non-traditional FPS in seven days. This post also appeared here at the 7DFPS website.

A 7 dimensional FPS has been suggested by several people on the twitternets, but no one seemed to be serious about it. As if it couldn’t be done… That touched my Barney-Stinson-button so I immediately said: Challenge Accepted. (With the really serious face.)

After investigating seven dimensional space for countless hours (30 minutes), I found that it is quite an exceptional space. Several calculations defined on 3D spaces are also possible in 7D, but not in the dimensions in between them. The 7D cross product is defined, and octonians can be used for rotation (similar to the quaternions for 3D). Then I watched this video on youtube, which shows a rotating cube in 7D. It struck me that the seventh dimension is really ludicrously insanely difficult for a human to understand (Yes, that difficult). Let’s first see if Miegakure will succeed in explaining the fourth dimension before starting with a higher dimension…

Because failing the quest for a 7 dimensional FPS is not an option, I decided to look at it differently. If I could lower the complexity by decoupling some of the dimensions, it might be possible to make something that’s actually understandable! I decided to decouple the space to 4 separate worlds, three 2 dimensional worlds and one 1 dimensional world (2+2+2+1 = 7). Is this cheating? Well, a little bit… My game doesn’t offer the full complexity of the seventh dimension. But on the other hand, 7DFPS is about making fun games and the seventh dimension wouldn’t be fun to play in.

Now I just have to make one 1D world and three 2D worlds. Easy right? But wait, it can’t be a normal game with 2D graphics, it has to be 2D in first person. How does that work? A 3D FPS has three axes: width, height and depth. For a 2D first person perspective, one of them has to be ditched. The depth cannot be removed because that’s necessary for the first person perspective, so it’s either width or height. Removing the height seemed like a sensible decision so I went with that. Now there’s still the 1D first person perspective left. There’s not really a choice but to remove the width as well. So the 1D first person perspective has only depth. Okay WTF?? Time for a screen shot.

7 Dimensional FPS Concept

That’s how it looks like at the moment. The 2D worlds have no height, so they are just a line (scaled a bit to make it more visible). The 1D world doesn’t even have width, so it’s just a dot (also scaled for visibility). It’s very hard to get a sense of depth from these images, but it gets much better when you start moving.

There still has to be some sort of shooting game in these weird worlds… Let’s keep it simple, because we don’t want the player’s brain to explode. What about hitting green targets, and not hitting red targets? You move simultaneously in all four worlds, so you’d have to be careful not to hit a wrong target in a world you’re not focusing on. It would be more of a puzzle game than an action game this way.

This puzzle concept is also a great opportunity to make the 1D world useful. Because you can’t rotate in the 1D world, your shots will always hit the closest target. If there are five green targets and one red target at the back, you can only shoot five times (simultaneously in all worlds) because your sixth shot would hit the red target in the 1D world. This can be used as a sort of natural ammo system. If each 2D world has one green target (3 in total) and if you would have only 1 green target in the 1D world, you’d have to hit all 3 green targets in the three 2D worlds with one shot.

Curious how this will turn out? Follow my progress here, on my twitter, or on my blog.
Have any questions/feedback? Please let me know!

Presenting: A Sense of Music

A Sense of Music has been released today!

It is an experimental music game which focuses on enhancing your immersion in the music. It is not a goal-based game, like most music games, but a very unrestrictive experience-game. The game also incorporates the ideas explained in the previous post, as it does not have any explicit rewards.

Go to the website of A Sense of Music.

A Sense of Music