.netprojects-and-solutionsproject-planningrobocode

Developing a Robocode type game with .Net, for a School Assignment


I am currently in my final year at school, studying for a Higher National Diploma in Computer Studies, and basically in this final semester, we need to develop a Software Project, that basically incorporates a whole system.

Now, what I'm thinking of doing is something along the lines of Robocode, but instead of Java, I will be doing this with the .Net Framework.


What is Robocode ?

For those of you don't know what Robocode is, it's basically a sort of programming game in where people develop their own robots using methods from the class interfaces and downloadable classes that exist, and then they fight each other in an autonomous battle in an arena...like such:

alt text
(source: com.com)


So basically, as I said, I want to recreate this sort of scenario using the .Net Framework..and I am posting this question here on StackOverflow in hope that more experienced developers will be able to guide me in the right direction for this project.

What I have in mind up till now is basically to create:


Animation and Graphics (for the actual battles)

Now, of course there will be some sort of animation and movement when the battle occurs, and I haven't decided what yet to use as a medium for this.

The options I currently have in mind are:

What do you think could be more suitable for this particular scenario ?


Developing Classes and Interfaces

For the players to develop the robots, I will provide certain Class Interfaces that they will be able to use like in Robocode.

Examples of such events and methods may include:

public void run () {}
public void onScannedRobot(ScannedRobotEvent e) {}

walk(/* ammount in pixels or w/e to walk to */);
turnRight(/* value in degrees for an angular turn */);
//etc...

Here is a snippet from code in Robocode (Java) :

public class MyFirstRobot extends Robot {
    public void run() {
        while (true) {
             ahead(100);
             turnGunRight(360);
             back(100);
             turnGunRight(360);
         }
    }
}

For then to actually make the battles happen, I am thinking of using Reflection to actually read what methods the user is actually making use of and implementing them to run and be invoked at particular moments of the battle and such.


Now, what I kindly and humbly ask of you experienced developers, is to guide me a bit through this project of mine and advise me on what needs to be done...for starters, is this project feasible at all ? And if it actually is, from where do I need to actually start with my project?


As regards technologies and software I intend to be using are :


I thank you all, even for managing to read up to this point in my question and I will need and appreciate greatly all the help I can get to finish this project.

Thank you for your time and effort.


Btw, up till now, apart from Robocode, I have found these games that are similar to what I am trying to create:


Solution

  • When I began working with WPF (which is much the same as Silverlight) I ended up spending a lot of time figuring out how to do things. It is a very different way of making a GUI than what else I've tried and there seems to be a billion different ways to do things. My point is, that if you have no experience with WPF/Silverlight I suspect it is going to take a lot of time for you to wrap your mind around. I guess it depends on what you already know.

    Apart from than, I wholeheartedly support ChrisW's suggstion about incremental development. I'll give you an idea of how you can approach the design of the game. Start out with a very simple API for the bots, say two functions with no events, input or knowledge of the world. Just start by getting the bots to move. The point is to get a fully functioning program with the simple functionality, including all parts from loading the client code to showing the resulting 'battle'.

    Each bot should implement an interface with a single method run() and be in their own dll file. When the battle starts, each dll with the interface implemented is loaded (using reflection) from a certain location and instantiated. Then start a battle with a loop until 1 minute has passed (or whatever, just to see that something is going on):

    while (time is not up)
       generate random sequence for bots
       call run() on each bot
       draw(world)
    

    When the time is up, the battle is over. Now you have a skeleton application which you can begin to flesh out and which will let you have a working program, even if you won't have time to make all the functionality you would like. In the run method, the bots can call the couple of move actions you have defined in the API. Calling these will change the state of the world - probably just a grid of tiles, and the location of each bot.

    The next step could be to add a view of the world to the bots' run method, changing the loop to this:

    while (time is not up)
       generate random sequence for bots
       call run(WorldView) on each bot
       draw(world)
    

    Let's say that the bots can still only perform a couple of move actions in their run method. Now they have the option of getting a view of the world (or their part of it) which allows them to move towards or away from enemies and avoid walls.

    In the next iteration you could then create a single API function to shoot you cannon (or whatever is appropriate your game). Implement how this changes the world state, how the bullets are tracked and how the animation is represented, etc. The loop could look something like this:

    while (time is not up and there are more than 1 bot alive)
       advance projectiles
       calculate projectile-bot collisions and damage
       generate random sequence for bots
       call run(WorldView) on each bot
       draw(world)
    

    I hope this gives you an idea of how you can iteratively flesh out the program, all the while having a working program that reflects all the areas of the game. I don't have much experience with implementing games, so you should look at my advice with a critical eye but this is how I would attack the problem.