Mappers' Corner Mappers and Modders

Go Back   Omnip)o(tentS Forums > SERVERS > Mappers' Corner
Reply
 
Thread Tools Display Modes
Old 03-08-2007, 01:41 AM   #1
Optimus_P-Fat
Insider

 
Optimus_P-Fat's Avatar
 
Join Date: Jan 2006
Location: New Jersey
Posts: 3,633
Default UScript question
Reply With Quote


Okay you other Scripters out there COUGH*NODRAK*COUGH - RIDDLE ME THIS:

I programatically spawn a vehicle in a piece of UScript. It works fine. I override all of the calls on Vehicle that Disable Tick, and instead force Tick to be enabled all the time.

In Tick(), I add a log function basically logging the fact that Tick is happening.

Now here's the question:

Why the hell is Tick ONLY being called on the client?
__________________

http://www.p-fat.net/
Optimus_P-Fat is offline  
Old 03-08-2007, 10:44 AM   #2
Madame Arsenic
My non de plume...

 
Madame Arsenic's Avatar
 
Join Date: Dec 2004
Location: Seattle
Posts: 6,398
Default
Reply With Quote


Try something like this...

Code:
simulated function Tick( float Variable )
{
  Super.Tick( Variable );

  DoStuffOnServerOnly();
  DoStuffOnServerAndClient();
}
That help?
__________________
It's insane this guy's taint!
Send a message via ICQ to Madame Arsenic Send a message via AIM to Madame Arsenic Send a message via MSN to Madame Arsenic Send a message via Yahoo to Madame Arsenic Madame Arsenic is offline  
Old 03-08-2007, 10:53 AM   #3
Optimus_P-Fat
Insider

 
Optimus_P-Fat's Avatar
 
Join Date: Jan 2006
Location: New Jersey
Posts: 3,633
Default
Reply With Quote


You forgot the replication block for that code you got from The UnrealWiki, Arsenic

The thing is, Tick() should already be replicated. The WEIRD thing is, it IS being replicated to the client but NOT running on the server (previously I've only seen the reverse happen when you forget to mark it as simulated) -

Basically I want the physics collisions and ticks to happen on the server, so that I can handle damage. You cannot destroy an actor from within KImpact (the karma impact notification - yes I've gone back to karma land for this) so you have to queue up the damage and then apply it in the next tick. Problem is, Tick() (and KImpact) isnt called on the server, it's called on the client. Now I can go through all the funness of having all of the queueing happen on the client, but I'm not feeling very good about having the CLIENT tell the server that it needs to apply damage, which leads me to my other question - will Tick() end up being run on ALL clients in the relevant data set (in view, etc) or just the one client who invoked the spawn of the actor? If it only happens on that single client, then I wont have as much of a problem with replicating a variable back to the server to do something with.

Weird thing is that I'll have to replicate an actual "Apply Damage" call back to the server as a function, since Tick doesnt seem to be called.

Oh One detail I left out - this ONLY happens when nobody is driving the vehicle I spawn. If i spawn it and put a driver into it immediately, tick is called, and everything is happy. Before you tell me that removing a driver disables "Tick" - I already overrode KDriverEnter, DriverStatusChanged, and PostNetBeginPlay to enable it.
__________________

http://www.p-fat.net/
Optimus_P-Fat is offline  
Old 03-08-2007, 11:11 AM   #4
Nodrak
Im a little hoedrak.
 
Nodrak's Avatar
 
Join Date: Feb 2005
Location: umm, an Igloo?
Posts: 2,324
Default
Reply With Quote


You are calling whatever function you enable the tick with from a non-simulated function, thus breaking the server side end. I would have to see the code to verify, but im certain thats the issue. (Or a very similiar related issue that is more complicated to describe)
__________________
Because he's Hoedrak... - )o(Proxi

Nodrak is offline  
Old 03-08-2007, 11:39 AM   #5
Optimus_P-Fat
Insider

 
Optimus_P-Fat's Avatar
 
Join Date: Jan 2006
Location: New Jersey
Posts: 3,633
Default
Reply With Quote


Im calling it from KDriverEnter, DriverStatusChanged, and PostNetBeginPlay to enable it. All marked as Simulated.

I'm thinking of going a completely different route with this and making this object act like an alt fire redeemer warhead and inherit directly from Pawn, but instead of giving it PHYS_Flying, just giving it PHYS_Falling and an initial acceleration/velocity.

EDIT: Also, it is my understanding that functions NOT declared as simulated are never run on the clients, but only on the servers. So how would calling Enable('Tick') in one of them break the server side? Wouldn't it just not enable the tick on the client, but enable it on the server?
__________________

http://www.p-fat.net/
Optimus_P-Fat is offline  
Old 03-08-2007, 02:17 PM   #6
Nodrak
Im a little hoedrak.
 
Nodrak's Avatar
 
Join Date: Feb 2005
Location: umm, an Igloo?
Posts: 2,324
Default
Reply With Quote


Sometimes the client is the so called 'host' for a certain function and it thus replicates it out to the server and, not sure on this part, possible to other clients. However, PostNetBeginPlay gets called before something spanws IIRC.

I told you in the begining to just make it a projectile and add just add the player to it, the redeemer would work as its kinda both already.

Quote:
function KDriverEnter(Pawn P)
Sure dont look simulated to me...

However,
Quote:
simulated function ClientKDriverEnter(PlayerController PC)
is replicated.

Also DriverStatusChanged does not come up in the code. DrivingStatusChanged() does, however it seems to get called from non-simulated functions. Thus ruining its simulated nature... Odd..

Code:
// DriverLeft() called by KDriverLeave()
function DriverLeft()
{
    DrivingStatusChanged();
}
__________________
Because he's Hoedrak... - )o(Proxi

Nodrak is offline  
Old 03-08-2007, 02:38 PM   #7
Optimus_P-Fat
Insider

 
Optimus_P-Fat's Avatar
 
Join Date: Jan 2006
Location: New Jersey
Posts: 3,633
Default
Reply With Quote


Whoops - yes DrivingStatusChanged is the call that I was talking about.

I cant make it a Projectile for the specific reason that a Projectile isn't a pawn and there is no way to attach a controller to it. Hence why I have to make it either a vehicle or another pawn. I think I may just look down the path of deriving right from pawn using the redeemer warhead as a model to see how they handle things.
__________________

http://www.p-fat.net/
Optimus_P-Fat is offline  
Old 03-08-2007, 04:25 PM   #8
Nodrak
Im a little hoedrak.
 
Nodrak's Avatar
 
Join Date: Feb 2005
Location: umm, an Igloo?
Posts: 2,324
Default
Reply With Quote


Yea, I guess some of the class casting in the player controllers would require a subclass of pawn. Most of the projectile code is native too.
__________________
Because he's Hoedrak... - )o(Proxi

Nodrak is offline  
Old 03-09-2007, 09:06 PM   #9
Herr General
There really was a cake.
 
Herr General's Avatar
 
Join Date: Aug 2006
Posts: 991
Default
Reply With Quote


MR NUB asks...what is tick? I have seen it in error messages (error Function.Vehicle.Tick) but I have no idea what it is.
__________________

Yes, I'm still alive. Stop bothering me.

Send a message via Yahoo to Herr General Herr General is offline  
Old 03-10-2007, 12:19 AM   #10
Optimus_P-Fat
Insider

 
Optimus_P-Fat's Avatar
 
Join Date: Jan 2006
Location: New Jersey
Posts: 3,633
Default
Reply With Quote


Herr: http://wiki.beyondunreal.com/wiki/Unreal_Engine_Core

scroll down to the section titled "the tick" and it'll explain it all to you.
__________________

http://www.p-fat.net/
Optimus_P-Fat is offline  
Old 03-10-2007, 08:23 AM   #11
Herr General
There really was a cake.
 
Herr General's Avatar
 
Join Date: Aug 2006
Posts: 991
Default
Reply With Quote


Ok...i was just wondering.
__________________

Yes, I'm still alive. Stop bothering me.

Send a message via Yahoo to Herr General Herr General is offline  
Reply


Go Back   Omnip)o(tentS Forums > SERVERS > Mappers' Corner

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick glace into UScript for UE3 Optimus_P-Fat Mappers' Corner 10 12-13-2007 11:51 AM
UScript Tutorials 201: Advanced Variables (modifiers and arrays) Optimus_P-Fat Mappers' Corner 1 10-04-2007 03:25 PM
UScript tutorials 103: Functions Optimus_P-Fat Mappers' Corner 3 10-01-2007 12:47 AM
UScript tutorials 102: Objects (Classes) Optimus_P-Fat Mappers' Corner 1 09-30-2007 04:01 AM
UScript Tutorials 101: Variables Optimus_P-Fat Mappers' Corner 3 09-29-2007 03:44 AM


All times are GMT -5. The time now is 05:01 AM.