View Full Version : Server mod
Panthera
11-26-2007, 05:43 AM
If I want to create a mod that just runs on the server, say, to modify output to the log, how would I initialize it? Take for example a basic Hello World script. What if I wanted this to run everytime a new game is started?
class HelloWorld extends UTGame;
function Init()
{
LogInternal("===========");
LogInternal("Hello World");
LogInternal("===========");
}
I tried messing around with running the init via events such as:
event PostBeginPlay()
{
Super.PostBeginPlay();
Init();
}
...but to no avail.
Pfhoenix
11-26-2007, 12:40 PM
First of all, all GameInfo classes exist solely on the server. Second, any function not declared simulated will not run on clients. Third, you can't force a GameInfo subclass to run when every game starts up - every game is its own GameInfo class.
Perhaps you should start with a mutator, to help you learn the basic class interactions and how they work.
BattleMode
11-26-2007, 01:19 PM
Second, any function not declared simulated will not run on clients. While in general true, this might be an oversimplification. Functions that are not declared simulated can actually run on clients, for example in some special cases where the client owning an actor is the authority on that actor.
Panthera
11-26-2007, 01:52 PM
First of all, all GameInfo classes exist solely on the server. Second, any function not declared simulated will not run on clients. Third, you can't force a GameInfo subclass to run when every game starts up - every game is its own GameInfo class.
Perhaps you should start with a mutator, to help you learn the basic class interactions and how they work.
Of course it runs only on the server - that's where I want this to run. So we extend UTDeathMatch, but this still doesn't answer my question.
I don't need a mutator, that's why.
Subclassing UTGame creates a completely new GameType (like Deathmatch, CTF,...). To run a certain GameType on the server, you need to specify the "path" (Package.ClassName) in the commandline.
So if you don't load the GameType, there can't be any PostBeginPlay()-calls.
Oh, and although the UTGame-Actor doesn't exists (normally) on clients, it might be needed to have the package sent to them. The reason is, that other objects might call a static-function in the GameType-class client-side (like the GetLoadingHints()-function or whatever it was called in UT2k4).
Panthera
11-26-2007, 10:55 PM
This is just a test I'm trying to perform, but what I really need to do is include a server mod that extends Info and dump data to a file. So far things are looking good, except for some method of actually calling the routine each time a new match starts up.
KewlAzMe
11-27-2007, 12:43 PM
How are you going to call it if its not a mutator? You need a mutator to call
Class servermut extends UTMutator
function InitMutator(string Options, out string ErrorMessage)
{
Init()
Super.InitMutator(Options, ErrorMessage);
}
Unless you are talking about the concept of ServerActor that the old UT's had.. now sure how that works in UT3
Panthera
11-27-2007, 04:21 PM
Unless you are talking about the concept of ServerActor that the old UT's had.. now sure how that works in UT3
Yes, a UT2004 style ServerActor - that's what I need to do.
Cratos
12-26-2007, 07:03 PM
where has the ServerActor Section in ut3 gone? I can't find it in the inifiles...
Shambler
12-27-2007, 07:12 PM
In UTEngine.ini under [Engine.GameEngine], add
ServerActors=YourPackage.YourClass
Unfortunately server actors are now only initialized the first time you start the server up, and are lost during level-streaming transitions; the only way to prevent that is to use a mutators 'GetSeamlessTravelActorList' function to carry the serveractor on to the next level, but that kind of removes the point in using serveractors in the first place, as you can just use a mutator instead.
Powered by vBulletin® Version 4.1.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.