Roguelike Tutorial - Part 1 - Character and Map

This article is part of an out-of-date series that will be replaced in the future.

In this series of tutorials we’ll look at creating a roguelike while using SadConsole. SadConsole is a .NET library that works with MonoGame to create a tile based game. The focus of SadConsole though is to treat the tile system like a classic terminal or command prompt system.

NOTE
The namespace for the class should be what you entered in step 8.

Save Program.cs and go back to the project properties window (step 7).

Click the Startup object drop down and choose your program class. (You may need to compile first)

Save the project.

Compile and run.

When the game runs you’ll see a blank black window show up. The SadConsole window clears the screen black by default (since a terminal is generally black). Our screen was sized to what our font was using. The IBM font we have uses characters that are 8px x 16px in size. We told the game window to be 80 x 24 of those cells.

Handle some global keyboard hooks

The Update method is called once per game-frame. This is a good place to check the keyboard for some global states, like whenever you want to close the game or toggle full screen.

1234567891011121314

privatestaticvoidUpdate(GameTime time){// Called each logic update.// As an example, we'll use the F5 key to make the game full screenif (SadConsole.Global.KeyboardState.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.F5)) { SadConsole.Settings.ToggleFullScreen(); }elseif (SadConsole.Global.KeyboardState.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Escape)) { SadConsole.Game.Instance.Exit(); }}

Printing a game character

In the Init method we need to create a new console for SadConsole to use. In the center of it we’ll print a '@' character to simulate the player and then assign the console as the “current screen.”