Friday, July 14, 2017

Mulletman is more than his legacy hair style.

A friend asked me why he would want to be Mulletman? Who wouldn't want to be Mulletman? I quipped. But... who is Mulletman? he asked. And I thought for a second, Mulletman is more than a backup hero, he is more than the guy you call when Batman's sidekick Robin is busy. Sure, he doesn't manifest any super hero powers, he can't fly, but who can?

Everyone needs to know that Mulletman is more than his legacy hair style. Let me tell you about the man, Mulletman buys a lot of shoes, like seriously, a lot, because he wears his shoes out by kicking ass. Second, the blood on Mulletman's hands is never his own. And third, it's time to reveal his name, Hank Steel, and he is just an average hero from the 80's.

Thursday, June 15, 2017

SDL2 + C# The Quick Start Guide

The primary goal of this Tutorial is to introduce C# developers to SDL2 development. The secondary goal is to provide existing SDL and SDL2 developers with a SDL2+C# quick start guide. I recognize that this is pretty niche, which is why this might be the only tutorial on the subject that doesn’t require some fat middleware framework.

What does this tutorial demonstrate?

Using SDL2 with C# obviously, but, when it’s all over, you will have a window that can display images, play audio and accept input, and this is a great combination for game development.

What development tools am I using?

I am using Windows 7 with Visual Studio 2013, because that’s what I use, but don’t worry, my projects run on MonoDevelop and the mono runtime without modification.

What is SDL2?
“Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.”

SDL2 supports deployment on the Windows, Mac, Linux, IOS and Android platforms.

There are bindings for a lot of languages, but for this tutorial’s purposes, I’m only discussing C#.

Get Ready:

First, you need the SDL2-CS c# bindings.

Second, you need SDL2 runtime binaries. I’m using the 32bit runtime binaries.

You don’t need the SDL2 development libraries or source.

Third, you need SDL_image runtime binaries.

Fourth, you ned the SDL_mixer binaries.

Get started:

1. Create your new project, I recommend using a console application for your first project, but windows application will also work, and other things might to.

2. Copy the C# *.cs files contained within the to a folder within your project, mine is called “SDL BINDINGS”.

3. Edit your project properties, under the Build tab, enable “Allow Unsafe Code”, you need to do this, because you are using native DLL libraries. Now Build your project.

4. Copy the SDL2.dll, libpng16-16.dll, SDL2_image.dll, SDL2_mixer.dll, finally the zlib1.dll into your bin directory.

Make sure that you force your application to run either 32bit or 64bit depending on the dll packages you download, otherwise you could get the following error: "System.BadImageFormatException".

Get Coding:

Once I do this, I don’t want to ever do it again, so I’ll be making an object that manages everything for me.

1. Create and new class called CORE.

2. Add the following at the top.
 using SDL2;  

3. Make some public variables.

 public bool bRunning = true;  
 public IntPtr win;  
 public IntPtr ren;  

4. Time to initialize SDL2 and open an SDL2 window. I’m going to skip error reporting, that isn’t the goal here. Inside core, you’re going to need some stuff. Inside core’s constructor, add the following.

 //Initialize SDL2  
 public CORE()  
      win = SDL.SDL_CreateWindow("SDL2 Sharp", 50, 50, 1280, 720, SDL.SDL_WindowFlags.SDL_WINDOW_SHOWN);  
      ren = SDL.SDL_CreateRenderer(win, -1, SDL.SDL_RendererFlags.SDL_RENDERER_ACCELERATED | SDL.SDL_RendererFlags.SDL_RENDERER_PRESENTVSYNC);  

5. Now create another variable.

 SDL.SDL_Event systemEvent;  

6. Create the variable’s companion function.

 //This is important, and must be run every frame.  
 public void Events()  
      while(SDL.SDL_PollEvent(out systemEvent) != 0)  
           //This is an SDL2 escape event  
           if(systemEvent.type == SDL.SDL_EventType.SDL_QUIT)  
                bRunning = false;  

7. You also need a present function.

 //This must be called after you finish drawing, otherwise you won’t see anything.  
 public void Present()  

8. Now if you were to run your application, it would start and quickly exit, which isn’t what we want. You need to create an SDL window and a system loop.

We need to add somethings to Program.cs.

Update Main to look like the following.

 static void Main(string[] args)  
      CORE myCore = new CORE();  
           //give windows some time as well as capture SDL events.  
           //Your code goes here.  
           //Display what you have drawn.  

9. Now that you have an SDL window and a system loop, you’re ready to start drawing pictures, or playing sound, or whatever. Let’s quickly cover making a simple drawing tool.

Back inside your CORE class. Create a LoadTexture function.

 public IntPtr LoadTexture(string filepath)  
      return SDL_image.IMG_LoadTexture(ren, filepath);  

Now create another function called DrawSprite.

 public void DrawSprite(IntPtr myTexture, SDL.SDL_Rect sourceRect, SDL.SDL_Rect destinationRect)  
      SDL.SDL_RenderCopy(ren, myTexture, ref sourceRect, ref destinationRect);  

10. Great, that’s all over with, now lets draw an image.

Add an image to your projects bin folder for your application to load. I’ll be loading a 128x128 Mulletman Icon.

If, for whatever reason, you don't have an image or a sound, I included both of the files I am using in the project zip linked at the bottom.

After you initialize the CORE object, add the following.

 IntPtr myTexture = myCore.LoadTexture("mmIcon.png");  

Inside your loop, add the following before your myCore.Present() call.

      new SDL2.SDL.SDL_Rect() { x = 0, y = 0, w = 128, h =128},  
      new SDL2.SDL.SDL_Rect() { x = 0, y = 0, w = 128, h = 128});  

Now run your application, you should see your image being rendered in the top left corner. If not and there aren’t any errors, there are some causes, but most likely you made a typo in your image loading filepath.

11. What about audio? Lets do that right now.

Add the following to your CORE constructor after SDL_CreateRenderer


Run your application, weird crash, something about vs host. Weird.
Go to your bin directory and run the compiled exe. Works fine. Weirder.
To fix this, go to your project settings, go to the Debug tab, and select “Enable native code debugging”, now your project will launch from the editor without error.

12. We need to add a way to load and play sounds. Cool, I know.

Inside your CORE class, add the following functions.

 public IntPtr LoadSound(string filepath)  
      return SDL_mixer.Mix_LoadWAV(filepath);  
 public void PlaySound(IntPtr mySound)  
      SDL_mixer.Mix_PlayChannel(-1, mySound, 0);  

13. We need a sound to play. I’ll be playing a sound sampled from one of my games. Go to your project’s bin/debug directory and add a *.wav

Go back to where you loaded an image file, but before the loop and add the following.

 //Load the sound.  
 IntPtr mySound = myCore.LoadSound("PlayerJump.wav");  
 //Play the new sound!  

Now when your application starts, you will hear your sound play once.

14. Now we have images and sound effects, but we need a way to input instructions. This can be done a lot of good and bad ways. We will do it the simplest way, well, sort of, it’s the flattest way. Writing a complete input system is way out of the scope of this tutorial, so I’ll demo simple gamepad input.

Inside of your core class, after you initialize Mix_OpenAudio, add the following.


NOTE* For those of you who have used SDL2before, I’m initializing the game controller as a subsystem rather than inside of the SDL_Init arguments, because adding the game controller mysteriously crashes SDL with the C# bindings and I’m not super interested in figuring out way, I’m satisfied with the work around.

Back inside your Program.cs’s main function.

After you loaded the sound, lets set the controller with the following.

 IntPtr gc = SDL2.SDL.SDL_GameControllerOpen(0);  

This function will use whatever controller you have at index 0, in my case, index 0 is the only controller I have plugged in.

Now, inside your loop, lets do something obnoxious to test gamepad input. Add the following.

 if(SDL2.SDL.SDL_GameControllerGetButton(gc, SDL2.SDL.SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_A) == 1)  

If everything worked correctly, every time you press A, your ears are blasted with noise. Way to go.


In conclusion, you now have a very compact C# SDL2 system capable of displaying images, playing audio and capturing gamepad input. If there are any problems, please feel free to post a comment.

... And if you scrolled to the bottom because you don’t like to read. I have attached a zipped project file. And, if that’s not enough, I have also attached a my LudumDare 38 Compo entry which would have seriously benefited from this tutorial, because for some crazy reason I decided to learn how to do all of this during a 48 hour game jam.

The Quick Start Guide's Project File

Project File for My Ludum Dare 38 Compo Entry

Wednesday, May 10, 2017

So... no posts for 2015 or 2016? What happened?

I forgot about my blog again. True Story. It reminds me of my second, or maybe third, year at the University - A little over half way through the semester I forgot about school, like seriously forgot, I was so totally consumed with my projects that I didn’t even think about school, let alone go to class. Weird. I know. So, long story short, I received an email from an instructor reminding me of his class final, I about shit myself, thanks to that guy, I didn’t miss any finals, and I passed all my classes.


What about Mulletman?
Mulletman and the Molemen, my Ludum Dare 38 Compo entry, is likely the final Mulletman title.

Did you finish any games?
Yes, I finished a couple Mulletman games. Yes, I know, you haven’t played any of them, but, trust me, it’s alright, you haven’t missed anything.

Did you release anything?
Nope, I suck at most things life related.

What have you been doing?
Making bad games and taking care of infants. Oh, and I replaced my carpet with hardwood floors, so 
I know how to do that now.

What are you going to do?
As for the future, I’m terrible with predictions, like, really bad.

What about new games?
Yeah, so, actually, that’s going really well. I dumped all “game development” middleware, xna/unity… great choice, I wish I had done it years ago, like almost ten years ago. I was a lot more productive before middleware.

I want to know about your new games, NOT your technology!
Oh, right.
I have been spending a lot of time on new designs. I think they are cool. Games I would actually want to play. I’m working on a prototype cyberpunk rpg, it’s edgy, it’s pixel-y, I like it. I want to release a demo before I actually finish the game, something for people to play and give me feedback.

Sunday, November 30, 2014


The things I do for your love... So I finished Super Mulletman as planned, and it sucked. And that sucked. So I trashed all the levels, most of the enemies, rebuilt the player and swallowed my pride. Here is your first look at Super Mulletman (do over).

And for those of you die hard fans (are there any?)

Here is almost eight hours of me working. Sorry, no audio, twitch muted the audio, something about sharing the copyrighted music I was listening to.

Tuesday, August 12, 2014

My Second Animated GIF - SUPER MULLETMAN

I'm still working, hard as ever. I have been playing the twitter game lately. So feel free to check me out there (or not) @Stevemata - I bet you're pumped.

Here is a 1mb gif. Enjoy my webtech noob skills.

Monday, July 21, 2014

New Super Mulletman screen shot!

I have been busy cleaning up Super Mulletman. I'm getting ready to put together a new trailer.

Thursday, May 15, 2014

Mulletman 2

Whow, yeah, I haven't updated since October, totally lame, I know. I have been pretty busy with life related situations, but not so busy that game development hasn't continued.

The big news, I have switched platforms. Mulletman was my last Xbox 360 title. Mulletman 2 will be for Nintendo's Wii U platform.

Saturday, October 26, 2013

Mulletman Released!

MULLETMAN is now available on Xbox Live Indie Games.


Follow Total Commitment Games on Facebook!

Oh, and check out the new MULLETMAN website!

Sunday, October 20, 2013

Mulletman Uncensored Version, Full Play Through

I forgot to tell you, my dedicated readers, that I made a new game. Bang, it's out there. It will be released on xbox live indie games some time in the next few days. Here is my full play through of the uncensored version. Maybe I'll make a real trailer a little later.

Wii U Gamepad

I have been looking into developing for the Wii U lately, I picked up a retail console, it's a nice device, I think it has a fantastic future, especially for developers.

However, my gamepad stopped working, dead, like RMA dead. It wouldn't charge, turn on, unplugging the battery had no effect.

Here is the deal, I think it's the AC Adapter, I think it's actually a smart charger, and for whatever reason, mine messed up while my device was plugged into it. I imagine if you are reading this post, it's because your gamepad doesn't work. Unplug your charger from both your gamepad and the wall socket, wait thirty seconds, plug the charger back into the wall and your gamepad. The power indicator should turn yellow and your device should turn on when you press the power button.

Some search terms to help fellow gamers.
WiiU gamepad won't turn on
Wii U gamepad won't power on
Wii U gamepad is dead
Wii U controller doesn't work
Wii U tablet won't turn on