Jump to content

Serve contents through a web-server


Recommended Posts

Hi survivors,

 

we want to bring a little more color and variety into the game for our server and are currently adjusting a few things.
This includes of course new items, recipes and blocks.

But we want to make it as easy as possible to get started, and many players are often discouraged from having to install mods.
That's why we want to do everything with server-side mods.

 

But here's the rub. The display options are often limited, although it would be cool if you could use your own item icons or paintings.

So the question is whether it is possible to do this in an XML definition.

 

Example:

<configs>
    <append xpath="/items">
        <item name="MultiMegaAxtThingi">
            <property name="DescriptionKey" value="MultiMegaAxtThingi"/>
            <property name="CustomIcon" value="@http://our-web-server/item-icons/MultiMegaAxtThingi.png"/>
...
...
...

Does this make sense or is it possible to do something like this, or is the only way through a client mod?

 

I am really looking forward to an answer.

Link to comment
Share on other sites

I just started learning Xpath so take anything I say with a grain of salt, but my initial thought is that it is not possible to do it that way.

 

When the game loads up, it first puts into memory the information in the config folder on your computer.  Then the mods (either server side or on your computer) will update the information for each xml file in the memory.

 

I don't think xpath can be used to physically download copies of objects and install it on other computers.

 

Probably the best thing to do (at this time - it may change once game goes final) is to generate a zip file with the objects in the folder structure that the end user will need to copy and paste into their game folder.  Include readme instructions on what they need to do in the zip file.  Then provide a link for them to download it from.

 

Then all they have to do is unzip the file, drag the folder and drop it in their location based on the instructions provided in the readme file.  That is fairly easy to do.  If they have issues doing that, they probably shouldn't be adding mods to a game in Early Access.

 

Though I did do a search and found this

 

 

You can download those mods and see how they did it there.  I can't do it since I am at work right now

Link to comment
Share on other sites

On 9/1/2021 at 1:00 PM, dwarfmaster1974 said:

The display options are often limited, although it would be cool if you could use your own item icons or paintings.

So the question is whether it is possible to do this in an XML definition.

 

Example:

<configs>
    <append xpath="/items">
        <item name="MultiMegaAxtThingi">
            <property name="DescriptionKey" value="MultiMegaAxtThingi"/>
            <property name="CustomIcon" value="@http://our-web-server/item-icons/MultiMegaAxtThingi.png"/>
...
...
...

Does this make sense or is it possible to do something like this, or is the only way through a client mod?

 

What you have written is definitely not possible in the game right now. Furthermore, I would be surprised if TFP ever implemented that as an option. It would mean the game would have to open an unsecured HTTP request, to some website outside its control, to download a binary file that may or may not actually be an image file.

 

For now, "server-side" mods have to only include:

  • assets that the game pushes from its own directories on the server, to its own directories in the client (XML, the world map)
  • assets that are shipped with the game, so everyone already has them (this is how Snufkin's server-side modlets work, for example)

Hopefully some day TFP will add the ability to push other relatively small assets, like image files, to clients. Until that happens, you either have to live with the assets that are in the game now, or require clients to install their own copies of custom assets.

Link to comment
Share on other sites

Hello khzmusik,

 

currently, this is already possible in some places.
For example, in the XUi, where I can also integrate logos from external URLs.
Also, it is possible to load the crafting and login screens externally. 


They're even only so. It must be an external URL.


Therefore, the thought that this could work also with the items or other things.

 

Maybe I'm also completely wrong in these cases.

Link to comment
Share on other sites

On 9/10/2021 at 9:54 AM, dwarfmaster1974 said:

Hello khzmusik,

 

currently, this is already possible in some places.

 

Oh, that is interesting. I did not know that. I am very surprised that TFP allow that.

 

So, I did some research. I looked at the modlet you linked, then decompiled the code to see where it was actually loading the image.

 

If you're curious, the class in the code that does this is called "XUiV_Texture". It holds a reference to a Unity "WWW" object that it uses to download the texture. As the name suggests, it's not used anywhere except in the various XUi classes.

 

So, I'm almost positive that you can only do this for the XUi textures. Those are defined by the XML in the "XUi" folder, and specify how the various window elements look in the UI (like the color of the player backpack window).

 

I don't see any indication that you can use a URL anywhere else. But, obviously, I've been wrong before.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...