Simulating a server

Discussions about Coding and Scripting
Post Reply
Cemini
Novice
Posts: 11
Joined: Thu Feb 24, 2011 9:45 am

Simulating a server

Post by Cemini »

To test code I use a dedicated server and join it from the same machine.

Usually I use a batch file looking like this

Code: Select all

cd C:\unrealtournament\system\
ucc server SOME_SETUP -server log=server.log
Now the problem is that in general this is good to test replication and stuff. But sometimes some parts of the code (like owner references used for comparisons or servertravel timing) prove to be ok in this testing but bug or behave differently than on a real server.

So the question is:
Is it possible to simulate a true server for testing on one PC?

Thanks in advance
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Simulating a server

Post by Feralidragon »

http://wiki.beyondunreal.com/Legacy:Run ... r_With_UCC

That should work.
Anyway, I always test my stuff as "dedicated" server, but instead of using ucc, I start the game, go to "Start Multiplayer Game" and then hit "Dedicated", and always worked for me and works perfectly fine in the servers.

As for replication of actors "you own", don't forget that in replication if you (as your playerpawn actor) are the instigator of an actor spawned into the level, that actor will be ALWAYS relevant to you no matter what, meaning that depending on your code it may all work for you, but may go wrong once in a real server since the same actors may not be relevant to you since their instigators are other players.
One way to avoid and be sure things will work (and the way I actually use for my stuff and proved to work flawlessly after several tests) is to let bots to be the instigators of some stuff. For instance:
- I test certain replication by being me the instigator;
- Then I hand whatever I have to the bots and let them be the instigators of the actors they create;

If everything replication-wise is fine, then either it's you or the bots instigating the spawns of said actors, it will always work the same way (and it's sure to work in a true server as well), but in case it works for you but it doesn't work for bots or works badly, then you have a replication problem relative relevancy that you must sort out.
This way you can even test the AI at the same time (I don't know if you care about AI, but in case you do you can test 2 things at the same time).
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Simulating a server

Post by Rakiayn »

so how can you get the bots to be the instigator. i guess by letting them join the game first?
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Simulating a server

Post by Feralidragon »

No, no, I think you didn't understand what an "instigator" is.

Instigator is a variable of the class "Pawn" that exists in all actors. When you spawn actor A from actor B, actor A gets the Instigator from actor B.

So let's take the Ripper for example:
1 - it starts with no Instigator;
2 - once you pick it up, you (as player) become its Instigator;
3 - once you fire the razor blades from them, the actual projectiles are spawned from the weapon itself, and since the weapons has its Instigator set to you, the razors Instigator will be you as well (since they take the Instigator from your weapon).

So basically, every actor that has an Instigator assigned, will have the spawned actors Instigator set to the one from the actor they were spawned from.

What happens in replication is quite simple: an actor is always relevant to its Instigator, to all other pawns other relevancy properties have to be met, and this is what you have to consider.

So when testing a weapon online for example, if you're the only "pawn" testing the weapon, then you will be the instigator to everything that weapon spawns and to everything the respective projectiles/effects/actors/whatever that get spawned from them.
So what I personally do online to not be deceived, is to hand over the weapon to a bot, as by doing so the weapon instigator will be the bot, and therefore everything that gets spawned from it will have the bot as instigator, and therefore the actors that get spawned from there are only relevant to me if other relevancy properties are met (read here for more details: http://wiki.beyondunreal.com/Legacy:Rep ... bfuscation).

If something works when you're the one holding the weapon or while you're the instigator of an actor, and then it doesn't work fully as wanted when the bot is the instigator, then you have a relevancy problem.
Cemini
Novice
Posts: 11
Joined: Thu Feb 24, 2011 9:45 am

Re: Simulating a server

Post by Cemini »

Ok thanks.
Yes I use bots too to have more than one Pawn to apply the feature to.

My latest problem was that

Code: Select all

Self.Owner.Owner ( MyActor->HUD->PlayerPawn ) 
worked for testing but produced Accessed Nones online.

Fix was to save the Hud owner in MyActor after spawning it.
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Simulating a server

Post by Rakiayn »

Feralidragon wrote:No, no, I think you didn't understand what an "instigator" is.

Instigator is a variable of the class "Pawn" that exists in all actors. When you spawn actor A from actor B, actor A gets the Instigator from actor B.

So let's take the Ripper for example:
1 - it starts with no Instigator;
2 - once you pick it up, you (as player) become its Instigator;
3 - once you fire the razor blades from them, the actual projectiles are spawned from the weapon itself, and since the weapons has its Instigator set to you, the razors Instigator will be you as well (since they take the Instigator from your weapon).

So basically, every actor that has an Instigator assigned, will have the spawned actors Instigator set to the one from the actor they were spawned from.

What happens in replication is quite simple: an actor is always relevant to its Instigator, to all other pawns other relevancy properties have to be met, and this is what you have to consider.

So when testing a weapon online for example, if you're the only "pawn" testing the weapon, then you will be the instigator to everything that weapon spawns and to everything the respective projectiles/effects/actors/whatever that get spawned from them.
So what I personally do online to not be deceived, is to hand over the weapon to a bot, as by doing so the weapon instigator will be the bot, and therefore everything that gets spawned from it will have the bot as instigator, and therefore the actors that get spawned from there are only relevant to me if other relevancy properties are met (read here for more details: http://wiki.beyondunreal.com/Legacy:Rep ... bfuscation).

If something works when you're the one holding the weapon or while you're the instigator of an actor, and then it doesn't work fully as wanted when the bot is the instigator, then you have a relevancy problem.
I should have been more clear. but I was thinking about actor that are not spawned by bots or players but by mutators or gametypes or other actors. should I give them an instigator aswell?
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Simulating a server

Post by Feralidragon »

No, you shouldn't. The point here is mostly "if your actor has an instigator, then you will get problems if you test the actor by youself alone in a server (no bots or players)", however if it has no instigator then it always has to obbey to other relevancy checks and never the instigator one, and in that case having bots or not in the server to test it is irrelevant as if it works with you, it will work with everyone else.
Post Reply