Post tutorial RSS Coding Tutorial - Part 1

Coding Tutorial - Part 1 Author: Charles "MrBlonde" Palmer Last Updated: April 26, 2001 at 02:45:40 PM

Posted by on - Intermediate Mapping/Technical

Originally posted here: Menjin.org Tutorial - Part 1.php

Mirrored for archival purposes


Before you begin this tutorial I recommend that you read and get comfortable with the ideas at Unreal.epicgames.com.

The basic premise behind these tutorials is to get you up and running at creating a new Game Type for multiplayer use. I'll be including sections on creating your own HUD's, new game objects and tying it together into a finished package.

The Game Type (or mod) we will be creating will be based on my own Chieftan of the Mound mod, since I'm familiar with my code and how it works. Although I'm only going to include the code for the deathmatch version (mainly because the teamplay code hasn't been tested fully yet nor are there any maps *hint* *hint*). The idea of the mod is to spend as much time in a new zone-type as possible thus racking up an incredible score, obviously you don't want others scoring so you want to keep them out by any means. This generally makes for a very, very bloody deathmatch.

Setting up:
The first thing you should do is export all the compiled *.u files out so we have access to the code without starting up RuneEd also it makes setting up the default properties of a class much easier but more on that later. To do this startup RuneEd and on the right hand side there is a "Browse" toolbar select the drop down menu and choose Classes. This should bring up a tree of various items. Looking to the bottom of the toolbar click on "Export All". After a bit of thinking all the files will be exported into directories with the same name as the .u package in the /system/ folder.

Summary:
- Open RuneEd
- Using the Browse toolbar select Classes
- Click Export All

Now we are almost ready to edit something!
Now we need to create somewhere to keep all of our stuff together, rather than adding it into the default Rune packages lets create a new one to store our own code, thus packaging it up nicely and reducing filesizes. To do this in your Rune root directory (i.e. c:\rune) create a new directory called "COTM" and in the directory you have just created, create another directory this time called "Classes". This is where we will be storing everything we create.

Summary:
- Create COTM directory in your root directory for Rune
- Create a sub directory within COTM called Classes

Time to add some code...
To end this first part of the tutorial lets add some code. Now we are going to create the main class that the gametype will use. In the Classes directory add a new file and call it "COTM.uc". Now open it with your favourite text editor and add the following.

//======================================================================
// COTM - Chieftan of the Mound mod tutorial
//======================================================================
class COTM expands RuneMultiPlayer;

defaultproperties
{
ScoreBoardType=Class'COTM.COTMRuneScoreBoard'
HUDType=Class'COTM.COTMRuneHUD'
MapPrefix="COTM"
Beac
GameName="Chieftan of the Mound"
}


Save it. Now you'll be thinking to yourselves what on earth did I do that for? Well lets go through it. First of all the top section:

//======================================================================
// COTM - Chieftan of the Mound mod tutorial
//======================================================================


The // mean that anything after will not be read when it comes to compile or run the script, it useful for writing comments and "commenting out" lines of code to find errors

class COTM expands RuneMultiPlayer;


Now this is a bit more interesting, notice that COTM is the same as our filename (most important) this basically defines where our class sits in the tree of classes. Our class sits below RuneMultiPlayer and "inherits" everything from it. That is to say it has all the same functions and variables as RuneMultiPlayer, which in turn has all the functionality from the classes above it. This way we can change functions to do what we want without having to change any of the scripts already in place. Cool, huh?

defaultproperties
{
ScoreBoardType=Class'COTM.COTMRuneScoreBoard'
HUDType=Class'COTM.COTMRuneHUD'
MapPrefix="COTM"
Beac
GameName="Chieftan of the Mound"
}

This sets the default properties for some variables used. In this case they are all declared much higher up the tree so just by setting them here we can change some of the functionality of our mod. Infact this gives a sneek peak at what we will be doing later on. For now though save the file.

Summary
- Create COTM.uc
- Add the above code in.
- // are commented out lines.
- Classes inherit functions and variables from those above them.
- We have an area called defaultproperties in which we can set values for variables.

Still interested in doing more? Well open RuneEd again and by clicking on the + icons to the side of the classes expand them and travel down the different branches, remeber each class below the main one inherits from all the classes above it.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Tutorial
Browse
Tutorials
Views
96 (1 today)
Share
Related Games
Rune
Rune Adventure
Related Engines
Unreal Engine 1
Unreal Engine 1 Commercial
Related Groups
Gathering of Developers
Gathering of Developers Developer & Publisher
Human Head Studios
Human Head Studios Developer