# [Silverlight 4.0] Spacewarrior - programming game

6 replies to this topic

### #1cjub

New Member

• Members
• 2 posts

Posted 19 November 2010 - 06:08 PM

Hi,
I've created a programming game called SpaceWarrior. The idea of this game is to implement an algorithm to control a warrior and let him fight against others. Is quite easy, it takes about 30 seconds to create your first warrior and all you need is just a web browser with Silverlight plugin. You can implement your code in C# or VB.Net. Of course it's completely free. You're only asked to register, so that you can be identified by other players.

www.spacewarrior.net

screenshots:
www.spacewarrior.net/screenshot1.jpg
www.spacewarrior.net/screenshot2.jpg

any comments and suggestions will be appreciated

### #2TheNut

Senior Member

• Moderators
• 1696 posts
• LocationThornhill, ON

Posted 19 November 2010 - 10:56 PM

Interesting. I didn't spend much time coding up a bot, but it's interesting to see Silverlight being used like that to promote AI development. I take it you upload the .NET code to your server, compile it, and then download the result as a plugin to Silverlight? Have you ever thought about adding a JavaScript API? You could start an interesting war between programmers and wannabes :lol:

So overall it's good. What are your next plans with it?
http://www.nutty.ca - Being a nut has its advantages.

### #3cjub

New Member

• Members
• 2 posts

Posted 20 November 2010 - 08:11 AM

I upload the code to my server, perform some AST-based code analysis to prevent endless loops and stack overflows, compile and send back to client as an assembly, not as a plugin. I've been thinking about adding more languages, for example Java, I found a way to call Java methods in .Net, but it's quite complicated and I don't know if it's worth it. All depends on how many people will want to use this app.
I'm not too good in Javascript but AFAIK it's not possible to use it directly in C# like you could do with Java. I'd have to prepare a lot of predefined methods and users would be limited just to them. But as I said before, if people play this game then I'll think about new features, languages or some kind of API

### #4TheNut

Senior Member

• Moderators
• 1696 posts
• LocationThornhill, ON

Posted 20 November 2010 - 12:43 PM

Silverlight has a powerful HTML bridge that allows you to talk and receive commands from JavaScript. You can even work with Silverlight classes and events in JS. Since you already have the game API defined, all you need to do is allow them to be called from JavaScript by assigning the ScriptableType attribute to your class or optionally ScriptableMember attribute to individual members that should be exposed. After that, just call HtmlPage.Window.Invoke("OnAction") on each frame render so JS can perfrom logic. Check up on it here: http://msdn.microsof...28VS.95%29.aspx.

The neat thing about this approach, as well as other DLR languages lke iron python and iron ruby, is that you can code your solution in real-time. You don't have to send it off to be compiled. That would save you \$ from operating costs.

cjub said:

But as I said before, if people play this game then I'll think about new features, languages or some kind of API
I see your point, but remember the novel Shoeless Joe. "If you build it, they will come" :)
http://www.nutty.ca - Being a nut has its advantages.

### #5Mihail121

Senior Member

• Members
• 1059 posts

Posted 21 November 2010 - 10:22 AM

Neat idea, you might also consider:

Gun-Tactyx -- http://apocalyx.sour....net/guntactyx/
Meka-Wars -- http://apocalyx.blog.../label/MekaWars

You write the combat logic (strategy) in each game.

### #6Gr1d

New Member

• Members
• 4 posts

Posted 05 December 2010 - 06:14 AM

I just had a play, I really like it. I'm trying something kind of similar here http://gr1d.org

### #7Luz Reyes

Valued Member

• Members
• 112 posts

Posted 06 December 2010 - 10:08 PM

I give my approval of this game. Played it during lunch and didn't want to stop!

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users