You are here

Script Firing Order Starting A MP Game

16 posts / 0 new
Last post
Lance Botelle
Script Firing Order Starting A MP Game

Hi All,

OK, this has me stumped ....

I have a script called alb_modenter_chk on my areas' "On Client Enter Script" hook. Inside that script is an ExecuteScript function call for the entering client to fire my alb_althea_patchscript script. So, the client enters the area, the alb_modenter_chk fires, which then fires the alb_althea_patchscript. This (on the surfcae of it) all works well ... except when I monitor its behaviour with respect to a MP game.

The idea is that the alb_althea_patchscript can be *different* for each client, which (as far as I could tell) would mean that whichever version of the alb_althea_patchscript the client currently had installed would fire for their PC entering the area. A "dedicated" variable for the version of that script is defined and a simple debug check made to say which "version" of that script is being used.

And here is the problem .... In a MP game, even if the players have two different versions of the alb_althea_patchscript, if I update only the HOSTS version, the client takes its variable from their updated version of the script and NOT their own version of the script!

All scripts mentioned are campaign scripts, but I do not believe this has any bearing anyway.

My questions around this problem:-

1) Which scripts are "ignored" (or used from the host) if there any any discrepencies?

2) Surely there must be a limit as to which scripts the client uses (of the hosts versions), or otherwise the client will always be refererincing the hosts scripts and not local ones.

Can anybody (especially PW programmers) shed any light on this scripting behaviour.

Thanks in advance, Lance.

The World of Althéa Blog: http://worldofalthea.blogspot.co.uk/

  • up
    50%
  • down
    50%
Clangeddin

As you said, the scripts used are the ones of the host, it's the server that runs the scripts, not the client.

I'm not sure why you would want, in a multiplayer game, for every player to run his own version of the script.
Theoretically, they could script it to blast everyone for 9999 damage or steal everyone else' equipment, ecc... if that was possible.

Any script that is not used by host will be ignored. Scripts are not run by client. When you download files from Persistent Worlds, you will notice that you will never download any script (unless they store them in hacks, but that rarely happens, and has little point as well).

If you want to customize the behavior (within certain limits of course) of the script on a player per player basis, the best you can do is give them limited options that they can select via a convo or a UI, store those choice on a campaign variable or local variable and then alter the script's behavior (the script on the server) based on those variables.

 

  • up
    50%
  • down
    50%
Lance Botelle

Hi Clangeddin,

Goodness me, I was unaware that so much relied on the host .... Does that mean I can "delete" every script from the client side and the game would still run for them?

I am now trying to understand what the client "needs" in place to be able to join a MP game.

Thanks in advance.

Lance.

  • up
    50%
  • down
    50%
Clangeddin

Yes, you can delete every script from the client side and the game would still run them, as long as the host has them.

The client needs Hacks (those contain 2das, xmls, and other graphic resources), Tlks, Music files and the .trx area files. There is something more, but those are the big four.

Even Blueprints are not needed by the client. Only the server needs them.

You can find more detailed info here: http://nwn2.wikia.com/wiki/File_formats

  • up
    50%
  • down
    50%
Lance Botelle

Hi Again,

Well I have definitely learned something there. I guess I wil have to experiment some more with my MP setup to see how much of it I "don't" need to keep updating.

If you recall what the other bits I need are, do let me know ... and thanks for the link ... I will take a look. :)

Thanks, Lance.

  • up
    50%
  • down
    50%
Clangeddin

The Toolset should also have an automatic option for server staging and client staging, that will create two folders, one with the files needed by the client and the other for the files needed by the server, if I recall correctly.

  • up
    50%
  • down
    50%
Lance Botelle

Hi Again,

I will certainly look into that then. As that may help when it comes to testing as well as providing relevant files to clients.

This "staging" is not something I am familiar with, and so I may need some extra guidance if possible, but will check first.

Thanks, Lance.

 

EDIT: I just did a quick look, and could not see anything to do with "staging" - I did see something like ...

Shared Content ... Prepare Downloadable Files, etc ... and I also noticed Make Client Pack (PWC) File.

Are these the ones .... and .... Is there any literature I can read to understand how to use these specifically?

Thanks, Lance.

  • up
    50%
  • down
    50%
Clangeddin

Ok, I think I found it. On the toolset:

File -> Shared Content -> Prepare Downloadable Files. (this will take care of files needed by client)

File -> Shared Content -> Prepare Game Server Files. (this will take care of files needed by the server).

Please note that if the server is also a player that is just hosting a MP game, then he will need both.

Though most likely he already has them since he's making the module in the first place, so probably he will need neither. The second option is more thought about PWs handled by "Cloud" Servers. Since those are just servers that don't run any client, they only use the server files without the client ones.

The PWC files are an old thing from earlier versions of NWN2, nowadays they should no longer be needed. (even if they still work).

As for the downloadable files needed by Client, what you do is Scan (preferably without skipping anything) and then stage. You should find the files in the MyDocuments/Neverwinter Nights 2/Staging/Client folder.

The Assign Server ecc... settings are for the autodownloader, but it's not necessary as long as you provide some other mean to distribute your file. It's only really recommended for Persistent Worlds and not for standard multiplayer games.

  • up
    50%
  • down
    50%
Lance Botelle

Hi Clangeddin,

Thanks for confirming - we cross posted. :)

I will certainly look into this side some more now then.

Thanks, Lance.

  • up
    50%
  • down
    50%
Lance Botelle

Hi Again,

OK, I clicked on staging and now have a "client" folder inside my staging folder. ....

Is that all the client needs? Do they now just place that insid etheir own staging folder?

I could experiment I suppose, but wondered if it could be explained what happens next? And if there is anything else I should have done. E.g. I read something about "Pwc", but that folder is empty .... do I need to do anything there .... :)

I feel quite the newbie from this perspective.

Thanks, Lance.

  • up
    50%
  • down
    50%
Clangeddin

They must have those files in the MyDocuments/Neverwinter Nights 2/ folder each in their respective folder (haks in hak, .modules in modules, camapigns in campaigns, music in music, ec...) and yes, that's all they should need to play it as a client on a game hosted by someone else.
Of course if they try to start the game on their own, they'll get an error.
As I said earler, PWCs are an old thing from early NWN2 versions, nowadays they should be no longer needed.

  • up
    50%
  • down
    50%
Lance Botelle

Hi Again,

 

EDIT: Actually what I say below may not be correct .. as I just noticed you say that the client also has module and campaign folders ... but isn't that where all the scripts are anyway? If so, why go to the trouble of staging and producing another 600 mb file on top of the module and campaign folders?

THIS IS WHAT I THOUGHT AT FIRST ....

OK, so its the normal conditions with resepct to the haks/music/tlk.movies, etc .... and the "client" part simply takes care of the rest .... which I presume carries all the relevant "area maps" for the module?

So rather than have a "campaign" and "module" folder, they simply use the "client" folder ... and all other addons remain the same as if a SP game.

The "client" folder is the cut-down version (although fully implemented) set of files that take the stead of module/campaign folders .... and the client now draws the remaining info (scripts and whatever) from the HOST?

Is that about right?

Thanks again for helping to educate me. :)

Lance.

  • up
    50%
  • down
    50%
Clangeddin

Yes, it's about right.

The idea is distributing those files to someone else, I imagine that if you want to play with someone that does not have your module, it would be faster (and take less disk space) to download those files rather than get all the files that you have.

For module builders that host normal multiplayer games, it's obviously useless since they already have all the files they need to play it, they don't certainly need the client files. Those files are for the other players.

As for the module/campaign folders, only a certain subset of files (mainly the .trx ones, they are area files) are needed by client.

  • up
    50%
  • down
    50%
Lance Botelle

Hi Again,

Thanks for bearing with me on this .... I think what I am trying to ascertain is ... If we create "client" files via staging, what files do they actually replace? How will I know which files they have included in this staging that I do not need to include in the module/campaign folders .... or to put it another way, how do I know what files I should include in the modules/campaign folders after making a staged client folder?

Thanks again.

Lance.

  • up
    50%
  • down
    50%
Clangeddin

At the risk of repeating myself: Client staging is only for playing in multiplayer a game hosted by someone else.
Client stage files are just a subset of all the files that the module builder has.

If player X has the client staging files, he will only be able to join a multiplayer online game hosted by someone who has all the files, or on a PW server.
They will not be able to start that module in single player, and they won't be able to modify it with the toolset.

If player X has every file, then they can join a multiplayer game like above, but they can also run the module single player or modify it via the toolset.

It's just two different methods of distribution. The first one is the preferred method by PWs because they don't want players to know every trick (especially scripts) or spoiler in the module without playing it. The second one, the standard one, is generally used for distributing single player modules on the Vault or on the Nexus.

You can still use the first method for a quick multiplayer run if the other player doesn't want to download all the files, doesn't care about single player or has disk space problems.

The only thing that you should keep in mind is to be wary of the Autodownloader, if you use it, it will automatically opt for the first method of distribution and delete any file in the module folder that is not strictly needed to run the game as a client. This means, that if you are a module builder, and you connect to yourself (by running the standalone server application) as client, there's a risk that you will lose all your areas, blueprints and scripts. It happened to me once, it was NOT funny. So, make a backup before using the Autodownloader if you're not sure about that. It can be WICKED. :P

However, as I said before, autodownloader is not mandatory, so you can just avoid to use it entirely if all you plan to do is to host a session of multiplayer games with some friends. The autodownloader is a quality of life feature for Persistent Worlds, and it should really be limited to those only.

  • up
    50%
  • down
    50%
Lance Botelle

Hi Again,

I do now understand that it is an alternative means of distribution. :) And I can see the reasons for the differences. Maybe my own example may help me to explain my difficulty with which methods are involved ...

I have all the folders (haks, tlk, movies, UI, modules, campaigns) that are currently available to download for players .... However, if I wanted to minimise this download for my friend who will be playing as a client with me as ... (and any other players who may want to join in), I know I can "stage" the files as an alternative download, but how will I know which files are now not neccessary from the module/campaign folders (or any other come to that)?

Also, I noticed there were "tick boxes" to exclude haks, etc in a stage that had already been included (and not chaged), implying these folders could be included in the hak folder (etc) already.

I also noticed the "staging" folder contained a lot of lmza files, which appear to be all sorts of places. Again, my problem is I don't know what I have now included in this "staging" folder and what I must stil include in the other way.

I hope that is asking a better question so that it makes it easier to explain what I am not understanding. :)

Thanks.

Lance.

  • up
    50%
  • down
    50%