PDA

View Full Version : [UT2003] where to begin?


zig
1st Oct 2003, 06:03 PM
Finding a good starting point, it seems, is the hardest part for me. I've tried to do as much research as I could before posting here. I have been reading everything I can (tutorials, forums, wiki, original source, etc) as often as I can. I have not been able to locate very many tuturials and the ones I have located do not explain things very well for me. I have a bit of experience with C++ (I've been thru a course at my local community college) but I dont think my grasp of the logic behind it and UScript is that great. I understand a good deal. I'm pretty comfortable with most of the syntax. I'm still not exactly sure how some things play out, such as how functions are called or states are entered. I do hope I'm saying this right, I understand the declarations of the functions, states, classes/subclasses, I think I understand replication for the most part etc but not exactly sure how the engine knows when to call on the different parts. Are there built in functions I should know? hmm...

I think once I find a good place to dig in that works for me, things will move along much better. I'm becoming very frustrated...feeling like I'm devoting so much time and coming up with no results. If anyone can offer some direction or explanation or anything at all I would be very grateful.

Thanks

Mr_Evi1
1st Oct 2003, 06:19 PM
I didn't see the UDN (http://udn.epicgames.com/pub/Technical/WebHome/) mentioned in you list of things you've read. It contains quite a lot of useful info. There is also some interesting stuff on the Unreal Technology (http://unreal.epicgames.com/) site, although it's for UT mostly, and thus may differ slightly from UT2003.

Other than that, the only thing I can recommend is to get some practical experience - make something.

[SAS]Solid Snake
1st Oct 2003, 09:40 PM
Look at Unreal Wiki as well. Any tutorials for UT *may* work for UT2003, but will only fail due to class referencing isn't the same.

The best thing to do in your case, is to download the current source code that is avaliable on the Unreal technology site and have a look at code itself. Look at the weapon code in particular, for example, look at the Flak Cannon code and see why and how it works the way it works. First of all, play with the Flak Cannon a lot in the game, and then try to translate what is happening on your screen to what is written in the code. e.g Why is the flak cannon spawning 6 flak shells and how?

Otherwise it is mainly a self-directed learning. We can't teach you from scratch, you have to take this under board yourself. Think of it, like learning to write. We can show you bits and pieces but the concept of writing is difficult to explain.

chunky
1st Oct 2003, 10:05 PM
See if you can find the sega500 public tutorials (sorry i don't have the link, but i've seen it on this forum plenty of times). Also some of the old UT tutorials which explain the basics of unrealscript will still be relevant to ut2003. I actually haven't seen (or looked for) any good beginners tutorials (explaining how to call functions etc) for ut2003, but there were a few for oldskool UT (which got me started).

RegularX
2nd Oct 2003, 10:24 AM
http://wiki.beyondunreal.com/wiki/UnrealScript_Lessons

Has OO overviews as well as basic tutorials on UT2003 scripting.

chip
2nd Oct 2003, 11:21 AM
I'm becoming very frustrated...feeling like I'm devoting so much time and coming up with no results. If anyone can offer some direction or explanation or anything at all I would be very grateful.

this qualifies as "anything at all"...
you've hit the UnrealScript "wall", zig, as I did about three or four months after starting to explore Unreal mapping and coding. you CAN get through the wall, but as the others have said, it takes trying (and often failing at) your own Unreal Scripts.

one of my main learning techniques is to search a variable or function name through all the classes and see how its used/called in different places. patterns start to become apparent that help clarify what's going on. slow, almost osmotic, learning.

if you stick with it, sooner or later there'll be a time when everything starts to "click" more & more, then you're off and running.

zig
2nd Oct 2003, 02:06 PM
Thanks for the replies...

I've been going thru the code some more and doing some more reading on various sites. I've picked up the general idea on how some things are working but there is just so much there its easy to get lost.

I think I'll look at the flak cannon like suggested...maybe ill attempt to make it full auto or something. Does anyone have any suggestions for things to attempt.

Something simple?
Something medium?
Something Hard? (well not TOO hard) :)

I'm probably just trying to understand too much at once and just overloading myself. So maybe ill try the full auto thing...then try to move to something a little tougher...does this sound like a good plan?

Well thanks again and I'm always open to more suggestions :)

Daid303
2nd Oct 2003, 05:09 PM
Something simple:
Make a mutator that creates a monster at a random location every X secs? Doesn't sound to hard to me.

zig
3rd Oct 2003, 12:07 AM
ok i tried a (simple?) mutator to spawn a bot every 20 secs but it doesnt work. A "Player" shows up on the scoreboard every 20 sec but there is no bot running around. Well its bedtime and I thought i might as well post my little bit of progress and maybe get some input on why this doesnt work...here's the code...


class MutBoB extends Mutator;

event PreBeginPlay()
{
SetTimer(20.0, true);
}

function Timer()
{
local NavigationPoint NP;
local bool bHasSpawned;

bHasSpawned = false;

for(NP=Level.NavigationPointList; NP != None; NP=NP.NextNavigationPoint)
{
If(NP.IsA('PlayerStart') && bHasSpawned != true)
{
Spawn(class'xBot', , , NP.Location);
Log(">----------Bot Spawned----------<");
bHasSpawned = true;
}
}

}

DefaultProperties
{
GroupName="BotPop"
FriendlyName="BotPopper"
Description="Spawn a bot every 20 seconds?"
}

[SAS]Solid Snake
3rd Oct 2003, 01:10 AM
Firstly in your Timer function the bHasSpawned bool will not work the way you intend it to because it is set to a local variable. Local variables get reseted every time the function is run again. Think of it like RAM (a local variable that is) it is just temporary storage, and a variable defined with var is a permanent storage that every single function can use.

Becareful how you spawn bots into the game. Check how the GameInfo class (xDeathmatch or the classes superior to it) spawned their bots in.

Daid303
3rd Oct 2003, 06:23 AM
Solid Snake']Firstly in your Timer function the bHasSpawned bool will not work the way you intend it to because it is set to a local variable. Local variables get reseted every time the function is run again. Think of it like RAM (a local variable that is) it is just temporary storage, and a variable defined with var is a permanent storage that every single function can use.
It does work as intented, with that bool he makes sure a bot gets only spawned at 1 playerstart, not all of them.

I don't know how to add bots at a location, but you can call the function Game.AddBot(); if you want to add bots.

[SAS]Solid Snake
3rd Oct 2003, 06:55 AM
Yes your right, I wasn't reading the code properly. Thanks for pointing that out.

Zig, all you need to take from my post is what a local variable is I guess, that's if you didn't know what it was before.

chunky
3rd Oct 2003, 08:45 AM
Something medium:
This was the first thing that got me going ok (not too many replication issues) and helped me past the "UnrealScript wall".

Its basically a gametype to help people practice aiming.
I made a cannon actor which is placed in maps, then a new gametype that builds a linked list of the cannons, and makes one randomly fire every few seconds. They fire a modified shock ball which awards a point to a player that shoots it with the normal shock rifle fire. Then i made a simple scoring system, and then cleaned it up by fixing default weapons, a scoreboard, taking care of killing etc.

It wasn't too difficult because there are plenty of examples of similar code all through the game (like instagib), and I think the only replication stuff to worry about was setting remote roles.

I actually find new gametypes easier than mutators becuase you have more freedom.

RegularX
3rd Oct 2003, 09:05 AM
Yeah, gametypes are easier because you can do more, but remember two things:

1) It's also a lot easier to break things simply because you can do more.

2) Mutators can be really powerful even when writing gametypes. Every gametype I've done to date has had a custom basemutator to hold core rules and tweaks that can be easily carried to other gametypes.

I skipped mutators entirely when coding for UT99 and really regretted it later on.

zig
3rd Oct 2003, 12:05 PM
ok so i fiddled with it some more and finally figured out how to call the bot spawning function correctly(well it works anyway). But now I want to make it spawn a bot each time you kill a bot so if you kill 1 you have to fight 2 then if you kill another 1 you have 3 and so on. And if you die it starts over. Kind of to see how many you can take without dying...Is this possible? I'm looking into it but not sure if this will work cause so far i only know how to get things to work on the timer in the mutator :P

Well let me know if I did this right or if there is a better way...and any tips on making those additions are welcome. :)

class MutBoB extends Mutator;


event PreBeginPlay()
{
SetTimer(20.0, true);
}

function Timer()
{
xDeathMatch(Level.Game).ForceAddBot();
}

DefaultProperties
{
GroupName="BotPop"
FriendlyName="BotPopper"
Description="Spawn a bot every 20 seconds?"
}

Mr_Evi1
3rd Oct 2003, 01:15 PM
ok so i fiddled with it some more and finally figured out how to call the bot spawning function correctly(well it works anyway). But now I want to make it spawn a bot each time you kill a bot so if you kill 1 you have to fight 2 then if you kill another 1 you have 3 and so on. And if you die it starts over. Kind of to see how many you can take without dying...Is this possible? I'm looking into it but not sure if this will work cause so far i only know how to get things to work on the timer in the mutator :P

Well let me know if I did this right or if there is a better way...and any tips on making those additions are welcome. :)

I think what you need here is a GameRules. These get events when things happen, like when a player is killed. If the killed player is a bot, spawn another bot, if it's a human, kill all the bots. The big head mutator is an example of how to add a GameRules via a mutator.

zig
3rd Oct 2003, 02:23 PM
ah good I was looking at other muts and saw they were using gamerules so I had started messing with gamerules before I came here and saw the suggestion. I think I have the basic idea down right but I have a problem. I keep getting an infinite recursion error :(

here is my mutator

class MutBoB extends Mutator;

var bool bCalled;

function PostBeginPlay()
{
local GameRules G;

Super.PostBeginPlay();
G = spawn(class'BoBGameRules');

BobGameRules(G).MostKills = 0;
BobGameRules(G).CurrentKills = 0;

if ( Level.Game.GameRulesModifiers == None )
Level.Game.GameRulesModifiers = G;
else
Level.Game.GameRulesModifiers.AddGameRules(G);
Destroy();
if(!bCalled)
xDeathMatch(Level.Game).AddBots(1);
bCalled = true;
}

defaultproperties
{
bCalled=false
GroupName="BotPop"
FriendlyName="BotPopper"
Description="Spawn a bot every 20 seconds?"
}


and here is my gamerules


class BoBGameRules extends GameRules;

var int MostKills;
var int CurrentKills;

function ScoreKill(Controller Killer, Controller Killed)
{
local Controller C;
local int TotalBots;

if(Killed != none && Killed.IsA('xBot') && !Killer.Isa('xBot'))
{
xDeathMatch(Level.Game).ForceAddBot();
CurrentKills++;
Log("CurrentKills++");
if(CurrentKills > MostKills)
MostKills = CurrentKills;
}
else
{
TotalBots = 0;
for(C = Level.ControllerList; C != none; C = C.NextController)
{
if(C.IsA('xBot'))
TotalBots++;
}

CurrentKills = 0;
Log("*****CurrentKills Reset/Calling KillBots*****");
xDeathMatch(Level.Game).KillBots(TotalBots - 1);
}
}

DefaultProperties
{

}


Im pretty sure the problem is with this part...

else
{
TotalBots = 0;
for(C = Level.ControllerList; C != none; C = C.NextController)
{
if(C.IsA('xBot'))
TotalBots++;
}

CurrentKills = 0;
Log("*****CurrentKills Reset/Calling KillBots*****");
xDeathMatch(Level.Game).KillBots(TotalBots - 1);
}


when I try to destroy the bots i think thats where my problem is but I cant seem to figure it out.

Well its time for lunch so Ill check back after and see if anyone has any input :)

Daid303
4th Oct 2003, 01:32 PM
Destroy(); in the mutator? that doesn't sound like a good idea. It probly breaks your mutator list. As for the killing of bots... I wouldn't know.

zig
5th Oct 2003, 11:24 PM
Destroy(); in the mutator? that doesn't sound like a good idea. It probly breaks your mutator list. As for the killing of bots... I wouldn't know.

I dunno about the Destory(); in the mutator...its something I copied over from another mut. I havent had much time to mess with Uscript this weekend. I'll look at it some more this week, maybe I can figure it out.

I'm pretty sure the problem is in the part I was referring to in my earlier post. I dont understand it...when I type killbots in the console where is that called from? It works fine if I do it that way but it crashes if I call it from my gamerules.

Romanov
6th Oct 2003, 03:47 AM
juat an idea but I found the www.masteringunreal.com site excellent, look at the video tutorials and buzz does a very good oner on coding for unreal, its a very good start to give you a "base" off which to work.

I thin youre a proper coder so you may find this too easy but I found out alot by just taking one lot of gun code out of xweapons and then putting it into its own package , renaming the package and gun dertails and getting the wepon in game and working. (using an int file to load up) then add/change/modify the gun to what you woulkd like it to do.

Have you got wotgreal? www.wotgreal.com its excellent and comes with a wotgreal exporter so you can have a look at other peoples code to see how they did something in their mutator or mod.

cheers
Romanov

zig
6th Oct 2003, 11:08 AM
yea I have watched those VTM's for the unrealscript 101. Havent checked out the other stuff yet but they seem to be good for beginners.

I do have Wotgreal, It's very handy :) I havent got the exporter yet but I think I will check that out soon.

I guess I'll attempt something else. I basically got this working for the most part but I dont have the experience to troubleshoot it well, so maybe I will get that from trying different things...

Thanks for the input Romanov :)