Blog Stuff

How to make your own gun in Relic Hunters Zero

Hello boys and girls. As you probably know since you’re reading this, Relic Hunters Zero is an Open Source game – which means you can start making your very own stuff with it right now! To help you get started, I have created this beginner-focused tutorial in which I’ll walk you through all the required steps in order to make your very own Relic Hunters Gun! Let’s bring some new pew-pew to the face of all that is evil, shall we?

Banner

So the first thing you need is to make sure you have the latest project code running on your Windows machine. In this article I walk you through downloading the code, Game Maker Studio and setting everything up.

Have everything up and running? Great. Let’s make a gun!

 

Step 1: Creating the gun sprite

Let’s start with something fun: getting a unique look for your weapon. You don’t need to be a great artist in order to have fun making guns in Relic Hunters – we designed their visuals to be very simple and easy to create. If even I can draw a passable Relic Hunters gun, I’m sure you can do even better!

I recommend using one pre-existing gun from the game as a basis. Just pick something that looks roughly like what you want to make, and open it in your favorite software-editing program. Unfortunately MS-Paint won’t do, since we need our final result to have transparency. I will use Photoshop during this example, but you can use Gimp, or Spriter, or even Game Maker’s own image editor – anything that you feel comfortable with and have access to.

So let’s say I want to make a sawed-off shotgun and go Wild West on the evil Ducans in the game. I’ll just take the shotgun sprite here from the “RelicHuntersZero.gmx\sprites\images\” folder and open it on my image editing software. Notice there are three images – take the first one.

00

Now I’ll make sure to save it with a different name to make sure I don’t accidentally overwrite my original shotgun! Just save it as a PNG file named “sawedOffShotgun0.png”. Now we’re ready to make our own art!

We want something shorter, so I will keep the rear and end part of the gun and delete the middle section, then I join the two sections, like so:

01

 

Already looking like a different gun, right? But we can get more creative than that. Let’s choose two or three colors for our gun: I picked a brown and two shades of gray.

Now, with the PENCIL tool (don’t use brushes or anything with soft edges like that – we need something “hard” to do pixel art), set it for 2 pixels wide and get ready to work!

03

 

I tweak the shape of the shotgun here to make it feel bulkier and to help communicate better to players how it might behave when you actually use it – a very short-range but powerful little beast. Again, I’m not an artist, and you also don’t need to be – just express yourself and try different things until you get it right. If you’re feeling insecure, you can use an existing image as a reference – “real” artists do it all the time! On the right there is the image I used to guide me while tweaking my sawed-off shotgun sprite.

Ok, so now we are almost done. Save the sprite again to keep what we’ve made. Now we will add a white “stroke” to the image – this is a visual feedback for the players to know that they can interact with this gun when it is on the ground.

Just add a 2-pixel-wide outline around the gun. Use a solid white color (255,255,255) and save it as a different file – in my case, I named it “sawedOffShotgun1.png”.  It looks like this:

04

For the third and final image, we’ll need a completely white version of the sprite. You can achieve this by bumping the Lightness of the image in your image editing software (in Photoshop it’s in Image->Adjustments->Hue/Saturation), or even by paiting it by hand or any other way you want to do it. Save it as the third and final file – in my case, “sawedOffShotgun2.png”. It looks like this:

05

 

 

Step 2: Add the Gun Sprite to the Project

Now that we have our 3 images, we are ready to start coding them into the game as an actual new gun!

Open the project and head to the “Sprites” folder. Under the “Guns” folder we will create a brand new sprite by right clicking on it and selecting “Insert Sprite”.06

 

Now we click the “Load Sprite” button, and navigate to where we saved our beautiful art. Select all 3 images (the regular, the outlined, and the completely white) and click “Open”.

07

 

This will create a sprite with three “sub-images”: a regular one, an outlined one, and a completely white one. Subimages are normally used for animation, but in this case we’re using to save space – no need to create three separate sprites for the very same gun, right?

So now we name our gun. I tend to start my Sprite names with the “spr_” prefix. This is not mandatory but it’s a good thing to do to keep the project organized and keep resources easy to find. So I will name my creation as “spr_sawedoff”.

08

We’re almost done! Now we need to set the “Origin” position of this sprite. This position is the “center” of the image, so to speak, and determines many things such as rotation axis, coordinates in the game world and etc.

In Relic Huntes Zero, all gun Origin positions are set on the handle – wherever your character’s hands should be holding the gun. So I place mine right there at the handle, at position X:18 and Y:15. You can do that by manually typing the values into the Origin boxes on the bottom left, or you can click on the image directly. The Origin is represented by a cross on the image, like so:

09

And now our sprite is done! Nice job! Click ok and let’s get to coding!

 

Step 3: Defining the Gun Object

So now we need to define the gun’s Object. Objects in Game Maker, as the manual says, are a special resource that we use to control aspects of our game and to do specific things. Most of the time they have a sprite associated with them so that you can see them in the game. They can be given behaviors and they can react to certain events as well as to each other, and most of the things you see in a game are based on objects and their interactions.

So, naturally, if we want or gun to do anything in the game it must be an Object!

Start out by navigating to the Objects folder, and then finding the “Player/Guns” subfolder. Here we will add a brand new object by right clicking and selecting “Insert Object”

10

This time we’ll start by naming it. In Relic Hunters I usually name my objects with the “obj_” prefix, so this one is going to be called “obj_sawedoff”.

11

Let’s add the sprite we just created to it. Do this by clicking the “<no sprite>” field right under the name and selecting our sprite. In my case, it’s “spr_sawedoff”, remember?

12

Now we need to tell the game that this is a gun, and how it behaves. Luckily for you, I have already created a “Class” of object called “class_gun”, which tells the game everything that a gun is and does. All we need to do now is assign our new gun to this Class.

Just click the field next to the “Parent” button and select “class_gun”

13

But our gun is not just like any other gun, right? It is a special, unique and cool gun, so we have to define what makes it different. To do that in Game Maker we use Events and Actions.

An Event is something that happens in the game. Something collides with something else? That’s an Event. The game starts? That’s an Event. Every second of the game? That can be an Event too.

An Action is something that we tell the computer to do when the Event happens. So we can say stuff like “Hey computer, when you Create this gun in the game world, make it a sawed-off shotgun”.

So let’s do just that. We will start by defining a Create event: just right-click the empty space called “Events:” and select “Add Event”.
14

Choose the “Create” event, the one with the little lamp icon.

15

Now we’ll tell the computer what to do when the object is Created, right? We will do this by adding some code. Click the “Control” label on the right, and then drag and drop the little text icon to the empty space, like this:

16

A window should open instantly! Don’t be alarmed as this is perfectly normal. This is Code that we will use to tell the computer what happens when our gun object is created.

What we want is to tell the computer that this is a perfectly normal gun, and then we will define what makes it different.

So let’s start with this code:

17

 

The green line up there is a “comment”. The computer ignores this, so it’s a way for us to write notes for ourselves and organize our code. Every time you put “//” in front of something, it’s a comment. In Game Maker, we can use “///” as a special type of comment: this will be the title of our code. It’s not mandatory to do this, but it’s good to keep things organized, don’t you think? ;)

Then there’s the orange line. It’s executing an action called “event_inherited()”. This means that it will do everything that the Parent object does on its Create event. This means that this is just like “class_gun”.

“Ok, but we don’t want it to be JUST like a regular gun, right?”. No we don’t, smarty pants! So now we can write anything else we want to be different from the class_gun. This sounds intimidating, so I recommend looking at a pre-existing gun with similar characteristics to yours and starting from there. We will just copy the code from the shotgun that already exists, and paste them on our new code.

We can open a pre-existing gun simply by double clicking them on the project. I open “obj_shotgun” and it’s very familiar: it has the Create event, and a Code action associated to it! I double click the Code to check it out:

18

Looks like a bunch of cool stuff to play with! Let’s copy-and-paste all this to our own code on the left so that it looks like this:

19

And now we can start to do some editing. I want my sawed-off shotgun to do more damage, have more power, and reload faster than the shotgun. On the other hand, it will have less range, and only 2 bullets. I also lower the “fire rate” time to allow player to quickly fire the two bullets. Now my code looks like this:

20

Notice how I changed the “name”, “projectile_damage”, “projectile_range”, “projectile_power”, ”ammo”, “reload_time” and “fire_rate” numbers. This will create a gun that feels completely different from the regular shotgun!

Also, make sure you change the “object” to the actual name of your gun object (in my case it’s “obj_sawedoff”.

And we’re done! Click the green “V” icon on the top of the Code to save and close it, then click “OK” to close the Object window, we don’t need to change anything here anymore.

 

Step 4: Adding a Pickup

So now our gun exists! You can’t wait to shoot it, can you? Me neither, so let’s add a “Pickup” object in the world so that one of the Hunters can pick up the new gun and use it.

This is quite similar to creating the Gun object, but even faster!

Navigate to the “Pickups” folder. This time we will take a shortcut: right-click the “obj_pickup_shotgun” object and select “Duplicate”. This will create a perfect copy of it for us to work with.

21

Let’s name it properly. In my case I use “obj_pickup_sawedoff”. We also need to use the very same sprite we already created. In my case it’s “spr_sawedoff”. Your duplicate should then look something like this:

22

Ok, but this is still behaving like the regular shotgun pickup, right? Let’s change that. Double-click the Code action like we did before, and change “gun” to the correct object, like this:

23

And we’re done! Again, click the green “v” to save and close, and click “OK” to close the object window.

 

Step 5: Placing the Pickup on the first room

Now we just need to put this Pickup object on the very first room of the game so that we can pick up our gun and shoot with it!

Open the starting room by navigating to the “Rooms” folder and double-clicking the “room_start” file.

24

Use your mouse wheel to zoom out. Can you recognize where you are? This is the very beginning of the game! Click on the objects tab on the left:

25

Now click the empty space and select the Pickup Object we just created:

26

Almost done! Just left-click next to Jimmy there in the room’s entrance and we’re done.

27

Click the green “v” on the top left to save and close. Are you ready? Take a deep breath and run the game! It will take a bit long as it loads the new images and objects into the project, but it should be ok.

 

Step 6: Testing and tweaking

Fire your gun around. Does it feel the way you wanted? You can hop into any teleporter and take it to the levels. Take notes, if you feel like it.

When you’re done, open the gun object again (in my case, “obj_sawedoff”) and edit the Code action on the Create event to make any adjustments. I found that my sawed-off shotgun was pushing enemies a bit too far away, so I lowered the “projectile_power”. I also wasn’t happy with the range, so I decreased “projectile_range” as well.

Save the file by clicking the green “v” icon, and run the game again. Is it how you wanted now? Keep repeating this cycle until you’re happy with your gun.

 

Step 7: A Few Tips

Here are a few quick tips to make your gun more interesting:

Give your gun a personality. What makes it feel unique? When people describe your gun, what will be the first thing you want them to say? If your gun plays just like other existing gun, what’s the point?

Give it a strong point and a weakness. My sawed-off shotgun is really good to instantly destroy an enemy at close range, but it is only useful at very close range. Making an all-powerful gun can be fun, but only for a little while – after that, it will make the game less exciting to play.

Explore what the variables do. Have you tried tweaking “decay”? It controls how the bullets speed up or down after they are fired. Another cool variable is “burst”, which makes the gun fire repeatedly with just a single press of the trigger! Open the other gun objects, check out what they do, and don’t be afraid to experiment and try crazy things – you might be surprised with what you end up creating!

 

We’re All Done!

Well, congratulations – you are now a game developer! Your new gun is in the game, and you can make many more. You can change anything you want, or even create new things from scratch. The process is the same – you just need patience to learn how.

~Mark

[COMMENT THIS POST ON OUR FORUMS]


Relic Hunters Zero Open Source: How to Download and Use

Hey internet,

As of today, we are releasing the Relic Hunters Zero project files to the world. This is very exciting, and I can’t wait to see what you will come up with!

So first things first: let’s learn how you can download the project, as well as the free version of Game Maker Studio, and get everything set up.

 

Step 1: Downloading the Relic Hunters Zero project files

download-zip

 

This is the quick-and-dirty way to do it: head over to https://github.com/mventurelli/relichunterszero and click the “Download ZIP” button on the bottom right. Alternatively, you can just click right here for a direct link.

The download is a little over 250 MB, so it shouldn’t take too long. When it’s done, simply unpack the contents in any folder you want. Success!

 

Step 2: Downloading and Installing Game Maker Studio – Standard Edition

Don’t worry, it’s free. Head over to http://www.yoyogames.com/studio/download and click the big green button labeled “Download Game Maker: Studio”.

download-gms

After the download is finished, just open the file and follow all the on-screen instructions to install.

 

Step 3: Registering your Game Maker Account

When you open Game Maker Studio for the first time, it will ask you for Registration. Do not worry, it is pretty quick and easy. All you need is a working email address and enough criativity to come up with a password.

Follow the on-screen instructions. After you confirm your email address, check your email inbox: there should be a message there with the following title: “Important license information from YoYo Games”. Open it.

license-key

There is a huge number called a “Licence key”. Copy it, and paste on the corresponding field on Game Maker. That’s it!

 

Step 4: Opening the Relic Hunters Zero project

open-project

You should be looking at something like that window in the image above, right? Click the “Open” tab, and navigate to the folder where you have unpacked your Relic Hunters Zero project files. Inside the “RelicHuntersZero.gmx” folder there is a file named “RelicHuntersZero.project.gmx”. Open this file.

Game Maker will start to load the entire project. This will take some time, but don’t worry – it only takes that long on the very first time.

play-project

Now you are ready to start developing! To make sure everything is working, let’s just run the game for the first time. Click that little green arrow on the toolbar to do that.

The first time it will need to compile everything, so it will take very long. Don’t worry, just like when you were loading the project, this time will be significantly reduced from now on.

And that’s it! The game should be running fine now. If you come across any weird error messages, try restarting Game Maker Studio – sometimes it does that when it was just installed. If you still get errors, try to restart your computer. Still have problems? Come to the forums, let’s see if we can help you out.

 

It is in your hands now!

The game is now in your hands. Let your imagination run wild! You can do anything you want with it!

Don’t know where to start? What about this tutorial on how to make your own weapon?

Cheers,

~Mark

[COMMENT THIS POST ON OUR FORUMS]


Reality Check: Game Design and Empathy

 

Creavity, logic, problem-solving skills, sense of humor, knowledge of probability, statistics, systems theory, information hierarchy, storytelling… the list of desirable game designer traits seems like something out of Da Vinci’s CV. “But what is the single, most important thing for a game designer, Mark?”, you ask, fully expecting me to contort my face for minutes before squeezing out a non-answer.

I surprise you like a ninja coming out of a cookie jar, as I throw my answer at you as quickly as my chocolate chip shuriken: the most important trait for a game designer is empathy.

If you don’t know how people work, you can’t make stuff for people to interact with. The most talented and technical designer that lacks empathy will make something that only he/she can enjoy – or, at the very best, something that can only be enjoyed when the designer is around to explain how to “play it the right way”.

My first few years of game design study and practice were very much focused on the “object” of games – how these systems actually work and how you go about designing them. As I got more experienced, I noticed that even as my understanding of the “cold” aspects of games got richer and deeper, I was still unable to design things that didn’t suck. Sure, I was now able to understand and communicate clearly why it is that my games suck. And other people’s games too, of course. There’s nothing more comforting in defeat than realizing that someone else sucks even more than you do.

Even though this critical detail and technical knowledge is super important, I was still missing something. And crossing over this chasm that exists between “good” and “excellent” has been my personal journey for the last couple of years, a quest in search of that something, the truth, the Holy Grail of design: “Just What The F*** Is Wrong With People?”.

Finding out what those drooling morons at the gamepad/keyboard/dancing mat are actually thinking when they don’t get your brilliant design is the endgame. You can never be too good at it, so expect to sharpen this skill for the rest of your life.

This article is the first of a series where I will explore different aspects of how the disconnect between your worldview and your audience’s can spell disaster to your project like a dog playing Jenga. So before I wrap up for this week, let’s discuss the concept of “empathy” in game design a little further.

 

Game Design Is Not Magic

So here goes an earth-shattering definition of satisfaction, do tighten your seatbelts:

 

Satisfaction is the fulfillment of expectation

 

Not very academic-sounding, I know. Not very wordy, either, and frankly just sounds obvious when you say it out loud. But this is a powerful definition to work with, because it forces us to focus on this core idea: everything we do in our game can be viewed as either expectation-setting or expectation-fulfillment.

This is a particularly useful set of lenses with which to look at your design, as it is simple to understand, use, and communicate to your teammates. It also permeates all the aspects of your game: design, sound, visuals, story, the wording on your trailer, the text on your menus, your press releases, the description on the storefront. It helps you think of your whole product as a game design problem.

This is also a tool that requires you to keep your attention on the player at all times. “Is this good enough?” ceases to be an unanswerable question and turns into action. It transforms into a new question. “Is this what our audience expect it to be?” demands you to go see if it is true. It can be tested, it can be measured, it can be answered.

 

Game Design Is Magic

But wait, satisfaction is not what we’re looking for, right? At least that’s how I see it. I don’t think we’re in the business of giving people what they want. We’re f***ing artists. What we really want is to cross that chasm. To build something truly awe-inspiring. We must take our understanding of what people want, and then surprise them.

Here’s another reductionist, blanket-statement definition that won’t make you popular at the nearest symposium:

 

Entertainment is satisfaction and surprise

 

If you work with that, you get something like a hierarchy of needs for your design: make sure you understand your audience’s expectations, make sure to not disappoint them, but then offer something surprising. Something they wanted, but they did not know it until that point.

So I like to compare game design with magic: the technique required to execute a prestidigitation trick is worthless by itself. Sure, you can’t do magic if you can’t even tie your shoelaces properly, but real greatness comes from understanding people better than they do themselves.

People want to believe that you’re taking them for a journey by the hand, they want to go to Disneyland, they want to have the feeling that you know what is good and that they can trust you to deliver that. It is a macroscopic version of a purple loot drop: “I know there’s something I’ll like in there, I just don’t know what it is yet”.

This kind of trust is hard to earn. You must be two or three steps ahead of your player, and unfortunately we’re usually one step behind most of the time. Our job is harder because we do not control anything directly: point of view, pacing, information, pretty much all elements that must be manipulated for good entertainment to sprout is out of our hands when the game is being played.

So those magic guys have it real easy, right? But still they focus more on understanding their audience than we do.

This article series is my attempt to contribute with my limited experience on the subject. This first one was very theoretical and fluffy, but I already have the themes for the next three, and they are all rock-solid: encounter design, reward systems and tutorials. So please do stick around if that’s something that interests you, and I’ll see you next week.

 

***

I still remember playing Super Mario Bros. 3 and trying to fly over the stage, my 12-year-old mind filled with the fluids of pride and a tiny bit of mischief as I expected to “break” the game. Almost 20 years later I still remember how magical it was to find all that stuff waiting for me in the clouds, as if old Mr. Miyamoto was talking back to me, talking in a language that only games can speak, saying “Hello, Mark, I was waiting here for you” and smiling like the smartass that he is.

 

Image Credit: Metadraxis