Forum C# Unable to derive from Game class

Unable to derive from Game class

Postby deetmo » August 5th, 2019, 11:15 pm

Why is it impossible to derive from Game class?
When I try to make some general purpose room code in such class:
Code: Select all
public abstract class RoomPlayer : BasePlayer
{}

public abstract class Room<TRoomPlayer> : Game<TRoomPlayer>
    where TRoomPlayer : RoomPlayer, new()
{}

And then:
Code: Select all
public class SomeRoomPlayer : RoomPlayer
{}

[RoomType("SomeRoom")]
public class SomeRoom : Room<SomeRoomPlayer>
{}


SomeRoom is invisible when uploading to PlayerIO services.

What is preety strange, when I have tried making room not abstract - PlayerIO complain about missing RoomType attribute on base class becouse it is not abstract.

Seems like a bug for me...
deetmo
 
Posts: 2
Joined: May 5th, 2019, 10:30 pm

Re: Unable to derive from Game class

Postby deetmo » August 7th, 2019, 8:27 pm

I have found issue in Init method:
Code: Select all
if (this.searchHierarchy(type, (Predicate<System.Type>) (t =>
{
  if (t.BaseType != (System.Type) null && t.BaseType.BaseType != (System.Type) null && (t.BaseType.Assembly != assembly && t.BaseType.BaseType.Name == "BaseGame"))
    return t.BaseType.Namespace.StartsWith("PlayerIO.GameLibrary");
  return false;
})))


Please fix it, as it really blocks making any frameworks using rooms.
deetmo
 
Posts: 2
Joined: May 5th, 2019, 10:30 pm

Re: Unable to derive from Game class

Postby ShadowVirtues » November 22nd, 2019, 10:23 am

I am having the same issue. I've been struggling for months to come up with a reliable solution to block simultaneous sessions from one player, since PlayerIO doesn't support it natively and in our game a simultaneous session would cause total havoc to player progress in BigDB (pretty sure it would in every serious game storing player progress). So I finally came up with the clean solution that worked wonders using abstract generic room class inheriting from Game<P>, but apparently only in development server, since when uploading the code to PlayerIO, it doesn't see any rooms that derive from such generic class, exactly like OP posted. So I would also really like this to be fixed. Or at least tell us if this will NOT be getting a fix, since we will at least be sure to have to look for other solutions (probably dirty copy-pasting the code into every room class).
ShadowVirtues
 
Posts: 4
Joined: March 13th, 2018, 8:42 pm


Return to C#



cron