Difference between revisions of "Introduction to Modding"

From Open Surge Engine Wiki
Jump to: navigation, search
m
 
(34 intermediate revisions by 3 users not shown)
Line 1: Line 1:
===Modding===
+
== Introduction ==
Open Surge is a game developed to allow user created content as much as possible. The modding scene has been around since the early 90's when people hacked games, found out how the content was generated and substituted it's content with their own.
+
If you're an absolute beginner and want to start hacking Open Surge, this place is for you.
  
In Open Surge, it is fairly easy to modify any game content you wish. It ranges in difficulty from replacing sprite files and adding images to actually modifying the source code to add functionality to the engine.
+
Open Surge is an open source game developed to allow user created content as much as possible. The modding scene has been around since the early 90's when people hacked games, found out how the content was generated and substituted its content with their own.
  
 +
In Open Surge, it is fairly easy to modify any game content you wish. It ranges in difficulty from replacing sprite files and adding images to actually modifying the source code to add functionality to the engine. A popular way of adding new functionalities to Open Surge is via scripting.
  
== To Begin ==
+
Open Surge is highly modifiable. Early modifications (a.k.a. MODs) made by our users ranged from simple sidescrollers to platformers with ninjas and RPG elements. Although the engine is focused on platformers, other types of games, such as racing games or even space shooters, can also be made. You just need to imagine something, study the engine and work to make your idea become a reality.
Lets start by learning a little about how Open Surge reads data from your images so that it can be displayed in-game. To do this, we will look at the ring sprite file included with the game.
+
...
+
// Ring
+
sprite SD_RING
+
{
+
    source_file    images/rings.png
+
    source_rect    0 128 176 16
+
    frame_size      16 16
+
    hot_spot        8 12
+
  
    // spinning
+
This wiki contains documentation on how to modify Open Surge. Besides the documentation, it's useful to study the modifications other users make, so you can learn from them.
    animation 0
+
    {
+
        repeat      TRUE
+
        fps        16
+
        data        0 1 2 3 4 5 6 7
+
    }
+
  
    // disappearing
+
== Study guide ==
    animation 1
+
    {
+
        repeat      FALSE
+
        fps        8
+
        data        8 9 10
+
    }
+
}
+
...
+
In the above file, there are several things you will notice:
+
1. there are lines that begin with //, these lines are there merely for your convince and are ignored by the engine.
+
2. '''source_file''': This is where the image you are reading from is located.  The engine assumes that images are located somewhere in the game directory folder, so you do not need to specify the full file path.  Instead, you just have to specify where the images are located in the game folder.
+
3. '''source_rect''': The first two numbers give the X and Y coordinate of the top left corner of the image you are defining.  The second two numbers give how big of a rectangle it would take to completely enclose every frame of the animation.
+
4. '''frame_size''': Defines the size of each frame of your animation.  In this instance, the size of the source rectangle is 176 by 16, but each piece of the animation is only 16 by 16.
+
5. '''hot_spot''': This is the place which the engine will use to determine the x and y position of your object.  It also is the place where the level editor grabs your object when you select it.  There are different reasons for placing hotspots in different places, however it is mostly a matter of preference.
+
6. '''animations''': These are what your object will do in the game.  There are basically three different things that animations need to be fully defined.
+
a) '''repeat''': this tells the engine if you want it to keep doing the animation as long as it is the selected one.  In this case, while the ring is inactive it will continuously spin because  repeat is set to TRUE, but when it touches a player and the animation changes to 1 it will play the animation 1 time and disappear.
+
b) '''fps''': This defines how fast the engine will cycle through your frames.  In this case it plays 16 frames every second for animation 0 and 8 for animation 1.
+
c) '''data''': This defines which frame you want to play at any particular moment.  In this case it plays frames 0-7 and then repeats under animation 0, and plays frames 8-10 and doesn't repeat under animation 1.
+
  
Now that we've examined a sprite file and determined what each of the components do, we'll modify it so that we replace the standard rings in the game with our own. 
+
There are many ways of hacking Open Surge. We'll subdivide the hacking mechanism into a series of steps: from the most basic to the most advanced ones.
'''Warning: Changing sprite files makes a major change to the game.  Make sure to backup your sprite files before you change them so if something goes wrong you will be able to restore the original functionality to the game.'''
+
  
Below, I will provide a sprite which I wrote to include my own ring design in-game.  Afterward we will examine how my sprite differs from the original.
+
=== Step #1: the level editor ===
...
+
/ Ring
+
sprite SD_RING
+
{
+
    source_file    images/collectables.png
+
    source_rect    1 1 176 16
+
    frame_size      16 16
+
    hot_spot        9 12
+
  
    // idle
+
This is your starting point: learning how to use the level editor is the most basic skill to be used in Open Surge.
    animation 0
+
    {
+
        repeat      TRUE
+
        fps        16
+
        data        0 1 2 3 4 5 2 6
+
    }
+
  
    // end
+
We recommend reading: [[How to make a level]]
    animation 1
+
    {
+
        repeat      FALSE
+
        fps        8
+
        data        7 8 9 10
+
    }
+
}
+
...
+
Here are some things you should notice right off the bat:
+
1. I use different lines that start with //, because they help me keep track of what my sprite is doing.  Remember, these are entirely up to the individual user and aren't required.
+
2. The source_file is different, this is because I have created an image and it has a different file-name than the original.
+
3. The source_rect is different, this is because my images are at a different location inside my image than the originals were.
+
4. The frame_size is the same, this is because I used a standard size rectangle to create my rings so that they can seamlessly replace the built in rings.
+
5. The hot_spot is the same, this is because I didn't see any need to change this from what it already was.
+
6. The repeats are set to the same values, this is because my ring acts similar to the original.
+
7. The fps is the same, this could be modified if I wanted to speed up or slow down the animation.
+
8. The data is different, this is because my frames must be presented in a different order to be a complete animation.
+
9. sprite SD_RING(located at the top) remains the same.  This is so I don't have to modify any game code to replace all rings with my rings.  It also means that I have to remove the old sprite definitions from my sprites folder so that the engine doesn't try to define what a ring is twice.
+
  
'''More Coming Soon'''
+
=== Step #2: hacking the built-in game content ===
 +
 
 +
==== Hacking the sprites ====
 +
 
 +
Once you learn how to edit existing levels and how to make new simple ones, you can take one step further and learn how to modify the built-in sprites. To put it succinctly, sprites are the graphics of the game.
 +
 
 +
We recommend reading: [[Sprites]]
 +
 
 +
==== Hacking other game contents ====
 +
 
 +
Not only sprites are modifiable. Other game contents such as sounds, texts and fonts can also be hacked.
 +
 
 +
We recommend reading: [[Quests]], [[Translation Guide|Translations & texts]], [[Fonts]]. Additional readings: [[Sound effects]], [[Musics]]
 +
 
 +
==== Creating your own characters ====
 +
 
 +
Now that you've got basic hacking skills, you can learn how to create your own playable characters.
 +
 
 +
We recommend reading: [[Characters]]. Additional reading: [[User Input|Input & controls]]
 +
 
 +
=== Step #3: advanced level making ===
 +
 
 +
==== Creating new scenery ====
 +
 
 +
You already know how to use the level editor and how to modify the built-in game content, but what if you want to create whole new worlds? This demands a bit more of studying than the previous two steps.
 +
 
 +
We recommend reading: [[Bricksets]], [[Backgrounds]]. Additional readings: [[Groups]], [[Level specification]]
 +
 
 +
==== Creating levels like a pro ====
 +
 
 +
Creating levels that are fun and engaging is a mixture of art and science. There are sound principles behind the level design process that are highly beneficial to your game. Getting to know these principles will take your levels to the next level ;)
 +
 
 +
We recommend reading: [[Level Design Document]]
 +
 
 +
==== Configuring level entities ====
 +
 
 +
Many level entities (items, baddies, bridges, bosses, and so on) are configurable: each on its own terms. Get a longer bridge, make a tougher boss, invent your own combination of things. The possibilities are endless!
 +
 
 +
We recommend reading: [[Setup scripts]]
 +
 
 +
=== Step #4: scripting ===
 +
 
 +
As you're hacking and creating new content, you're getting to know the engine. However, the best is yet to come: you are about to discover that Open Surge is truly unlimited.
 +
 
 +
Ancient prophets have told about a pearl of great price that would give great power to those who discovered it. Contemporary scientists have been enquiring: were they talking about scripting? That's a reasonable theory. Research shows that scripting gets you into a state where your creative juices explode with so much possibility!
 +
 
 +
The sky is the limit with scripting. Let your imagination flow freely and create completely new elements, including but not limited to: enemies, items, bosses, special abilities, weather effects, cutscenes, custom user interfaces, non-playable-characters, and much more! Scripting demands more study, but it really pays off.
 +
 
 +
We recommend: [http://docs.opensurge2d.org Learn SurgeScript], [http://youtube.com/alemart88 Video tutorials]
 +
 
 +
=== Step #5: beyond scripting ===
 +
 
 +
Beyond scripting, the only way to change the way the game acts is to modify its source code directly. This is fairly difficult and requires knowledge of programming, so it isn't recommended for the faint of heart. Be aware that this approach implies on licensing (GPL) and multi-platforming issues. Not only that, but by modifying the source code you may break compatibility with the official version of the Open Surge Engine. Still, if you want to try it, you can find the sources in the src/ folder in your game directory. After you modify the source code, you will have to recompile the game to make your changes take effect.
 +
 
 +
Regular users need not worry about the source code, as the mechanisms we talked about in the previous steps give enough power to make a wide range of games with ease. Open Surge is an open source game & engine written in C language. Programming experts may want to hack the source code directly to see how it works and to add new features to it. Those who want to port Open Surge to diverse hardware systems must also deal with the source code.
 +
 
 +
Additional reading: [[Compiling the Source Code]]
 +
 
 +
[[Category:MODs]]

Latest revision as of 03:03, 8 March 2024

Introduction

If you're an absolute beginner and want to start hacking Open Surge, this place is for you.

Open Surge is an open source game developed to allow user created content as much as possible. The modding scene has been around since the early 90's when people hacked games, found out how the content was generated and substituted its content with their own.

In Open Surge, it is fairly easy to modify any game content you wish. It ranges in difficulty from replacing sprite files and adding images to actually modifying the source code to add functionality to the engine. A popular way of adding new functionalities to Open Surge is via scripting.

Open Surge is highly modifiable. Early modifications (a.k.a. MODs) made by our users ranged from simple sidescrollers to platformers with ninjas and RPG elements. Although the engine is focused on platformers, other types of games, such as racing games or even space shooters, can also be made. You just need to imagine something, study the engine and work to make your idea become a reality.

This wiki contains documentation on how to modify Open Surge. Besides the documentation, it's useful to study the modifications other users make, so you can learn from them.

Study guide

There are many ways of hacking Open Surge. We'll subdivide the hacking mechanism into a series of steps: from the most basic to the most advanced ones.

Step #1: the level editor

This is your starting point: learning how to use the level editor is the most basic skill to be used in Open Surge.

We recommend reading: How to make a level

Step #2: hacking the built-in game content

Hacking the sprites

Once you learn how to edit existing levels and how to make new simple ones, you can take one step further and learn how to modify the built-in sprites. To put it succinctly, sprites are the graphics of the game.

We recommend reading: Sprites

Hacking other game contents

Not only sprites are modifiable. Other game contents such as sounds, texts and fonts can also be hacked.

We recommend reading: Quests, Translations & texts, Fonts. Additional readings: Sound effects, Musics

Creating your own characters

Now that you've got basic hacking skills, you can learn how to create your own playable characters.

We recommend reading: Characters. Additional reading: Input & controls

Step #3: advanced level making

Creating new scenery

You already know how to use the level editor and how to modify the built-in game content, but what if you want to create whole new worlds? This demands a bit more of studying than the previous two steps.

We recommend reading: Bricksets, Backgrounds. Additional readings: Groups, Level specification

Creating levels like a pro

Creating levels that are fun and engaging is a mixture of art and science. There are sound principles behind the level design process that are highly beneficial to your game. Getting to know these principles will take your levels to the next level ;)

We recommend reading: Level Design Document

Configuring level entities

Many level entities (items, baddies, bridges, bosses, and so on) are configurable: each on its own terms. Get a longer bridge, make a tougher boss, invent your own combination of things. The possibilities are endless!

We recommend reading: Setup scripts

Step #4: scripting

As you're hacking and creating new content, you're getting to know the engine. However, the best is yet to come: you are about to discover that Open Surge is truly unlimited.

Ancient prophets have told about a pearl of great price that would give great power to those who discovered it. Contemporary scientists have been enquiring: were they talking about scripting? That's a reasonable theory. Research shows that scripting gets you into a state where your creative juices explode with so much possibility!

The sky is the limit with scripting. Let your imagination flow freely and create completely new elements, including but not limited to: enemies, items, bosses, special abilities, weather effects, cutscenes, custom user interfaces, non-playable-characters, and much more! Scripting demands more study, but it really pays off.

We recommend: Learn SurgeScript, Video tutorials

Step #5: beyond scripting

Beyond scripting, the only way to change the way the game acts is to modify its source code directly. This is fairly difficult and requires knowledge of programming, so it isn't recommended for the faint of heart. Be aware that this approach implies on licensing (GPL) and multi-platforming issues. Not only that, but by modifying the source code you may break compatibility with the official version of the Open Surge Engine. Still, if you want to try it, you can find the sources in the src/ folder in your game directory. After you modify the source code, you will have to recompile the game to make your changes take effect.

Regular users need not worry about the source code, as the mechanisms we talked about in the previous steps give enough power to make a wide range of games with ease. Open Surge is an open source game & engine written in C language. Programming experts may want to hack the source code directly to see how it works and to add new features to it. Those who want to port Open Surge to diverse hardware systems must also deal with the source code.

Additional reading: Compiling the Source Code