Take the 2-minute tour ×

I wish to try and create a TCG using C#/XNA that would run inside a web browser. Some of the main game's features would be:

  • At least 2.5D to imitate the card flipping/shuffling and etc. effects
  • Simple particle effects (maybe even none at all)
  • Use of scripting since each card would have its own abilities/type/effects
  • Utilization of relational databases(cards themselves, users, profiles, decks, etc.)
  • Lobby
  • Chat rooms
  • Buddy list
  • Free

Is such thing possible? You might want interject and point me towards Flash/AS3 as a better alternative, but the thing is I'm much more versed in C# than AS3 and never worked with Flash.

Also, I believe Unity has a WebPlayer and uses C# as one of its scripting(?) languages. Thing is, I want to make sure that the game can run on pretty old PC/Laptop/maybe Tablet and or smartphone hardware.

Suggestions? Warnings? I'm just brainstorming about this at the moment to select the right technologies(aka C#/XNA/? if possible or Unity/C#/Unity WebPlayer) to start researching further on my own. Not a single line of code has been written.

share|improve this question
You could also use Silverlight (C#) or HTML5/JS. –  Jonathan Hobbs Feb 20 '12 at 5:38
Canvas is surprisingly capable and easy to work with but the C# to JavaScript will probably be a bit jarring. –  ClassicThunder Feb 20 '12 at 17:09
Read my comment on ClassicThunder's answer, SilverSprite is a VERY bad idea, I wasted a lot of time trying to make it work; it's very buggy and not well supported. –  ashes999 Feb 20 '12 at 17:33
@Jonathan Hobbs - HTML5/JS looks very interesting. I'm all for the idea of letting user jump straight into my application without installing any third party stuff(Unity WebPlayer/Flash Player). By JS I assume you mean that I have to choose between different types of libraries/apis that are made for/with JS, and use HTML5's canvas? Which library do you think will fit the task? –  Pepin Feb 20 '12 at 18:21
Yes, pretty much. I have no library recommendations, having not done this myself before. I just know it's quite doable. For instance, Angry Birds Chrome is HTML5/JS and I can't distinguish it from the iPhone version. –  Jonathan Hobbs Feb 20 '12 at 23:36
add comment

5 Answers

Silverlight 5 has an graphics API that basically a subset of the full XNA library. Its pretty capable, can handle 3d, and most basic XNA could be dropped in minimal changes.

Also there is an active community and libraries dedicated to improving its capabilities.

share|improve this answer
Very very strongly disagree. I used SilverSprite for two years. There's virtually no documentation or community, and their library is VERY glitchy (eg. no working audio -- spent 200 rep on SO trying to solve this). I would stay away. –  ashes999 Feb 20 '12 at 17:32
I though Silverlight 5 supports the XNA SoundEffect class so audio isn't even handled by SilverSprite anymore. Why wouldn't something like this work? 10rem.net/blog/2011/04/13/… –  ClassicThunder Feb 20 '12 at 17:43
Try it yourself and see :) it didn't work for me, I gave up before SL5 came out. –  ashes999 Feb 20 '12 at 18:55
All I recall about Silverlight was the difficulties getting decent screen redraws without tearing or jumping - it was a mess back in the early days, but perhaps it works better now. –  Oskar Duveborn Feb 21 '12 at 9:49
add comment

Technically it is possible by making an OCX browser control (I am not sure if this will work in browsers other than Internet Explorer) and host XNA inside of it, finally you will likely need to write your own ContentManager and override OpenStream so that it grabs resources from your web server. Keep in mind that this doesn't 'save' your clients from needing to download the .Net runtime or the XNA runtime - furthermore your runtime will still need to be installed manually and GACed (because otherwise you would be running in partial trust and I doubt the .Net runtime will allow XNA to boot up).

However, I really recommend Unity because they have already tackled all of these issues (so you don't have to waste your time tacking them): and C# is a supported language in Unity.

share|improve this answer
In retrospect ClassicThunder has a better answer. Silverlight is really a better plan. –  Jonathan Dickinson Feb 20 '12 at 8:02
add comment

Consider Mono and Native Client. Mono is programmed in C# (It runs on Linux, Mac and Windows without .NET) and Native Client allows applications written in C/C++, C#, Java and other languages to run within Chrome Browser. The gonacl site has details about Native Client and you can watch recent video of a Native Client event that took place in December.

Note. Currently NaCl as it's called works mainly with C/C++ but the Mono C# compiler generates compatible code. There's not a lot of documentation out about it yet with Mono but Mono is being pushed as a major dev platform for NaCl.

share|improve this answer
The NaCl port of Bastion was implemented like this. its a C#/Xna game that was ported to Mono/MonoGame (?) details were in this talk altdevblogaday.com/2012/02/09/altdevconf-programming-laban Dont know if there is a recording –  Cubed2D Feb 21 '12 at 8:49
add comment

http://jsil.org/ will provide you the ability to convert an XNA spritebatch based game to Javascript so that it's playable in a browser.

That being said, I'd suggest it's probably easier in the long run to learn Javascript directly and write something for the Canvas element (e.g. a nonsense example I wrote very quickly at http://lzcd.com/mat ) or via one of the Javascript gaming libraries such as Easel ( http://easeljs.com/ ).

That way you don't have to worry quite so much about supported browsers or operating systems.

share|improve this answer
add comment

There's always PlayN. I tried it, but didn't like the lack of documentation and long compile times required by the Google Web Toolkit (it's known to be slow). Still, it may fit your needs well.

share|improve this answer
add comment

Your Answer


