Forum Multiplayer Can't use Debug Visualization as per Documentation

Discussion and help relating to the PlayerIO Multiplayer API.

Can't use Debug Visualization as per Documentation

Postby qugengames » December 12th, 2018, 6:14 am

On https://playerio.com/documentation/services/multiplayer/developmentserver documentation states you can use System.Drawing for viusual debugging as follows:
Code: Select all
public class MyGame : Game<BasePlayer> {
    public override void GameStarted() {
        // Update the debug view once a second.
        AddTimer(delegate{
            RefreshDebugView();
        }, 1000);
    }

    public override Image GenerateDebugImage() {
        var debugImage = new Bitmap(400, 375);
        using(var g = Graphics.FromImage(debugImage)) {
            // draw the background
            g.DrawImage(EmbeddedResource.GetImage("tictactoe-bg.png"), 0, 0);

            // draw the game state
            var circle = EmbeddedResource.GetImage("circle.png");
            var cross = EmbeddedResource.GetImage("cross.png");
            g.DrawImage(circle, 35,45);
            g.DrawImage(cross, 260,260);
            g.DrawImage(circle, 260,45);
            g.DrawImage(cross, 153,45);
            g.DrawImage(circle, 153,153);
        }
        return debugImage;
    }
}


But if you add System.Drawing reference to the game code you get the Static Variable denial on PlayerIO.
So how are we supposed to visual debug?
qugengames
 
Posts: 36
Joined: April 24th, 2018, 11:19 pm

Re: Can't use Debug Visualization as per Documentation

Postby robscherer123 » December 12th, 2018, 3:37 pm

How are you referring to your game code that it is throwing an error? It seems to work fine for me, are you trying to use a static variable somewhere? What is the exact line you are using that is getting denied?
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Re: Can't use Debug Visualization as per Documentation

Postby qugengames » December 12th, 2018, 5:55 pm

robscherer123 wrote:How are you referring to your game code that it is throwing an error? It seems to work fine for me, are you trying to use a static variable somewhere? What is the exact line you are using that is getting denied?


Hi,
You can't create an embedded resource to include an image as it creates static variables
qugengames
 
Posts: 36
Joined: April 24th, 2018, 11:19 pm


Return to Multiplayer