Home   Help Search Login Register  

Author Topic: Script Issue on Dedicated Server  (Read 10781 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Script Issue on Dedicated Server
« Reply #30 on: 22 Sep 2007, 21:51:07 »
To help debug change start to:
Code: [Select]
_unit = _this
hint format ["%1",_this]
~1
alphaPos = []
;...put all code here that you want to display messages/play sound  to all players prior to mapclick...
?(not local _unit): goto "waitForMapClick"
And report back what it says.

For the "last block of code" I meant replace:
Code: [Select]
?(not isServer): goto "waitForServer_0"
; Code for Server to run... put code here to run only on server such as commanding the heli to position [alphaPosX,alphaPosY]...
;
heli1 sidechat "Taking Off"
heli1 sidechat format ["X: %1", alphaPosX]
heli1 sidechat format ["Y: %1", alphaPosY]
driver heli1 flyinheight 50
driver heli1 domove [alphaPosX,alphaPosY]

alphaUnpause = TRUE
publicVariable "alphaUnpause"

#waitForServer_0
@alphaUnpause
heli1 sidechat "inside alphaunpause"
alphaUnpause = FALSE
with
Code: [Select]
heli1 sidechat "Taking Off"
heli1 sidechat format ["X: %1", alphaPosX]
heli1 sidechat format ["Y: %1", alphaPosY]
driver heli1 flyinheight 50
driver heli1 domove [alphaPosX,alphaPosY]
urp!

Offline Case

  • Members
  • *
Re: Script Issue on Dedicated Server
« Reply #31 on: 24 Sep 2007, 06:43:22 »
Ok,

Just finished some testing, got some interesting results.

When running the mission on a non-dedicated server, I get debug info for _this as:

west 1-1-b:1 (Case)

When running on a dedi-server, I get:

<NULL-object>

So this totally explains the results I am seeing.

Now, how to fix this??

I have uploaded the current iteration of the test mission to:

www.rowlinson.ca/arma/mptesting.zip

If anyone wants to take a closer look.

Thanks Mr. Peanut.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Script Issue on Dedicated Server
« Reply #32 on: 25 Sep 2007, 14:24:45 »
Ack! Seems I somehow deleted my first post in this thread which will make anyone who henceforth reads this thread very confused. I found a possible bug which is all my fault.

Try changing the trigger On Activation from:
Code: [Select]
AlphaOn = TRUE; AlphaUnit = player; {publicVariable _x} forEach ["AlphaOn", "AlphaUnit"]to
Code: [Select]
AlphaOn = TRUE; AlphaUnit = player; {publicVariable _x} forEach ["AlphaUnit", "AlphaOn"]
It is possible the AlphaOn trigger will fire before AlphaUnit is defined, although I thought grouping the publicVariable into a forEach ensured that the variables would all be sent in the same packet.

I guess the Condition for this trigger should really be something like:
Code: [Select]
AlphaOn && not isNull AlphaUnitor even just:
Code: [Select]
not isNull AlphaUnit
Let me know if this works.
« Last Edit: 26 Sep 2007, 18:19:18 by Mr.Peanut »
urp!

Offline Case

  • Members
  • *
Re: Script Issue on Dedicated Server
« Reply #33 on: 26 Sep 2007, 05:05:43 »
Shoot,

That sucks Peanut.  Your overview was useful.  My code is totally written from your pseudocode, so hopefully people can make sense of my sample code.

Anyway,

I did some testing with your suggestions. 

Just to confirm what I have at this point:

2 Triggers on the map, and the alphaheli.sqs script.

1st trigger, activated by Radio Alpha, on act:
Code: [Select]
AlphaOn = TRUE; AlphaUnit = player; {publicVariable _x} forEach ["AlphaUnit", "AlphaOn"]; hint "first activated";
2nd trigger condition: not isNull AlphaUnit, on act:
Code: [Select]
AlphaUnit exec "alphaheli.sqs"; hint "first trigger";
On non-dedi, this all works fine.  On dedicated server, the 2nd trigger never fires, so, I guess the 'AlphaUnit' isn't being set properly somehow when run on the dedicated server.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Script Issue on Dedicated Server
« Reply #34 on: 26 Sep 2007, 16:35:33 »
Another stab:
Code: [Select]
AlphaOn = TRUE; AlphaUnit = player; {publicVariable _x} forEach ["AlphaUnit", "AlphaOn"]; hint "first activated";replaced with
Code: [Select]
AlphaOn = TRUE; AlphaUnit = player; {publicVariable _x} forEach ["AlphaUnit", "AlphaOn"]; hint format["first activated by %1", AlphaUnit];

addendum: after searching the forums I see that you can not use thisList select 0 to get the unit who activated the radio trigger, so I changed the above code snippet not to do that.
« Last Edit: 26 Sep 2007, 18:12:12 by Mr.Peanut »
urp!

Offline Case

  • Members
  • *
Re: Script Issue on Dedicated Server
« Reply #35 on: 26 Sep 2007, 19:30:03 »
Ok, finished testing so I deleted my other post here.

As usual, works fine on non-dedi.

On dedicated server, the first hint on the radio activated trigger displays correctly "First Activated by west 1-1-b:1 (Case)".

Then nothing happens, so it is like the second trigger with the condition "not isNull AlphaUnit" never fires and initiates the sqs.

Of course, this doesn't make sense to me, as displayed in the first trigger activation, AlphaUnit definitely is defined properly....

Let me know if anyone wants to have a quick look at the mission file, I am paranoid that I am doing something wrong here...

Cheers!
« Last Edit: 26 Sep 2007, 21:39:07 by Case »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Script Issue on Dedicated Server
« Reply #36 on: 26 Sep 2007, 20:32:22 »
I can't see that global (editor-placed) radio triggers are at all useful in MP games, since, as Peanut points out, everyone runs On Act when the radio is used and you cannot tell which player actually activated the trigger. Just use createTrigger to make local triggers on each client machine. That way, when activated, you can know that the local player (player) was the one that activated the trigger, then you must manually transmit the fact that that person has used the radio to the other clients and the server.
« Last Edit: 26 Sep 2007, 20:38:12 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Script Issue on Dedicated Server
« Reply #37 on: 26 Sep 2007, 20:48:18 »
Spooner, are you sure that a Radio Trigger runs on all clients? AFAIK for OFP this was not the case. I do not have a dual processor pc so I can not test this for ArmA.
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Script Issue on Dedicated Server
« Reply #38 on: 26 Sep 2007, 21:49:49 »
Yes, I had problems with it very recently and the fact that it didn't work like this in OFP makes perfect sense (I was converting and fixing some old scripts that would have worked if radio clicks weren't sent to every player)! Having a single, dual or quad processor doesn't make the slightest difference to you ability to test anything MP. You just need to run two clients and have "kickduplicate = 0;" in your server.cfg (so that you can join with two games from the same cd key).
« Last Edit: 26 Sep 2007, 21:54:15 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Script Issue on Dedicated Server
« Reply #39 on: 26 Sep 2007, 23:07:31 »
Um. I said dual processor so that you could run a dedicated server and a client on one machine.  My computer could not run two ArmA clients either.

So Case. According to Spooner the radio trigger fires on all machines in ArmA.  So it looks like the solution is to create locally a radio trigger for each machine.  I guess the other solution would be to only let the leader of a group be able to activate the trigger.

Quote
the fact that it didn't work like this in OFP makes perfect sense
Care to elaborate? It may make "perfect sense" to you, but the for the rest of us there is no reason to think the trigger system is any different in arma than in ofp (other than the ability to dynamically create/control them).
« Last Edit: 26 Sep 2007, 23:11:01 by Mr.Peanut »
urp!

Offline Case

  • Members
  • *
Re: Script Issue on Dedicated Server
« Reply #40 on: 26 Sep 2007, 23:29:55 »
Ok,

I can look into doing that, not quite sure how off the top of my head.

Does this explain though why this script isn't working?  At this point I am not concerned with multiple clients activating the radio trigger, I just want to get some of this script functional.

What will make sense for the mission I am doing is that I will only allow one specific unit (squad leader) activate the trigger.

Anyway, as per my question above, does all of this explain why it still isn't working in dedi-server?

Thanks again.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Script Issue on Dedicated Server
« Reply #41 on: 26 Sep 2007, 23:32:54 »
@ Mr Peanut:
Ah, well I generally do my testing on Ramadi, so I don't have too much trouble running server + 2 clients. I can just manage to play in normal missions with minimum settings, with 20-30 FPS being the norm in a "real" mission (15 FPS being the absolute minimum). My spec is AMD64 single-core 3700+ with 2gig 333Mhz memory (I suspect the memory size is actually more important than speed for running multiple clients without the PC grinding to a disk-swapping halt).

Well, if you only let leaders activate (with condition "this and (player == leader player)"), then yes, only they can activate it, but it is still triggered for absolutely everyone when they click the radio. This could be fine if you only have one player group (on any side) in the mission, but with more than one, you wouldn't know which leader did it. You'd need to make a separate trigger for each leader or this could still cause problems when trying to guess who was triggering the radio. You also have the problem that you can't tell a non-leader that the radio button is inactive for them, since they never get past the condition. I found using createTrigger resolved all the problems with global triggers, though there may be a way to deal with them effectively without resorting to scripting that I couldn't see...

As far as making sense in OFP, I didn't mean that the OFP way any more or less sense then the ArmA way. I meant that I now understand why OFP radio scripts (specifically, I was trying to make the westAri artillery script usable) are made as they are, because they seemed very broken when I tried to use them in ArmA!

I can see I'm going to have to make a test-mission to resolve this properly. It would be better to clearly describe the behaviour rather then me trying to remember based on the problems I've had so far.

@Case:
Not sure about whether this fixes your mission, since I was just commenting on a specific problem.
« Last Edit: 27 Sep 2007, 00:14:54 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Case

  • Members
  • *
Re: Script Issue on Dedicated Server
« Reply #42 on: 26 Sep 2007, 23:44:05 »
Thanks for clarifying Spooner.

If you want, download my mission, it is just created specifically to test this, so I don't mess up my actual mission.

I have a link in a previous post.  I will update the file with my current version, so hang on about 5 minutes for me to upload.

Cheers!

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Script Issue on Dedicated Server
« Reply #43 on: 27 Sep 2007, 00:29:01 »
Spooner,
Thanks for clarification.

Case,
(If I've got my head around this)The problem with the script is that when one player activates the radio trigger, the trigger fires for everyone. This means any player can click on the map.

In my last snippet every player should see themselves as the unit in the hint for the first trigger. I am not sure why the second trigger never fires. Every machine will publicVariable its own player as AlphaUnit, including the server whose player unit would be ObjNull. You would think that sometimes the server would get one of the players as AlphaUnit. If the server always gets ObjNull then I would conclude that the radio trigger runs only on the server.

If you can create a local radio trigger for each player (to replace the editor placed radio trigger), then I think you can use everything else we've done as is i.e. same condition for radio trigger, same second trigger, same script for second trigger. This would seem to be the best option.
« Last Edit: 27 Sep 2007, 00:30:52 by Mr.Peanut »
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Script Issue on Dedicated Server
« Reply #44 on: 27 Sep 2007, 00:36:52 »
I need to clarify what I wrote based on quickly making a test mission:
- Radio trigger with condition "this": When clicked by anyone, everyone in the mission runs On Act.
- Radio trigger with condition "this and (player == leader player)": When clicked by anyone, then all player leaders run On Act.
Thus, clicks by an individual are sent to everyone first, then the condition is checked.

Editor solution (seperate trigger and group-name required for every group that wants radio access):
- Put "westFireteam1 = group this" in the init line of everyone in the first group.
- Create a radio trigger with condition "this and (player == leader westFireteam1)". The On Act will only be performed on the westFireteam1 leader's machine if he clicks on the radio.

Script solution:
- Use createTrigger to create local triggers for every player. The On Act of the trigger will only be called if the local player clicks on the radio.

**EDIT** Oops, I made a mistake in the first paragraph. Corrected :-[
« Last Edit: 27 Sep 2007, 00:49:08 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)