When something is a "server mod", can it also include "client mod" code?

Discussion in 'Mod Discussions' started by swizzlewizzle, October 31, 2014.

  1. swizzlewizzle

    swizzlewizzle Active Member

    Messages:
    216
    Likes Received:
    56
    What I mean is, when we write up a mod and throw it into the server_mods folder, what exactly is that doing? Is it simply giving access to shadowing the server-script folder?

    A few other questions:

    1. Can mods in the server_mods folder include client-side attributes/code such as modifications to the UI, audio for the units, etc..?

    2. For code that we want running all the time on the server, where should we hook into exactly? Should we be shadowing server-script scripts? (I've noticed a bunch of code related to setting the game state, etc... is everything able to be replaced as a server_mod?)

    3. How is the distinction between code running on the server and code running on the client made?

    4. Stuff like the commander_table.js file... anywhere to get additional information on what they do? Perhaps what i'm actually asking for is some basic documentation.. something like API documentation I suppose..

    5. Is there anywhere in the code to get a list of functions/etc.. we have access to when shadowing server scripts? Basically a function dump?

    I'm sure some of these questions have been answered elsewhere, but I didn't really get anywhere with a search. Perhaps this sort of info is organized somewhere that I didn't come across yet...
  2. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    1.) I am quite sure you can shadow client side files, at least those that are loaded in live_game. Not sure about the lobby scene, obviously that isn't a perfect solution, as you will need to update the mod if the shadowed file is changed in a PA patch, should try for js files that are not changed very often for that.

    2.) I don't think there are any hooks for server mods that modify gameplay apart from the ones you can see in the existing server scripts. I don't know if you can shadow the server scripts themselves, I don't think so. If you can't shadow them you need to directly modify the server, so you will need a custom server.

    3.) Code running on the server is running on a machine potentially thousands of kilometers aways from the client? ;)
    2 different programs on potentially 2 different computers basically. If you look at the PA directory you will find js scripts in 2 places: server-script and ui. I think it is obvious which is which.

    4.) You have to understand it by yourself, but if you have specific questions you can ask in this forums, there are people around who are pretty good at quickly figuring stuff out.

    5.) https://forums.uberent.com/threads/the-server-js-api.65101/
  3. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    I believe you can modify some of the server with a server mod. That's actually what cheat mods do for example. (Which is why they're considered cheat mods), this doesn't seem to work on everything however.
  4. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I think that is just a "hack" in the server code that basically directly looks for those specific files. No general system. That's still in the works.
    squishypon3 likes this.
  5. swizzlewizzle

    swizzlewizzle Active Member

    Messages:
    216
    Likes Received:
    56
    @cola_colin what exactly do you mean by "directly modify" the server? Are there other scripts/code we can get our hands on besides the stuff in server-script? Bit confused about that..

    Instead of shadowing, for example, playing.js under states, is there some way I can put in my own .js file that hooks into the main init without modifying base files?

    What exactly is live_game? Haven't seen a reference to that yet..
  6. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Directly modifying the base files is what I mean. There is no modding system for the server yet that can do what you want I think.
    There is no more than you can see in server-script afaik.

    live_game is the main scene of the ingame UI.
    \Planetary Annihilation\stable\media\ui\main\game\live_game\...

Share This Page