Monday, November 23, 2020

Stressful period over

Sorry for going dark the past week. I was going through a stressful time this past week and was unable to focus on projects, including my personal projects. The good news is that the issue is resolved successfully as of today so I will be able to get back to my normal routine. I will be starting work on tutorials again tomorrow, not sure what yet. It will either be Eyes of the Dragon or Dragon's Claw.

Monday, November 16, 2020

What's Next?

I took the weekend to see where I stood in my tutorials and projects. I feel Shadow Monsters is mostly done and will be keeping it on the back burner unless I get requests for a specific topic. That leaves my major series Eyes of the Dragon and Dragon's Claw. I have done some work on the next Eyes of the Dragon series and should publish it next week some time. Dragon's Claw takes more time but I have the full code base for what I plan to achieve with it already done. It is the process of moving it between projects and then writing the tutorial.

For my projects they are going well. Silver Prophet is mostly about content and is slow going. I don't know if I can reach my end goal on my own because the maps will be well over one million tiles and painting that by hand will be extremely time consuming. Shadow Monsters is similar. It needs content and effects.

Thursday, November 12, 2020

Dragon's Claw Tutorial 3

I have just published the third tutorial in the web game programming tutorial series Dragon's Claw on creating a turn multiplayer strategy game. This tutorial goes over the process for training troops. You can find the link to the tutorial on the Web Game Programming Tutorials page of the site or you can use this direct link.

Wednesday, November 11, 2020

3D Tile Engine and More

 I have posted the second tutorial in my 3D tile engine tutorial. This tutorial moves everything to a library and adds a customer shader instead of using a basic effect. I also update the tile set so that it is a power of two so it can be loaded onto the graphics card. You can find the tutorial on the MonoGame Tutorials page of the web site or use this direct link.

I'm also working on the third tutorial in my web programming series Dragon's Claw. I hope to have it finished tonight or tomorrow. Keep checking back for more details.

Tuesday, November 10, 2020

Updated Frames Per Second Counter

I made an update to my FPS counter. It is great to know the current FPS but the average FPS is also of great value. It gives you a better sense of how your game will perform over time. I also included a reset in case I need to test different areas of the game I'm working on. I thought I'd share the updates.



public class FramesPerSecond : DrawableGameComponent
{
    private float _fps;
    private float _updateInterval = 1.0f;
    private float _timeSinceLastUpdate = 0.0f;
    private float _frameCount = 0;
    private float _totalSeconds;
    private float _afps;
    private float _totalFrames;

    public FramesPerSecond(Game game)
        : this(game, false, false, game.TargetElapsedTime)
    {
    }

    public FramesPerSecond(Game game, 
        bool synchWithVerticalRetrace, 
        bool isFixedTimeStep, 
        TimeSpan targetElapsedTime)
        : base(game)
    {
        GraphicsDeviceManager graphics = 
            (GraphicsDeviceManager)Game.Services.GetService(
                typeof(IGraphicsDeviceManager));

        graphics.SynchronizeWithVerticalRetrace = 
            synchWithVerticalRetrace;
        Game.IsFixedTimeStep = isFixedTimeStep;
        Game.TargetElapsedTime = targetElapsedTime;
    }

    public sealed override void Initialize()
    {
        base.Initialize();
    }

    public sealed override void Update(GameTime gameTime)
    {
        KeyboardState ks = Keyboard.GetState();

        if (ks.IsKeyDown(Keys.F1))
        {
            _fps = 0;
            _afps = 0;
            _timeSinceLastUpdate = 0;
            _totalFrames = 0;
            _frameCount = 0;
            _totalSeconds = 0;
        }

        base.Update(gameTime);
    }

    public sealed override void Draw(GameTime gameTime)
    {
        float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
        _frameCount++;
        _timeSinceLastUpdate += elapsed;
        _totalFrames++;

        if (_timeSinceLastUpdate > _updateInterval)
        {
            _totalSeconds++;
            _fps = _frameCount / _timeSinceLastUpdate;
            _afps = _totalFrames / _totalSeconds;

            System.Diagnostics.Debug.WriteLine("FPS: " + _fps.ToString());
#if !ANDROID
            Game.Window.Title = "FPS: " + _fps.ToString();
#endif
            _frameCount = 0;
            _timeSinceLastUpdate -= _updateInterval;
            System.Diagnostics.Debug.WriteLine("AFPS: " + _afps.ToString());
#if !ANDROID
            Game.Window.Title += " - AFPS: " + _afps.ToString();
#endif
        }

        base.Draw(gameTime);
    }
}

Sunday, November 8, 2020

New Tutorial Series - 3D Tile Engine

 I've started a new tutorial series on creating a tile engine using 3D rendering instead of SpriteBatch for drawing the tiles. The first tutorial is available on the MonoGame Tutorials page of the web site.

Saturday, November 7, 2020

Discord!

 I have just finished creating a Discord server for Game Programming Adventures. You can access it with the following link: https://discord.gg/UQSqxY6tR6. I'm hoping you can join and spend some time here. We can talk about the various forms of game programming and programming in general or just chat about anything.

I'm having a bit of a drought as far as programming and writing is involved. Just can't really focus and my productivity is down. I really fell during the Game Jam on Wednesday and haven't been able to focus at all. It was a struggle to get me entry finished and submitted. I'm hoping taking it easy over the weekend resolves the issue.