Spread the love

Day 0: I am a noob

Let us turn back to a few years ago. Through Make Games SA I asked around for topics for writing challenges to learn game development. In 2012 I was the chairperson, however, you know from my “about” I’m completely different. You can find out more about them if you want to, we will focus on something slightly different today. As we are approaching GGJ (Jan 25 – 27) it should be useful to have the post this week sharing how you can get yourself into the game jam.

Step 0: Where to Start

This step is something that can help you think about what you need to do. The first thing would usually be “go and learn to programme”, that could potentially be what you do. Just note that you can start making games even if you don’t completely know how to program. Take a look at Step 1 for a small starting point you may use if you can’t program yet.

Therefore, if you do know how to program but haven’t looked at making games yet you would obviously head through to Step 2. Note, when we head through step 2 I stick to what built up my interest as a developer. In 2014 I was an intern at Microsoft, I got close in on everything and definitely had a dream of making an Xbox game.

You can understand there isn’t too much time, so Step 3 may seem like a dangerous step with GGJ being so close. It actually isn’t, if you don’t have the time currently you don’t need to do step 3. It is just a suggestion for you to see more in the development of games.

Lastly, as you will see Step 4 is “not a step”, it is for those that would like to branch out and try different engines and resources. I obviously don’t share millions, it is just to start your steps in a direction further.

Step 1: Minimal Programming

You will, no doubt, have heard of Game Maker Studio. There is a free trial that you can get for yourself and work with. I will be sharing the minimal side for you to start out. We will make a small game for ourselves. A very minimal easy game. I use a copy I own, so apologies if anything isn’t available on the free version, please let me know so I can replace it here. Also note it isn’t the second version.

As you can see above, that is the interface in Studio. It should be quite easy for you to understand. What we will pay attention to is quite simple, we will be making a very minimal game. We need Rooms and Objects at the minimum.

We will create a blank room, close the interface, then create an object:

As you can see, I left the room name “room0″and the object we will call “player”. The interface can be slightly confusing, but you can hunt for what you want to do. First off, we add an event, going through the options just select “press <up>”. We can quite easily build input in Studio.

Where to add event
How events show up

As you can see above, we have events that have a list of actions. What we do is on the right hand side add a “speed vertical” action. In the window the pops up, we choose the speed.

Close the windows using “OK”, keeping the player open. Under “Sprite” click “New”, click “edit sprite”, click on “add an empty image at the end”. Double click the image, draw what you want it to look like.


As you can see, the interface is like “paint”. Easy to get into, the grid shown behind it is the see-through pixels.

Close it all, open “room0” and open “objects” (top left of window). Place a “player” object into the room, close all and run (top of window there is a play button).

As you can see, it will move when we press the “up arrow” on our keyboard, but wait. Oops, it is moving downwards? Why is that? Well, it is simple. The window can be seen as a grid, the top left is x:0, y:0 and the bottom left x:0, y:100, and right corner x:100, y:0. That isn’t the coordinates, just so you can understand. X increases left-to-right and Y increases top-to-bottom. You can think of something you draw in mathematics like that.

We aren’t finished yet when we fix the “up arrow” taking us the correct direction. We can do similar things for the other arrow options.

Perfect, now we can move around. Though you will not we continue in the directions after pressing and releasing. You can add events for “key release” for each, setting movement to zero.

Now is the time to note, you can continue to only use the options from the drop-downs, and the bar on the right. You can do so much, that you can just hunt through and see what works for the game you are making. We will drop into the programming that is available, you can start your journey learning with this.

We add the score tracking, this isn’t all it needs, essentially every step in game logic we get 5 points:

The next thing we add is another object, “spike” and you can make it a small red circular sprite. This is where we can start sharing some programming for you. This is a very minimalist introduction, sorry that you don’t get too much necessarily. This isn’t a complete lesson to program, it is more to show you what you can use. Therefore, it is a step by step guide to doing it for yourself.

  • Create a “Create” and a “Alarm 0” event for the “Spike”
  • Inside the “Create” the code is minimal, and should be easy to understand. We set “alarm[0]” to “90”. This means it will go off when it reaches zero (these are managed by GMS, this isn’t a complete in depth tut as it isn’t the Step 2).
alarm[0] = 90;
alarm[0] = 90;
  • Next, in the alarm 0 we use a “random” which generates a random number (up to 100), and if it is higher than 90 we create a new spike object.
if (random(100) > 90)
 {
   instance_create(random(800),random(600),spike);
 }

 alarm[0] = random(100) + 50;
  • As you can see, at the end of the alarm we make a new alarm number again, this is so that this will continue running. Essentially, at a random time elapsed it will see if it should potentially create a new spike. It slowly grows.
  • We then move to the player object and make scripts in “Create”, “Step”, and collision with “Spike” (that is “add event, collision, spike” if you get lost at all).
  • In the “Create” event the code is very simple:
score = 0;
  • On the collision with the spike:
score = score - 1;
  • Then lastly in the “Step” for the player we also randomise
score = score + 5;

 if (random(1000) > 975)
 {
   instance_create(random(800),random(600),spike);
 }
  • Now as a side of notes about this. This is a very minimal game, it doesn’t show much, and it doesn’t have an ending condition. You can try for yourself to make an end game condition. You will have seen the programming is very simple here.
  • You could take a look at the in-depth documentation to find the features you would like to add.

Now, you can experiment with the documented features, move around, and add things to your games. You can have tons of different things added, this is a super simple version of this game.

Sure, we don’t have the end features. You can definitely find out more from the documentation, but when GGJ happens at the end of January you can sign up, join a site, and most of us don’t mind helping you with everything at all! You will likely join someone’s team and the can help you with your lessons.

You can get the minimal project, this essentially isn’t much at all. It definitely doesn’t have the features for any complexity in what we make. YoYo Games is the company that makes GMS, their youtube channel has tons of tutorials that are better than this, be sure to take a look at them.

There we go, you have been introduced to making games with Game Maker Studio. You can definitely get tons out of this, through the YoYo Games tutorials, and the documentation, I am certain you will find absolutely everything you think of for your game development.

Step 2: I’m a programmer

I started my journey in C# game dev using XNA in Visual Studio. Over time, this has been adjusted and changed. What we look at is MonoGame, which I use through Visual Studio 2017 (Community, which is free). I figure that free is fair. So we will walk through the project, I will once again be doing the minimal game from step 1 again, just so you will note there are differences.

I will be assuming you know what you are doing for certain parts of this step in the process, though, don’t despair.

As you will see, you only need to create a MonoGame project, when you run it you will have a window popup that is the game (so far). You will see I adjust some of the code, I dislike automatic comments, however they can help you if you have never used MonoGame before.

    public class Game1 : Game
     {
         /// <summary>
         /// Variables we use
         /// </summary>
         GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
 
         /// <summary>
         /// Initial logic
         /// </summary>
         public Game1()
         {
             graphics = new GraphicsDeviceManager(this);
             Content.RootDirectory = "Content";
         }

         protected override void Initialize()
         {
             base.Initialize();
         }
        
         /// <summary>
         /// Loading content
         /// </summary>
         protected override void LoadContent()
         {
             spriteBatch = new SpriteBatch(GraphicsDevice);
         }

         /// <summary>
         /// Game time update
         /// </summary>
         protected override void Update(GameTime gameTime)
         {
             base.Update(gameTime);
         }

         /// <summary>
         /// Game time draw
         /// </summary>
         protected override void Draw(GameTime gameTime)
         {
             GraphicsDevice.Clear(Color.Black);
             base.Draw(gameTime);
         }

         /// <summary>
         /// We won't use UnloadContent in this minimal tutorial
         /// </summary>
         protected override void UnloadContent() { }
     }

As you can see I removed the default comments and put a little bit in, this is so that you can understand what I am sharing and using for us. Everything will be minimal code that we use. Since you should hopefully know how to program you won’t need the suggested documents, I will still have them.

The variables we need to add an integer for score, a “Rectangle” for the player position, and a list of “Rectangle” for the positions of the spikes. We obviously need to drop into C#’s random functions so we need a new Random here as well. In the solution explorer, we can go to the “Content” folder and right-click on the “Content.mgcb”, choosing “open with” for ourselves. Find “MonoGame Pipeline Tool” and select it, click on “Set as Default”, then click on “Ok”. That is so we don’t need to worry about that ever again.

Create yourself a ship sprite (using something like paint), and a spike sprite. The in the content manager window you can add the two sprites using the “Add Existing Item”.

So I now have the “player.png” and the “spike.png” from Step 1 added. We can move into the content loading. We add variables for the textures as “Texture2D” for both. The inside the “LoadContent” function we add code to load sprites:

_player_tex = Content.Load("player");

I figure we can just show one, you can try it for yourself. When we see what we need to do, we can learn things quicker. As you can see in the “<>” we specify that what we are loading is a 2D tecture, and notice we ignored the “.png” file type. This is running code using the XNA structure we used to use and look at, so you can find more in the XNA documentation.

Inside the “Initialize” we can create the player position on the variable we created earlier. Specifying the size we want.

new Rectangle(400, 300, 16, 16);

I chose 16×16 as I figure I want everything to be very small on the game window. We can have more space. Then to start showing it on the screen we use the “spriteBatch” after the “GraphicsDevice.Clear” in the “Draw” function.

            spriteBatch.Begin();
             spriteBatch.Draw(_player_tex, _player_pos, Color.White);
             spriteBatch.End();

We need to initialize the “spriteBatch” which we use to draw textures onto the screen, then you see we specify the texture and position. The “Color” that we specify here can be changed to be a different color drawn, but we will stick to the default for now.

As you can tell, we didn’t have an 800×600 window like I assumed, you can adjust that to your hearts content. We are drawing the player. The next thing shared will be the input. Inside the “Update” we get them from the frameworks “Input” functions.

            var keyboard = Keyboard.GetState();
             var mouse = Mouse.GetState();

You can use simple code to start out the game logic:

            if (keyboard.IsKeyDown(Keys.A))
             {
                 _player_pos.X -= 1;
             }

As you can no doubt tell, we aren’t using the arrow keys, what happens now? Well, don’t worry about it, we can choose wherever we want to implement our input in different position when making the games. We now will only add in a little bit to our game code, then you can continue the logic yourselves to see where it takes you.

            for (int i = 0; i < _spike_pos.Count + 1; i++)
             {
                 if (_rand.Next(1000) > 965)
                 _spike_pos.Add(
                   new Rectangle(_rand.Next(800),
                                 _rand.Next(600),
                                 6, 6)
                 );
             }

Then, we obvious draw it all:

            for (int i = 0; i < _spike_pos.Count; i++)
             {
                 spriteBatch.Draw(_spike_tex, _spike_pos[i], Color.White);
             }

I have no doubt some of you would have run that, if it crashed you should note that I didn’t share all of the texture loading, I just mentioned it. This is to help you get where you need to be.

The next adjustments and updates are all at your liberty.

  • As you can no doubt tell, how we randomly make spikes explodes, you will need to make a limit. Perhaps, just adding a second restriction to the condition in the “for” loop that adds them?
  • Go through the spike positions and if it intersects with the player position we can lower to score, and remove the spike position
  • Through the project you can add a reference to “System.Windows.Forms”, then if the “score” goes below zero you can lose, then show a “MessageBox” informing the player they lost. After the message you can reset the game to the start (if you don’t it may show the message several times in a row). Note, this isn’t what we would forever, we just need to make a little win and lose condition with a notification.
  • That being said, you can add in the fact the score should go up. When you reach a certain score you can “win the game”. Its easy, just a swap from the “lose” condition we imposed.

Take a moment to think about the adjustments needed. You can definitely do tons more, add noises, write a string with the score on the top left, adjust the spawning, make it more difficult, make it longer for you to get a win. The possibilities are always endless.

Without any more balance, with it sticking to the minimal game implementation, you can get a copy of the project. This was, as I shared before, in VS2017 Community with MonoGame.

As you can tell, this doesn’t take you too far into balance. All you need to remember is you will need to go over your code every now and then. You can make it easier, more difficult, more balanced, more fun, etc. Just remember, this is meant to be a playable game. So do whatever makes it extremely fun. It doesn’t matter if it is a hardcore roguelike, I personally enjoy roguelikes as games, others do too. Do what will make the game fun in your category!

Step 3: Let’s practice

There is almost always a game jam. You don’t have to share you are entering, or even enter it. It could be YEARS after the jam happened! You can take a look at running indie game jams, and obviously, pick one to suggest what you can try and do.

We also have a category in MGSA for competitions and jams, we have competitions there that you can enter. What you can do is take a look at something somebody made and shared, then take a look at the features they implemented. Perhaps something like “that edg3 guy made something that was a mix between Sokoban and Bomberman? How can I make a character walk around moving tiles?” It can help you think of things you can test and make for yourself.

The possibilities are endless, just note that for starting out you would enjoy sticking to 2D. You can swap to 3D as soon as you want to, but we stick to 2D here for a reason. It is slightly easier to get into the 2D side when starting out your game development. We will delve into the 3D world here eventually, just not today.

Here are minimal suggestions for what you can make (apologies, some are obvious perhaps, and some may be more difficult):

  • Bomberman (simple play, simple implementation)
  • Tetris (simple to understand, can delve into turns)
  • Mario (realtime, more methods to go through)

Last year on IGN they had a good piece that took game development to new heights, you will see they share resources to go for different engines and games. It is potentially slightly too much for some to handle, but I bet there are people that are further in their game development careers (yeah, I call it a career even when it is a hobby mostly). You could definitely take that to your advantage if you see fit.

Essentially you can slowly, but surely, expand your development of games.

Step 4: Not a step

So, we don’t necessarily need to stick to the engines above. I prefer using MonoGame currently as we can go very far with it (several platforms are possible). This isn’t a step really, it is essentially where to go for your personal preferences. Perhaps you hate C#, you always use C++? For that reason we have a bit more shared in this step.

This is, essentially, to help those that are intrigued by this and want to go further. However, rather don’t confuse it as a complete swap. If you are comfortable with something (from above, for example), stick to it. This isn’t to completely change what you use, I mean sure, working for a company they might move you towards DirectX 11 in C. Going further doesn’t need to be learning new engines, it could just be continuing developing games!

  • Unity 3D – personal version is free, you will no doubt start with personal projects
  • MonoGame – completely free, open source
  • Game Maker Studio – has a free starting option for your game development
  • DirectX – free

Note: The above are only listed here to show you there are definitely different options. They swap in features, and difficulty in implementation. Languages can completely swap. Stick to whatever feels best for you when you are starting out.

On another side note, there is a lot that can be done to minimise the work flow in what you use. Next week we will be designing within our capabilities, and helping set up our projects to contribute to working in teams.