5
\$\begingroup\$

I'm looking to develop a multitouch rhythm game in C#. It is aimed to be a simulator for an existing arcade game, similar to this: http://www.youtube.com/watch?v=TAiNNpA3wwg So far, I've decided on several requirements for the game that should be present:

1) Unicode text display, without the characters being known beforehand (i.e. the displayed strings are not known at compile time, but entered in by the user).
2) Support for display of all the common image formats (PNG, JPG, BMP, and GIF) and playback of various audio (MP3, WAV, OGG, FLAC) and video formats.
3) Full multitouch support (I'd like to support as many simultaneous inputs as the user's hardware allows). VERY IMPORTANT, MUCH MORE SO THAN THE OTHER TWO.

I had been fiddling with XNA, but I've found drawing arbitrary Unicode text with SpriteFonts difficult (it hates it when you try and load the entire CJK Unified set). In addition, I haven't found an easy way to load certain formats like Ogg Vorbis audio in XNA.

So, with this in mind, I've started looking into using DirectX 10 via SlimDX. However, I'm very lost, and am unsure of how to start with it and if the features I need are even present in it. To top it off, SlimDX documentation seems to be very lacking, especially with me being new to game development. Which one of the two frameworks would be best for my goals?

P.S.: Any references to starting game development with SlimDX (June 2010) would be very helpful as well, especially in relation to Direct2D, which what I'll most likely be using.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Just a quick note: you can fairly easily render arbitrary text (characters or full strings) to a texture (XNA or otherwise) using one of the Windows APIs (the XNA content pipeline uses GDI+ internally). \$\endgroup\$ Sep 29, 2010 at 6:03
  • \$\begingroup\$ @Andrew Oh, that sounds like it'd be really useful! How would I go about it though, is there anyway to render to a Texture2D via the Windows API? \$\endgroup\$ Sep 29, 2010 at 7:11
  • 1
    \$\begingroup\$ Not directly. The basic process involves rendering text to a surface, and then copying that surface into a texture. (DirectWrite in SlimDX might give you a more direct route - I haven't used it, so I don't know for sure). Suggest you ask for the details in a new question. \$\endgroup\$ Sep 29, 2010 at 10:10

1 Answer 1

6
\$\begingroup\$

All of these are pretty high level requirements you have. You may be answering your own questions in that SlimDX is intentionally very low-level, whereas XNA tries its best to answer these high-level requirements, even if the XNA answer isn't necessarily the answer that you particularly seem to be looking for. I haven't worked with SlimDX, so I can only provide some of the perspective of an XNA developer, but hopefully some of it will be useful.

The better questions for XNA versus SlimDX more revolve around things like: which platforms are expecting to support? How much of DirectX do you know? How much of DirectX internals do you care to know?

1) This is a large problem in program design, regardless of platform. There is a reason that text layout libraries are large monstrous beasts. If full, true Unicode support is that important to you, you are ultimately going to need to use non-game-oriented frameworks like WPF, Pango, etc. WPF and/or Silverlight may in fact be a better choice for your game than XNA or SlimDX. (SlimDX does appear to give low level access to the Windows Font API, but using it is rarely as straightforward as you might think and at the end of the day WPF is still Windows' best repository of handling code for dealing with complicated Unicode issues.)

The XNA answer is that you need to find ways to cut down the amount of character graphics you load at once. Worst case that means that you write your own replacement for SpriteFont. (Writing a better SpriteFont isn't terribly hard, and to my knowledge you would need to do something like that in SlimDX anyway.) Most likely you find ways to partition and dynamically load SpriteFonts (that are each individually much smaller than, say, CJK Unified) as necessary at runtime. Certainly XNA doesn't have any direct samples to that effect, but you may find something in the community to help.

The most common answer is really just to constrain your input set. Supporting all of Unicode is hard, but it is easy enough to find common subsets that should make most of your users happy. I'd suggest taking a look at the input methods in various games. You'll notice, for instance, that even in CJK modes something like the Xbox built-in keyboard is going to use just a fraction of CJK Unified... A game isn't a word processor and gamer probably isn't going to expect full unicode support at runtime.

2) There are many .NET libraries that you can find to support various formats. Most of the image formats have good support in the standard library. Music and video formats can be trickier depending on how much you really need them (and which platforms you are looking to support). Again, taking good limits here can drastically simplify what it is that you are trying to accomplish.

For instance, one strong available library in XNA is the MediaPlayer interface:

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.mediaplayer.aspx

This API particularly allows you to interact with people's music libraries on the Xbox and Windows Phone 7 (and Zune). If you want people to provide their own music libraries, on those platforms, that is the API that you must use (there are no other options), and you are going to have to accept its limitations in format support. (Which most people will already be used to and have knowledge of if they are storing portions of the music libraries on those devices.)

On Windows there are certainly many more options for libraries that you can make use of for format support. Finding these libraries are probably going to be the same research regardless of XNA or SlimDX.

3) Multitouch is equally complicated in both XNA and SlimDX. XNA provides a useful multitouch API for Windows Phone 7 (and Zune HD):

http://msdn.microsoft.com/en-us/library/ff434208.aspx

Unfortunately the XNA multitouch API doesn't currently support Windows. On Windows with both XNA and SlimDX you will probably be using the same Windows multitouch API, which to my knowledge doesn't have a good, strong managed (C#) wrapper at all:

http://msdn.microsoft.com/en-us/library/dd371406(VS.85).aspx

There may be third party libraries that you can find, but again, that research will probably be the same regardless of what your framework game is built in.

\$\endgroup\$
5
  • \$\begingroup\$ For target platform, I'm planning a Win7-only release (the screen size needs to be pretty large, so mobile devices are out). I don't know any DirectX, but I wouldn't mind learning it if it's what is needed for the task. I thought Windows 7 had built-in multitouch support, though? I'm surprised that XNA doesn't leverage that, and I hadn't heard that XNA touch capabilities were limited to Windows Phone 7 and Zune HD. If anything, the multitouch support is of primo importance; without it, I literally cannot create this game. \$\endgroup\$ Sep 27, 2010 at 5:48
  • \$\begingroup\$ The explanation I have heard that XNA Touch API doesn't support Windows is that Windows Multitouch API works quite differently than Zune/WinPhone 7 (fewer HW differences, simpler APIs), and Zune/WP7 was the priority for XNA. The Windows 7 Touch API is linked in my answer and will be equally hard to work with in XNA and SlimDX, so you may want to pick the one you prefer to work with or know better. Here's an example I found in Google for using XNA with Windows 7 multitouch: xna-uk.net/blogs/randomchaos/archive/2010/02/10/… \$\endgroup\$
    – WorldMaker
    Sep 27, 2010 at 9:16
  • 1
    \$\begingroup\$ Also some searching turned up this library: multitouchvista.codeplex.com It sounds like it may be the most useful managed, multitouch library out there. It is focused on WPF, and I do still think that WPF may be the best solution that you aren't considering for your game, from your requirements. \$\endgroup\$
    – WorldMaker
    Sep 27, 2010 at 9:23
  • \$\begingroup\$ Hmmm, it does indeed look like I should be giving WPF a second look. I had discounted it because I wasn't sure if it was snappy enough to create a game like this (essentially what I'm trying to emulate): youtube.com/watch?v=TAiNNpA3wwg But I suppose I could experiment. \$\endgroup\$ Sep 27, 2010 at 15:38
  • \$\begingroup\$ Update: I've stumbled upon Shawn Hargreaves' blog, which had this article: blogs.msdn.com/b/shawnhar/archive/2010/09/09/… This looks like it might be the ticket to multitouch in XNA on Windows 7! \$\endgroup\$ Sep 28, 2010 at 7:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .