Forum C# Inheriting from Game Class Twice

Inheriting from Game Class Twice

Postby HVStudios » January 28th, 2014, 12:56 am

We're using some inheritance to mix game-specific code with generalized reusable code, but we're running into a couple issues and were wondering if there are any ways around them, or if we are doing something wrong.

All we're trying to do is include a layer of reusable server code between our main room type and the base "Game" class:
TTTGame<T> inherits from FoundationGame<T> inherits from Game<T>.

Our main Game class is like this (some psuedo-code here):

Code: Select all
namespace TTTServer
{
   [RoomType("TTTRoom_1.1")]
   public class TTTGame : FoundationGame<TTTPlayer>
   {
            // This method is called when a player sends a message into the server code
            public override void GotMessage(TTTPlayer player, Message message)
            {
                 bool handled = true;

                 //Handle messages
                 switch(message.Type)
                 {
                      default:
                        handled = false;
                        break;
                 }

                 if(!handled) { base.GotMessage(player, message); }
            }
    }
}


As you see, it inherits from FoundationServer, which looks like this:

Code: Select all
namespace FoundationServer
{
   public abstract class FoundationGame<T> : Game<T> where T : BasePlayer, new()
   {
            public override void GotMessage(TTTPlayer player, Message message)
            {
                 // Do stuff.
            }
    }
}


This code compiles fine and runs in the development server environment fine. However, if I try to upload the code to PlayerIO, I get an error along the lines of "No room type in the DLL". I'm unsure if that error message is a response to an unusual code structure, or if there is something about this structure that would genuinely cause problems on the PlayerIO infrastructure.

Any thoughts or insight into the issue? If this sort of thing worked, it would be pretty handy.
HVStudios
Paid Member
 
Posts: 20
Joined: July 30th, 2013, 7:15 pm

Return to C#



cron