
This is the first in a series of tutorials to demonstrate how to use custom graphics in Rocks'n'Diamonds, using simple examples that should be easy to understand, so that you can use the same techniques in your own level sets.
How does it work?
To see how it works, just play the levels in the attached level set "Demo: Custom Graphics 1" and read the envelope(s).
How does it really work?
To see how the custom graphics used in these levels are defined, look at the file "graphicsinfo.conf" in the "graphics" directory of the attached level set.
Some more explanations
To use custom graphics in your own level sets, there are in fact a number of ways to do this. Before going into more detail, let's have a closer look at what it means if we talk about "your own level set".
If you have started Rocks'n'Diamonds for the first time, you will see a tutorial level set to explore the game and its game elements. Obviously, this is not "your own level set". But how to find it? If you haven't found out by yourself, just go to the main menu and click on the text "LEVELSET" (under "NAME" and over "HALL OF FAME"). You will probably see a list of level sets now (like the tutorial level sets, if the last active level set was a tutorial level set). The first entry is named ".. (PARENT DIRECTORY)", which (if you click it) brings you to the next higher menu, until the first entry is ".. (MAIN MENU)". You are now in the topmost menu and should find an entry with your player name somewhere near the bottom, which you can select by clicking on it.
Now you have selected "your own level set"! From the main menu, you can now click on "LEVEL CREATOR" and create your own levels (which is not described here, but you should be able to find out the most important things by just playing around a little bit in the level editor by yourself).
OK, that's fine. But you want to use your own (or at least different) graphics for some game elements!
Find the correct directory where your own level set is stored
To do this, you need to do some things outside of Rocks'n'Diamonds, but it's easy. First, find the directory on your computer where your own level set is stored. It is the following (depending on your operating system):
- Linux: .rocksndiamonds/levels in your "Home" directory
- Mac: Rocks’n’Diamonds/levels in your "Documents" directory
- Windows: Rocks’n’Diamonds/levels in your "Documents" directory
Inside the above "levels" directory, you should find a sub-directory with the same name as your player name in R'n'D. This is the directory of your own level set! The following works the same for any other level set directory, or for additional level sets you might already have created inside the level editor on the "CONF" page and on the "LEVELSET" tab on that page.
Take a look inside that directory. You will see some level files (like "001.level") and a file "levelinfo.conf". Open that file using your favorite text editor! (If you don't know what do to, ask a friend or Google how to do this.)
Using existing game graphics for your own level set
The easiest way to use custom graphics in your own level set is to add a line to that file to tell R'n'D to use different graphics for your level set. Before you can do this, make sure you have these graphics installed, most probably together with a level set that comes with custom graphics. The famous level set "BD2K3" from Alan Bond is a good example for a level set that uses custom graphics (and other custom artwork, like custom sounds and custom music, but this is not whithin the scope of this tutorial). You can find the level set "BD2K3" on the "Levels & Artwork" page of the R'n'D web page.
Before going on, make sure you have installed this level set, and are able to select and play it, so you can see that it really uses graphics that are different from the default R'n'D graphics.
Using BD2K3's graphics in your own level set is as easy as adding the following line to your level set's file "levelinfo.conf":
Code: Select all
graphics_set: BD2K3

That's very nice. But you might already have some graphics around that you would like to use instead! No problem. Doing this is nearly as easy as the above step. First of all, remove the above line from your level set's file "levelinfo.conf" again, so the R'n'D default graphics are used again.
Using your own game graphics for your own level set
Now we need two things: A new sub-directory and a new configuration file. Inside your own level set's directory, create a new sub-directory with the name "graphics". This is the directory to store all your own, new game graphics! Just put them all into this directory, and make sure that they use the PNG file format (which you can see by having a look at the file extension, which will then be ".png" like in the file name "my_cool_graphics.png" -- if you should use Windows, make sure that you configure it to show you the file extensions of your files, which is idiotically not the default configuration for some unknown reason).
Now you have a directory named "graphics" and some image files with some cool new game graphics in it!
Make sure that all graphics in your image files use the correct graphics size to fit the size of game element graphics in R'n'D, which is 32 x 32 pixels (unless you change it to something different, which is not explained in this tutorial).
Let's say you have an image file named "ball.png" which contains a 32 x 32 pixel sized graphic of, well, a colorful ball that you want to use for rocks instead of the default graphics for the "rock" game element in R'n'D:
To do this, you need a configuration file inside the new "graphics" directory with the name "graphicsinfo.conf". Create it using your text editor and add the following lines to that file:
Code: Select all
rock: ball.png
In the above example, there is only one single graphic in the image file, but you can also use image files with many graphics (which should then contain many 32 x 32 pixel sized graphics), put together like a chessboard:
You can then select in which position on the "chessboard image" your graphic is that you want to use, like this (where we want to use the "smiley" graphic for our next game element):
Code: Select all
bd_rock: various.png
bd_rock.xpos: 3
bd_rock.ypos: 2
Important: All positions start with 0 (not 1), so "(3, 2)" is in the 4th column and the 3rd row of the image.
If your game element graphic is not part of an image that is entirely put together of graphics of the size of a game element, but is at an arbitrary image position, just use ".x" and ".y" instead of ".xpos" and ".ypos" for pixel positions, like this:
Code: Select all
steelwall: various.png
steelwall.x: 144
steelwall.y: 0

To find out how this works, have a closer look at the levels of the attached example level set, read the envelopes for all animation types, and carefully study the file "graphics/graphicsinfo.conf" in this levelset, which shows how all graphics and animations are defined that are used in all levels of the example level set.
Before you start experimenting with your own custom graphics and changed "graphicsinfo.conf" files, one more important hint: You do not have to restart R'n'D each time you have changed your "graphicsinfo.conf" file! Just go to the main menu and blindly type ":rg" (or ":reload-graphics", but ":rg" is shorter) -- this will reload the changed "graphicsinfo.conf" file!
If you should have any questions, feel free to ask here! Some of the animation modes demonstrated in the example level set may need more explanation than is contained in the envelope texts.