Jump to content

Mod Thoughts and Feedback


Recommended Posts

  • Developer
Hey modders! 

 

As you may have seen, I’ve been trying my hand at writing mods and seeing what is easy, what is hard, and what is just not possible. I’d love to involve all of you in this discussion!

 

Our goal is to make it easy for modders and hosts to create new experiences for players and share it with everyone, and give players the tools to find and play the experiences they'd like to have. 

 

In addition, there are certain things in the game that are rare or restricted, and we want to maintain that. For example, owners of Reign of Giants can play as Wigfried and Webber, and we’d like to leave it exclusive to the owners of the DLC to be able to do that.

 

So given that, there are some features we think will be important. Here is a rough list:

  • Re-enable the modding system by default so people can install mods

  • Show in the server listings when mods are enabled, and allow people to set required mods

  • Add Steam workshop support

  • Implement a peer review system so people can filter servers with popular mods

We know there are lots of other features and tools that could be of help to you, and I’d love to get your thoughts on them. Please let me know how your experience is, and we can have a discussion on how to help!

 

Link to comment
Share on other sites

That list sounds good, but there are a few things that would be good to fix first. Mod configuration data doesn't seem to load at all (I think it was added after the version of vanilla that DST forked from? but I might be wrong about that), which crashes the Mods menu and any mod that tries to access it. For now I've been commenting those calls out and hard-coding options, but since many mods were updated to use config it'd be way smoother if that got fixed.

 

I definitely understand about Wigfrid and Webber. I was thinking about having them in More DST Character and then I thought about that aspect and figured I should check with you first. Good thing I did. It does make me sad though that I can't play either of them for quite a while (until DST is integrated with the base game?), as those two are by far my favorite characters.

 

Some general thoughts based on my experience updating/writing mods for DST:

  • Anything with UI is mostly the same, and pretty easy. The one thing that's awkward right now is a lot of things were using AddSimPostInit to do stuff to the UI, but now you have to do a bit of a complicated two-step hook (add a listener to forest for playeractivated, then listen for setowner, then DoTaskInTime-- example below) to get the same result, because the player isn't there at the AddSimPostInit step. It'd be nice if there was an official hook for this, like AddSimPostPlayer or AddPlayerPostSpawn.
  • Custom items right now can't specify inventory item art unless you provide a new inventoryimages.tex, which means any mods that do that are incompatible with any other mods that do.
  • Custom avatars (for the player arrow things and the scoreboard) don't seem to be loading properly right now.
  • Because some stuff is only on the server, some mods won't really be able to work at all until there's a way for them to request data from the server that's not normally available to the client, like things from the kramped component. The most sensible way to implement this, I think, would be a way for a mod to communicate with another copy of the mod on the server, so that you can't just get information you shouldn't have with a mod on the client.
  • If possible, I think the best scenario for mods in terms of joining servers would be if the client could automatically acquire the mods from the server, and store a separate mod-enabling preset just for that joining session (so you don't end up with mods you don't want enabled when you leave and join another server, and you can't enable mods that you shouldn't be able to as a client). This is how I remember mods/custom maps working in say Unreal Tournament and Warcraft 3. The only problem with this that comes to mind is what happens with UI mods that you want to be ignoring whether they're on both server and client (or capable of running either way), like AlwaysOnStatus or StatusAnnouncements. Perhaps there could be a setting within a mod that says it can do that, and when a player joins the host can approve/deny their ability to use it? Though the approve/deny part may not be necessary at all.

Example of the two-step hook that's replaced AddSimPostInit:

local function OnPlayerSpawned(inst, player)    inst:ListenForEvent("setowner", inst:DoTaskInTime(0, StatusPost, player))endAddPrefabPostInit("forest",function(inst)	inst:ListenForEvent("playeractivated", OnPlayerSpawned)	end)
Link to comment
Share on other sites

  • Developer

It will come with time, but atm I have custom component that should exist only on the server and can't find anything to check if the world is server or clinet in the modmain file.

 

You should be able to check this using this function call (will probably need to specify the GLOBAL space):

TheNet:GetIsServer()

Link to comment
Share on other sites

It will come with time, but atm I have custom component that should exist only on the server and can't find anything to check if the world is server or clinet in the modmain file.

 

I see most game files using the following:

    if not TheWorld.ismastersim then        return inst    end

Edit: This would be something you put at or near the beginning of the component's constructor, rather than in the modmain, because TheWorld might not exist yet.

Edited by rezecib
Link to comment
Share on other sites

One utility that will open a lot of doors for both modders and people who run servers is a map editor.

Key features would include:

1) ability to quickly and easily define the shape of landmasses, as well as spawn in various structures utilized in adventure mode (such as insanity pillars)

Why it's important:

Challenge maps with limited space/resources or boss rushes will be amazing. Being able to define the shape of the land will help immensely with this task.

2) Define different spawn points to be utilized by each character, or even by each player.

Why it's important:

Scenario maps have the potential to be amazing.

The possibilities based off of LotR alone have my mind spinning.

(Mirkwood, humans vs webber anyone?)

Really, through mods and a map editor you could have a model of a lot of different parts of the LotR universe, especially if you allow multiple cave entrances. (Trip through Moria, anyone?)

The possibilities are nearly endless, honestly, if you can both alter the map and the gamerules.

Link to comment
Share on other sites

@Toros I'm working on a mod along those lines ("Maxwell the Director"), but I have roadblocks on both parts. I think I need a little help from Klei (@SethR? although maybe this is the domain of someone else) on one thing in order to have a tile-redefiner: recalculating the results of TheWorld.Map:GetIslandAtPoint() (or the boundaries of the island). I made a thread on it here. I've tried looking into it as far back as the C code, but I'm hesitant to try decompiling or something to go back further... (am I even allowed to do that? also it looks like C isn't very decompilable, unlike say Java).

 

As for spawn points, maybe I just haven't figured it out yet, but I can't seem to mod playerspawner.lua at all without just substituting the file. AddClassPostConstruct, etc, don't work.

 

Ugh, sorry for the messy text, but I can't seem to organize it nicely here, too many tangents...

Link to comment
Share on other sites

  • Developer

 

 

That list sounds good, but there are a few things that would be good to fix first. Mod configuration data doesn't seem to load at all (I think it was added after the version of vanilla that DST forked from? but I might be wrong about that), which crashes the Mods menu and any mod that tries to access it.

Yeah, I fixed this in the dev branch already. This should come out with our next big update, which is a bit TBD because it includes a bunch of other changes we're in the process of developing. Indeed it was a product of forking and then further development.

Link to comment
Share on other sites

Another thing I'm running into today is that there currently isn't a good way to have an inventory item that you can activate from the inventory without making it a "teacher" or an "instrument" or something strange. Normally you'd be able to set it to a useableitem, then override the useableitem component's CanInteract so that you don't have to equip it, but it appears that right now componentactions.lua essentially ignores that by reimplementing CanInteract in its own non-accessible way.

 

I guess in general this could be fixed by either having componentactions refer to a component's CanInteract or similar function when available, or by having a good way to add our own actions.

 

We now have functional Action and ComponentAction systems. Yay!

Edited by rezecib
Link to comment
Share on other sites

  • Developer

Any way of adding custom world preset to DST? I have some working over base game, but can't see them in DST, guess something is missing, but I can't find it.

 

DST and DS have separate save files and profiles (in your My Documents/Klei folder, there is a folder for each game). You might be able to manually copy/paste your presets from DS into the DST files, but I can't guarantee that it'll work.

 

Unless you mean that you don't see the option to save/select presets in DST at all?

Link to comment
Share on other sites

DST and DS have separate save files and profiles (in your My Documents/Klei folder, there is a folder for each game). You might be able to manually copy/paste your presets from DS into the DST files, but I can't guarantee that it'll work.

 

Unless you mean that you don't see the option to save/select presets in DST at all?

 

I see presets, but not my custom made presets.

Thanks.

 

Link to comment
Share on other sites

  • Developer

I see presets, but not my custom made presets.

Thanks.

 

 

Have you tried making new ones in DST? I've got custom presets in my game. Any presets you made in DS won't carry over without manually opening your DS files, copying the relevant data, and pasting that data into the DST files (which, again, still isn't guaranteed to work).

Link to comment
Share on other sites

Have you tried making new ones in DST? I've got custom presets in my game. Any presets you made in DS won't carry over without manually opening your DS files, copying the relevant data, and pasting that data into the DST files (which, again, still isn't guaranteed to work).

 

I used my island mod but without the RoG stuff and with changed API number, and preset didn't show up in the DST presets menu, I just replaced default survival DST level with my modded level and added tasks to the tasks file and I can generate Islands worlds.

 

Link to comment
Share on other sites

  • Developer

I used my island mod but without the RoG stuff and with changed API number, and preset didn't show up in the DST presets menu, I just replaced default survival DST level with my modded level and added tasks to the tasks file and I can generate Islands worlds.

 

 

Ah, I think we're talking about different things. Just to be clear, you're trying to use a mod that adds a new named custom preset to the world gen options? I'm referring to the "Save As Preset" button that results in Custom Preset 1-5.

 

If it's just the mod that isn't working, can you upload a copy of what you're working with so we can look into it? Thanks.

Link to comment
Share on other sites

Ah, I think we're talking about different things. Just to be clear, you're trying to use a mod that adds a new named custom preset to the world gen options? I'm referring to the "Save As Preset" button that results in Custom Preset 1-5.

 

If it's just the mod that isn't working, can you upload a copy of what you're working with so we can look into it? Thanks.

Since DST screens are different and modding support is not in yet so the custom made levels don't appear in the presets menu.

Islands.zip

Edited by _Q_
Link to comment
Share on other sites

 

Hey modders! 
 
As you may have seen, I’ve been trying my hand at writing mods and seeing what is easy, what is hard, and what is just not possible. I’d love to involve all of you in this discussion!
 
Our goal is to make it easy for modders and hosts to create new experiences for players and share it with everyone, and give players the tools to find and play the experiences they'd like to have. 
 
In addition, there are certain things in the game that are rare or restricted, and we want to maintain that. For example, owners of Reign of Giants can play as Wigfried and Webber, and we’d like to leave it exclusive to the owners of the DLC to be able to do that.
 
So given that, there are some features we think will be important. Here is a rough list:
  • Re-enable the modding system by default so people can install mods
  • Show in the server listings when mods are enabled, and allow people to set required mods
  • Add Steam workshop support
  • Implement a peer review system so people can filter servers with popular mods
We know there are lots of other features and tools that could be of help to you, and I’d love to get your thoughts on them. Please let me know how your experience is, and we can have a discussion on how to help!

 

will start off by saying that is it nice to see the big fish at Klei taking a look in our direction (the modding community) and would like to say thanks for doing so, it has been a while since we have had some Developer attention ;) Although the stuff below is not DST only, I still feel they are valid concerns.

 

 

 

 

We compiled a list of modding concerns awhile ago, though it has not been updated recently and to my knowledge, a lot of it, has not been addressed by developers. ( adding character animations is possible at least within certain limits and then there's a bunch of stuff that is referenced that i simply don't know about, let alone know if it might have been modified)

 

http://forums.kleientertainment.com/topic/32503-the-big-list-of-mod-related-code-suggestions/

 

So I will start off with a list of some of my concerns,

 

  1. You did accept pull request, but you didn't actually build or link mod tools on linux/mac versions, even tho it would take just building and linking to steam.

  2. then there's the part where some of the fixes are not even ported/used in DST at all at this stage at least according to my mod testing (last week) crashes in DST , postinitany/playerpostinit doesnt work on current build? even tho i assume you will port it when you fix modapi

  3. then there's the fact that modtools if you use pow2 file height and use just a single file end up making empty atlas-0 and ignoring it then making atlas-1 and putting stuff in as well as random undefined misbehavior on placing items into atlas boxes, that cause crashes or reference issues something's messed with it, i've yet to see a build that has more than 3 atlases and works fine, seems to be messing up consistently on bigger animations

  4. the fact that modtools don't export layers and cheerio's spriter example doesn't have swap object placeholders (which i fixed locally anyway BUt someome might want to do official proper positioning) as well as side/up too

  5. and are layer names intentionally made 'wrong' (e.g. having legs set on arm_lower arm_upper layers), making it impossible to show/hide layers on player anim with any consistency, or am i reading the files wrong (me and every possible decompiler i could look at)

  6. and could we please get a proper scripting reference to the UserData objects that are being exposed by the engine

  7. there's the fact that LAA is still not being turned on (at least last time I checked) and that ALL mod assets/prefabs are being loaded regardless of if they're in use or not (which is why we needed memfix but it has issues on its own and it should've been done on base game not a mod - so that the engine can 'prevent' the issues from manifesting/adapt to different behavior)

  8. then there's the fact that idle_up is the only case in which headbase_hat and headbase are showing at the same time if the toon is using hat, in all other angles, movement etc, headbase is properly hidden with owner.AnimState:Show("HEAD")

    owner.AnimState:Hide("HEAD") not show the reason why its like that is that idle_up has 2 copies, one as headbase properly set to layer head, another headbase is set to layer leg (????) and that latter is showing where it shouldnt depending on how and where they copied that template, it might be present in some other 'up' animations, and its seriously annoying bug

 

Here are some issues we have come across while modding our project and things we would like to see happen. Most of the issues we have had was in adv mode vs loading in cave mode.

 

1. the stuff loading in adv mode vs. loading in cave mode

 

there's the simple fact that no one knows what is in the actual generation calls

why is maxwell home generating with 600x600 tileset

and i cant get anything over 100x100 to generate?

 

that's not exactly a valid question though is it,

so it boils down to how many case(cave) case(survival) case(adventure) blocks are in c++ code that i don't see,

and what exactly is location=cave doing

 

2.We would love to have access to the full c++ source code for the stuff i don't see ( I highly doubt this will happen though.)

 

  1. We would love to have an exact explanation of how the parameters are interpreted? ( highly doubt this will happen as well)

     

  2. We would love to know if there is a special case of adv mode in the last zone or why it lets huge set piece getting generated or... how exactly does it work.

what is making maxwell home able to generate across multiple rooms?

or how does it generate at all.

 

  1. We would love to have a list of exported functions through userdata objects

 

  1. We would love to have list of functions exported on userdata objects.

 

  1. Would love to get more attention from the developers in the modding area of the forums.

 

Thanks for taking the time to read this. :)

Link to comment
Share on other sites

We would love to have list of functions exported on userdata objects.

So much this. The biggest roadblocks I run into when modding are where I trace the behavior of the game back through the Lua code and end up at "TheNet" or "TheSim" or "TheWorld.Map". A decompiler can give you the function names, but it's still pretty much impossible to figure out how to use functions that don't have good examples in the code already. A fully-documented class reference to all of the LuaProxy C++ objects would be amazing. Access to the source code would be even better, but really what I want is the class reference (something like what Javadoc or perldoc generate).

 

It might be good to organize the API into that too. As far as I've discovered we just have the API examples mod and the API updates for RoG by Seth. It's not like I haven't looked around, so either we need a better reference or it needs to be in a more obvious place.

Edited by rezecib
Link to comment
Share on other sites

  • Developer

Since DST screens are different and modding support is not in yet so the custom made levels don't appear in the presets menu.

 

Thanks for the upload _Q_! I tracked down a few issues with the mods interacting with the presets and worldgen and the fixes will be coming in an update soon. Hopefully in a couple of weeks.

Link to comment
Share on other sites

So after having tried some other things related to player spawning (namely trying to fix Abigail and her flower), here are the new hooks that I think would be most useful:

  • OnLocalPlayerSpawned - runs when the player's character in the current client/server has spawned. So it runs for you when you join a game or start hosting a game, but not when another player joins your game. This would be the only one relevant to clients, such as for adding UI mod stuff. This seems to be what my current two-part hook does (listen for player activated, which listens for setowner. I have no idea where setowner is actually being pushed, though, so that's a little disconcerting).
  • OnPlayerSpawn - runs when any player spawns, ideally with some data passed to it regardling whether the player just made a character or is rejoining with an existing one. This would only be available server-side. I still haven't figured out a way to do this reliably yet (I've been trying for several days; I thought overriding TheWorld.components.playerspawner:OnPlayerSpawned would do this, but it doesn't seem to run for rejoining players).
  • OnPlayerLeave - runs when a player is leaving (or the host is shutting down the server), but before the player's inst has been removed. Adding a listener for onremove seems to do this for client players (but not for the host player), but I haven't been able to get it to work fully satisfactorily, so I'm not sure. 

We don't need separate versions for the host player vs the clients because that's trivial to check with player == ThePlayer.

Edited by rezecib
Link to comment
Share on other sites

  • Developer
  • OnPlayerLeave - runs when a player is leaving (or the host is shutting down the server), but before the player's inst has been removed. Adding a listener for onremove seems to do this for client players (but not for the host player), but I haven't been able to get it to work fully satisfactorily, so I'm not sure. 

 

 

Thanks for the feedback rezecib!

 

Regarding OnPlayerLeave, I'm curious, in what scenarios would knowing when the host is shutting down the server be helpful for you? Either way, this function exists in mainfunctions.lua and you can already hook into it.

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
 Share

×
  • Create New...