3
\$\begingroup\$

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.

\$\endgroup\$
5
  • \$\begingroup\$ You could also use Silverlight (C#) or HTML5/JS. \$\endgroup\$ Commented Feb 20, 2012 at 5:38
  • \$\begingroup\$ Canvas is surprisingly capable and easy to work with but the C# to JavaScript will probably be a bit jarring. \$\endgroup\$ Commented Feb 20, 2012 at 17:09
  • \$\begingroup\$ 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. \$\endgroup\$
    – ashes999
    Commented Feb 20, 2012 at 17:33
  • \$\begingroup\$ @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? \$\endgroup\$
    – Pepin
    Commented Feb 20, 2012 at 18:21
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Feb 20, 2012 at 23:36

5 Answers 5

4
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ 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. \$\endgroup\$
    – ashes999
    Commented Feb 20, 2012 at 17:32
  • \$\begingroup\$ 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/… \$\endgroup\$ Commented Feb 20, 2012 at 17:43
  • \$\begingroup\$ Try it yourself and see :) it didn't work for me, I gave up before SL5 came out. \$\endgroup\$
    – ashes999
    Commented Feb 20, 2012 at 18:55
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Feb 21, 2012 at 9:49
2
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ In retrospect ClassicThunder has a better answer. Silverlight is really a better plan. \$\endgroup\$ Commented Feb 20, 2012 at 8:02
1
\$\begingroup\$

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.

\$\endgroup\$
1
0
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

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