Jump to content

Recommended Posts

I've been experiencing two possibly connected recurring problems whenever I mod in this game. 

1: It always says my mod is "incompatible with dst" despite marking it as compatible

2: If i add an item that is fully functional and working it will be fine in singleplayer but will make every other player crash their game if i drop it, stating that dst "ran out of memory"

The reason I believe these are connected is because the reason that something would be "incompatible with dst" but work in singleplayer would be because dst is multiplayer & would make the other players crash. I believe this would be a quick fix as I would assume there's just something wrong with my modmain or modinfo and not anything else. I have linked my mod in this post along with the steam version. Any advice that gives me a step in the right direction would be appreciated. If you can help me, I will give you any type of footage that you'd like, including footage with 2 players. 

STEAM - https://steamcommunity.com/sharedfiles/filedetails/?id=1909790996

FILE - https://www.mediafire.com/file/aybzscj9ba9xewj/MyMod.zip/file (The file uploader on the forums isnt working for me)

Forgot to mention that all of the changes as described in the steam description are negligible & that the only things i believe are relevant are the modinfo, modmain, and items themselves. I appreciate any help 

Edited by LordNiggle
Link to comment
https://forums.kleientertainment.com/forums/topic/117109-clientside-compatibility/
Share on other sites

Your modinfo looks good, except I don't think they can handle that large a number for your version. Why on Earth would you give your mod that large a version number? That's larger than a 32 bit integer.

Also, your mod is a server-only mod, so you need these lines:

all_clients_require_mod = false
client_only_mod = false

You should also add these:

priority = 0
server_filter_tags = { "modname", "or_some_descriptive_tag" }

Priority 0 should make your mod load after everything else (that doesn't have a lower or equal priority) so you have a bigger chance of your augmentations to be applied to any items added by other mods. If you were adding new items or specifically rely on certain things to be pristine when you edit it, you would set the priority higher, so you get your edits in before the other mods do.

In your modmain.lua you have your

if not GLOBAL.TheNet:GetIsServer() then return end

line, but it's at the bottom. It should be at the cutting point for which code you want executed only on the server (under it) and things you want executed on both the server AND clients (above it). Instead of just returning in the if-statement, you can also just put code you only want executed on the server in there, or flip the check so you can do things only on clients.

In your case, it should be the first line in the mod, because you don't want clients to execute ANY of your code. Your code is ONLY for the server.

Here's a link to a post I did about the modinfo.lua if you're curious.

Edited by Ultroman
  • Like 2
9 hours ago, Ultroman said:

Your modinfo looks good, except I don't think they can handle that large a number for your version. Why on Earth would you give your mod that large a version number? That's larger than a 32 bit integer.

I liked the big number because it looked funny on the mod screen lol

811588290_bandicam2020-04-0822-03-58-684.png.81bdd38b5a82f1553759b2861b7a944e.png

Ive also done the stuff in the modmain & modinfo

1195472616_bandicam2020-04-0822-06-19-113.png.b62728da3e3c0a94b013ffe937a37998.png

1154605536_bandicam2020-04-0822-07-07-537.png.ec2fe554c9de1cd536102451a2801d77.png

However the situation is the exact same, the recipes dont show up and items crash their game when dropped. However I've also noticed that their hunger is set to 101 and the stomach looks constantly shriveled up. This did not happen prior to me adding the items.

unknown.png

 

8 minutes ago, LordNiggle said:

However the situation is the exact same, the recipes dont show up and items crash their game when dropped. However I've also noticed that their hunger is set to 101 and the stomach looks constantly shriveled up. This did not happen prior to me adding the items.

unknown.png

 

Odd things like that happen when you break the game :)

I need to see your logs which will have whatever error is happening written inside of them. Check out the debugging section of the newcomer post on where to find them, and attach them to a reply here. You can drag files to the grey field below the editing box when you reply.

  • Like 1
2 hours ago, Ultroman said:

Same with your images. Make them jpg so they don't take up so much space (PNGs are large) and then you can attach those, as well. I can't see the ones you've posted.

Heres the client log btw. It's of my friend who i made forcibly crash his game by dropping the "petalsalve" item on the ground next to him.

client_log.txt

Well, it looks like it just randomly explodes. I can't tell you what's going wrong there. Maybe some of the changes that are now not being applied on the client SHOULD be applied on the client. I don't have the full overview of what you're doing.

Looks like it's something about the action tables or actions or something related that isn't synced properly between the client and server, and that usually means some code should also be added on clients or too much code is running on clients.

Yeah, I think clients still need the recipe code. Just not all the Add***PostInit stuff. I think the TUNING variables also only need to be set on the server.

Edited by Ultroman
  • Like 1
14 hours ago, Ultroman said:

Well, it looks like it just randomly explodes. I can't tell you what's going wrong there. Maybe some of the changes that are now not being applied on the client SHOULD be applied on the client. I don't have the full overview of what you're doing.

Looks like it's something about the action tables or actions or something related that isn't synced properly between the client and server, and that usually means some code should also be added on clients or too much code is running on clients.

Yeah, I think clients still need the recipe code. Just not all the Add***PostInit stuff. I think the TUNING variables also only need to be set on the server.

I've no idea how to set stuff specifically to server or client

if not GLOBAL.TheNet:GetIsServer() then
	-- Code that only gets fired on the client
end
if GLOBAL.TheNet:GetIsServer() then
	-- Code that only gets fired on the server
end

Example usage in modmain.lua:

-- Some code to apply on both server and clients.

if GLOBAL.TheNet:GetIsServer() then
	-- Code that only gets fired on the server
end

-- Some code to apply on both server and clients.

Example usage in a prefab Lua-file, usually in master_postinit or fn:

-- Some code to apply on both server and clients.

if not GLOBAL.TheNet:GetIsServer() then return end

-- Some code to only apply on the server, like adding and setting up components.

 

Edited by Ultroman
  • Like 1

I confined the mod into the simplest form possible. The modmain initializes only a prefab and its assets. The rest of the folders also contain only the prefab and its assets. At this point the question of where put the server/client bit seems very simple. I hope that the long wait in between your most recent post and mine isn't a big deal, I appreciate the help you've given me.

Item Test.zip

I did that and this time instead of other players crashing when i drop the item on the ground the server crashes when i spawn in the item, giving the attatched message. Im not sure how to fix that as ive never had to define it when adding any of the "server/client application code bits".

on the bright side the mod isnt marked as incompatible for no reason.

bandicam 2020-05-01 16-31-12-749.png

bandicam 2020-05-01 16-32-50-065.png

Item Test 2.zip client_log.txt

I removed the "GLOBAL." bit. I no longer crash when spawning the prefab, however other people still crash when I drop it and the item is called "MISSING NAME" so adding the "TheWorld.ismastersim" bit is null. Do you think it may be a problem with my copy of dst? This is very perplexing.

Ok i removed the thing and I get the same results as before i added it. other players still crash when i drop the item. I ran another experiment where i removed the    " if not TheWorld.ismastersim then   return inst    end"  statement to see if that fixed it but i was unsuccessful, however i believe that removing that statement was irrelevant to the player crashing. I figured out why the item was called "MISSING NAME" though, and that was because i removed the code that had the "STRING.PREFAB.NAME" stuff in it with the thought in mind that if i removed it, it would simplify the code and when this is all done and fixed i can just add it back.

I sent my friends client log during the second test. What I notice is that it says 

"Can't find prefab petalsalve"

followed by dozens of

"RakNet detected a missing replica (19644)"

 

my friend's client log.txt Item Test 3.zip

all_clients_require_mod must be set to "true" in your modinfo.lua. Any mod that adds items, characters or other new things like texture replacements MUST be set to be automatically downloaded by the clients, otherwise they won't have your mod files.

  • Like 2

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...