Preparing Wolf4SDL for modding
This tutorial, originally posted by dcbasic on the DieHard Wolfers Message Boards, will help you set up your development environment for modding the Wolf4SDL engine.
What you will need
- Code::Blocks with MinGW - Make sure to get version 16.01 to make sure everything runs smoothly!
Important Notes:
- Make sure to install Code::Blocks with the MinGW compiler, or this tutorial will not work. This tutorial assumes you have already installed the programs.
- Your compiled EXE file will not run without
SDL.dll
andSDL_Mixer.dll
, due to requirements in the engine. Click here to find out where to get them.
Setting up SDL
- If you haven't already, download SDL Devel Win32\MinGW. You will want to download “SDL-devel-1.2.15-mingw32.tar.gz” for Windows.
- Extract the zip to it's own folder. Inside that folder, locate the SDL folder (It should be inside
/include/
) - Open
C:\Program Files\CodeBlocks\MinGW\include
(Directory may vary depending on where you installed Code::Blocks) - Copy\Move the entire SDL folder from step 2 to the Code::Blocks include folder in step 3.
- Open the lib folder that is inside the extracted folder from step 2.
- Open
C:\Program Files\CodeBlocks\MinGW\lib
(Directory may vary depending on where you installed Code::Blocks) - Copy\Move the three files from step 5 to the Code::Blocks lib folder in step 6.
Setting up SDL Mixer
- If you haven't already, download SDL Mixer Devel Win32. You will want to download “SDL_mixer-devel-1.2.12-VC.zip” for Windows.
- Extract the zip to it's own folder.
- Open the include folder that is inside the extracted SDL Mixer folder.
- Open C:\Program Files\CodeBlocks\MinGW\include\SDL (Directory may vary depending on where you installed Code::Blocks)
- Copy\Move the
SDL_mixer.h
file from step 3 to the Code::Blocks include folder in step 4. - Open the lib folder that is inside the extracted SDL Mixer folder.
- Open C:\Program Files\CodeBlocks\MinGW\lib (Directory may vary depending on where you installed Code::Blocks)
- Copy\Move the SDL_mixer.lib file from step 5 to the Code::Blocks lib folder in step 6.
Pointing your Wolf4SDL project to these files
- If you haven't already, download the Wolf4SDL Source Code
- Extract the Wolf4SDL source code to it's own folder.
- Start Code::Blocks if it isn't already open.
- Go to
File→Open
, locate your Wolf4SDL.cbp file and select it. - Go to Projects→Build Options and select the Search directories tab in the window that appears.
- Select 'Compiler' from the new group of tabs that have appeared, then select the entry listed in it (It should start with “..\SDL-devel\”). Click on the Edit button.
- In the new box that appears, input the directory that holds the SDL include files (C:\Program Files\CodeBlocks\MinGW\include\SDL in this tutorial). Click OK.
- If you are prompted about making it a “relative path”, the choice is left up to you. If you are planning to move your Code::Blocks installation around, you may want to click Yes.
- Select the 'Linker' tab and repeat the previous step, this time inputting the directory with the SDL lib files (C:\Program Files\CodeBlocks\MinGW\lib in this tutorial).
- Click OK on the Project build options window to close it and save your changes.
Building your Wolf4SDL.exe
Provided everything above has been done correctly, you should now be able to compile your code! Click on Build→Build to test it! If not, look below.
Remember! To test your EXE file, you will need to put it in the same directory as your game, along with the SDL.dll and SDL_Mixer.dll files. Click here to find out where to get them.
Compile Errors
You may encounter an error that contains the following:
cannot find -1SDL cannot find -1SDL_mixer
Solution One
First, make sure you have linked your search directories as outlined above, and put the SDL and SDL_Mixer files in their correct places. If that is correct, go to Settings
→Compiler
and within the window that pops up, click on the Toolchain executables
tab.
Your Compiler's installation directory
should point to the MinGW folder inside your Code::Blocks installation.
The Program Files tab links Code::Blocks to the compiler for each language, assuming they're in the \bin\
folder of your installation directory. So if your installation directory is like above (C:\Program Files\CodeBlocks\MinGW\
) then the folder it assumes is C:\Program Files\CodeBlocks\MinGW\bin\
.
If you go to that folder, you will see what your installation has called the files. Make sure they match the file names listed in the Toolchain executables
listings, and make any corrections where necessary.
Solution 2
People have reported minor problems with the latest versions of Code::Blocks and Wolf4SDL. You can try installing the 32-Bit version of Code::Blocks, or installing an earlier version. Make sure to get a version bundled with MinGW!