Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Crynux

True LAN Coop - Proposition

Recommended Posts

Crynux    112

Hello,

 

I was first introduced to Don't Starve a few weeks ago. After about a week of gameplay... I felt the need for multiplayer.

 

I discovered a few local multiplayer mods; one of which I tried... the '3 player coop' mod, seemed to work quite well.

 

About 3 days ago, I decided to start on my own true 'lan' multiplayer mod. I've made some progress, and yesterday I was able to control a character remotely over the network with 2 copies of the game running on 2 seperate machines.

 

At the moment, the whole 'mod' is just a bunch of things hacked together as a proof of concept. It can be quite easily fixed up into a real base for a true coop mod.

 

I, however, fear that it would be too much for one person to take on (in addition to being a full time university student), and am looking for some help.

 

There are a number of things to consider when making a mod such as this, as ultimately, you need all 'clients' to be synchronized as close a possible.

 

Additionally, code would have to be written for multiple OSes.

 

So to get to the meat of this post. I would like to continue this mod, but can/will only do so with the assistance of some dedicated, experienced modders. If a team could be formed to finish this mod, or at least to bring it to a beta, I'd consider it a success.

 

I have a set of objectives for this mod, and an idea of where it should begin. I also have a lot of experience programming/scripting (not so much in lua).

 

EDIT: We have 2 developers at the moment. Myself and Desblat. I do all of the server code, and quite a bit of the client code. Desblat does only client code... and has helped me greatly with understanding how the game works.

 

If you're interested... here's a list of positions/abilities needed in order to get a start on this project:

  1. A windows developer with experience in creating dlls/exes. Network development experience is a major bonus.
  2. A macosx developer with experience in <insert whatever library a mac uses here>. Network development experience is a major bonus.
  3. Don't Starve experts. We'll need someone to help animate the game... someone who knows what things do. As an example you should know how to make a character/unit/whatever move on demand, rather than randomly.
  4. Anyone who thinks they can contribute. I'm not one to say that only 'experts' can help out, as I'm sure there will be tasks that other, less experienced modders can do. I could be considered a unexperienced modder, as I only started 3 days ago.

(If you're wondering why I didn't list a Linux developer; that's me. But we could probably use multiple people in these positions. I imagine having some sort of code repository for the project eventually.)

 

That's good enough for a starting list. Of course, we'll work together as a proper team. Once the team is assembled (ie we get at least 1 person in each of the above), I'll forward plans and ideas.

 

Lastly, don't hesitate to pm me for details. If you want to join the team, give me an idea of what you can do, and where you think you might fit in.

 

Anyways, that's all I'm going to say for now. I believe this mod could be a great success, but it will require a lot of work, as others have said before.

 

-Crynux

Share this post


Link to post
Share on other sites
GuyPerfect    226
There are a number of things to consider when making a mod such as this, as ultimately, you need all 'clients' to be synchronized as close a possible.

 

In particular, you'll need to make sure the map is the same for everyone. I know you can edit the map via Lua (the Pitchfork does it), but if not everyone's standing on the same stuff, it won't work. (-:

 

Most of the brains use math.random() to make decisions. For a co-op mod, you'll have to disable all automatic brain activity and pipe it in through the network instead. By the sounds of it, you have some experince with this already.

 

 

Additionally, code would have to be written for multiple OSes.

 

Does Lua not support intrinsic networking? I admit Lua isn't my native language.

 

 

That's good enough for a starting list. Of course, we'll work together as a proper team. Once the team is assembled (ie we get at least 1 person in each of the above), I'll forward plans and ideas.

 

I've considered the guts of a multiplayer mod myself, though not at length. Like mentioned above, anything that's random would have to be fed over the line. Critters in particular would have to be controlled by a host and everyone else receives critter commands via network. Other random things could be processed client-side and sent to all the peers, such as which vegetable grows from a planted seed.

 

For combat, I figure damage will only be dealt to the local player and not any of the remote players. Instead, when a player gets hit, he tells his friends. This allows him to run away from an attack, where on his friends' screens it may look like he gets hit.

Share this post


Link to post
Share on other sites
Crynux    112

In particular, you'll need to make sure the map is the same for everyone. I know you can edit the map via Lua (the Pitchfork does it), but if not everyone's standing on the same stuff, it won't work. (-:

 

Most of the brains use math.random() to make decisions. For a co-op mod, you'll have to disable all automatic brain activity and pipe it in through the network instead. By the sounds of it, you have some experince with this already.

 

 

I have already looked into this issue. There's a way to override math.random(), and make it return the same value constantly. I've did this in a way that for instance of the game, whenever I generate a map, the map is exactly the same (from what I can tell). The downside is that if you use the same method on a differnt comptuter, for some reason it generates another different map. I intend to look more into this today.

 

If I cannot succeed with that method, then I have yet another idea for fixing the map generation.

 

 

Does Lua not support intrinsic networking? I admit Lua isn't my native language.

 

I'm not familiar with Lua either. But I did check to see if the Lua implementation that the game uses supports networking. I tried for a couple hours, and couldn't get anything to work. Mainly, it couldn't load the socket.so file or something.

 

 

I've considered the guts of a multiplayer mod myself, though not at length. Like mentioned above, anything that's random would have to be fed over the line. Critters in particular would have to be controlled by a host and everyone else receives critter commands via network. Other random things could be processed client-side and sent to all the peers, such as which vegetable grows from a planted seed.

 

For combat, I figure damage will only be dealt to the local player and not any of the remote players. Instead, when a player gets hit, he tells his friends. This allows him to run away from an attack, where on his friends' screens it may look like he gets hit.

 

The critters and such, from my point of view, are the most difficult, as it would require modifying their Lua implementation to take into account the networking scheme I've devised.

 

As for combat, I imagine you could give each player representation in the game their own 'local' health. One central server would receive updates from the clients, in which you would be able to detect when someone or something attempted to attack, and from there update the health of the player for every person.

 

Overall, it is a complex task. But I believe it is possible with some determination. Currently I'm working on compiling my code for Windows... haven't touched dll's in a while. (Linux is my primary OS)

 

Thanks for the input! :)

Share this post


Link to post
Share on other sites
Desblat    639

Hi, I am creator of local-coop multiplayer mod for DS.(3 player-local-coop)

Have you seen "messager mod" by Cheereo(the developer)?
It work with internet, and I said to the Cheer: "Hi, lets build online muliplayer!" And he answered: "This would be to slow and multi will be bad." I asked him to explain how does internet work with DS to make on-line playing, but he deleted all his internet mods ("messager" and "death noticer"). KLEI diffenetly DO NOT want online-multiplayer to be made...

KLEIs' opinion is NOTHING for me.

I can help you with creating online-mod. - The code from Cheers internet "messager" I kept is very useful. I have tons of ideas about code of it. Give me your skype address if you need help.

Regards.

Sorry for bad English, I am from Russia.

Share this post


Link to post
Share on other sites
Crynux    112

Hi, I am creator of local-coop multiplayer mod for DS.(3 player-local-coop)

Very cool, I thought I had recognized your name when I read your post. I used a part of your mod in the code I have currently... mainly because I have very little knowledge of the prefabs and stuff.

 

Have you seen "messager mod" by Cheereo(the developer)?

It work with internet, and I said to the Cheer: "Hi, lets build online muliplayer!" And he answered: "This would be to slow and multi will be bad." I asked him to explain how does internet work with DS to make on-line playing, but he deleted all his internet mods ("messager" and "death noticer"). KLEI diffenetly DO NOT want online-multiplayer to be made...

KLEIs' opinion is NOTHING for me.

I can help you with creating online-mod. - The code from Cheers internet "messager" I kept is very useful. I have tons of ideas about code of it. Give me your skype address if you need help.

Regards.

Sorry for bad English, I am from Russia.

I haven't seen the messager mod. I find that the networking part of creating a multiplayer mod isn't bad... it's more so the modification of the prefabs to support it that takes the most time.

 

PM Sent

Share this post


Link to post
Share on other sites
Cheerio    2,677

Hi, I am creator of local-coop multiplayer mod for DS.(3 player-local-coop)

Have you seen "messager mod" by Cheereo(the developer)?

It work with internet, and I said to the Cheer: "Hi, lets build online muliplayer!" And he answered: "This would be to slow and multi will be bad." I asked him to explain how does internet work with DS to make on-line playing, but he deleted all his internet mods ("messager" and "death noticer"). KLEI diffenetly DO NOT want online-multiplayer to be made...

KLEIs' opinion is NOTHING for me.

I can help you with creating online-mod. - The code from Cheers internet "messager" I kept is very useful. I have tons of ideas about code of it. Give me your skype address if you need help.

Regards.

Sorry for bad English, I am from Russia.

I just wanted to let you know, the reason the messenger mod can't help you make a multiplayer game is because it uses a google's app engine database as it's backend and the latency from it would make multiplayer virtually unplayable.  The lag would just be too atrocious.  

 

If you're going to do a multiplayer mod, you'll want to use something more similar to sockets which i'm guessing might be what the OP is using.  I just didn't want you to waste your time on something that wouldn't really work.

Share this post


Link to post
Share on other sites
Elegios    0

I also think that this would be a very nice thing to have, but I thought it best to start at a slightly smaller scale. My idea was to make a craftable chest that would sync its contents across the network, which would avoid most of the difficult stuff mentioned above. Would it be possible to see the code you use for networking? I can find a socket library (luasocket) in the games files, but I'm having a hard time finding examples of its use. If that library is accessible to mods, and I could add for example a websocket library on top of it, then it would be rather a lot simpler to write all sorts of server/relay software that the game could talk to.

 

Essentially, I think it would be nice if we could make network-related stuff easier for mods, and then look at more advanced stuff when the network is readily availible to anyone who would like to use it.

Share this post


Link to post
Share on other sites
Cheerio    2,677

The lua socket library that's available is this one:  http://w3.impa.br/~diego/software/luasocket/introduction.html.  There's no in game examples of using it because it was integrated at the request of a modder who wanted to make a multiplayer mod :).  

 

If you're looking to do multiplayer aspects that can have quite a high latency(chests are a good example), you could use something similar to what I'm using for the 'Messenger' and 'Deatchwatch' mods.  For those, you can check out the lua side by downloading the mods at the links below and the backend you can check out the Google app engine tutorial also linked below.  You could also use any other web server platform or write your own if you preferred.  I just picked App Engine because it let me write a server backend in a couple of hours and their free account provides more than enough resources for what I need at the moment.

 

 

Messenger: http://steamcommunity.com/sharedfiles/filedetails/?id=227673831

Deathwatch: http://steamcommunity.com/sharedfiles/filedetails/?id=227375649

Google App Engine: https://developers.google.com/appengine/docs/python/gettingstartedpython27/introduction

Share this post


Link to post
Share on other sites
jadica    0

Can we have a repo (git or something) on this, or it's too early? I'm interested, albeit I don't know how to help (yet) - I just bought the game yesterday and I think I'm starting to like Lua (always been curious about it; now's my chance to actually write something in it).

Share this post


Link to post
Share on other sites
Elegios    0

So I tried to put a websocket library in a mod to see if I could get it to work, and while it does look somewhat promising it turns out that I apparently can't load the luasocket library on my mac. Not sure why that is, it should be cross-platform. Perhaps Klei only put in the windows parts of it? Anyway, that slowed things down for me, and I kind of feel like I'm hijacking this thread, so when/if I make progress I'll probably make a new one.

 

I would also have to second the post above me, it would be nice to see some code of what others are working on. :)

Share this post


Link to post
Share on other sites
Crynux    112

Hello All,

 

I've been busy lately with exams, but even so, we've made a bit of progress with the mod.

 

Currently, we have players connecting to a server, with synced player models (wilson, wx78, etc), synced inventory (hat/backpack/weapon) and synced movement.

 

With regards to how we are doing it at the moment, we're using http requests. I've looked into luasocket, but cannot get it to work on my linux distro, no matter how much I try.

 

Regarding a git or something... I had thought about it; but at this stage, it's too early.

 

If anyone wants to contact me about the mod, possbily getting in on some early testing; you can do so via skype; my skype name is crynux.

 

Thanks for the interest!

-Crynux

 

EDIT: We've switched to sockets. Using the provided windows luasockets, and a work-around for Linux. Mac, however, I cannot say anything for, and it's likely we won't be able to support it. (unless luasocket works on mac... but seems only windows in this implementation)

Share this post


Link to post
Share on other sites
Elegios    0

Luasocket as a library should be able to run on both Mac and Linux, not just Windows. Something's presumably gone wrong when including it in the game, or it just hasn't been built for all the platforms. It should be doable, but it's unfortunately something I think Klei will have to do.

 

Also, I'm a bit curious, roughly what is the work around you're using for Linux?

 

PS: I use Mac (amongst other platforms) and can't get the included luasocket to work, just as an FYI.

Share this post


Link to post
Share on other sites
XirmiX    754

Hmm, don't you need a server to get internet connection for a game for multiple (more than one) to play non-locally? If not then what DO you need?

 

Either way The game is not simple itself, I must tell you.

 

What you must be aware of for the game not to crash or not to work as it shouldn't be is:

 

Interactions between mobs - if two people have different helper mobs, say Webber has a spider and Wilson has a pigman, they might start to attack each other, so to stop this from happening you'd need to write code for interactions between two helper mobs from different players. Also note if someone activates a touchstone, it's best if someone who didn't activate the touchstone if they die the player would still respawn as long as there's meat effigies or touchstones activated.

 

The choice of a map - if someone makes a map then for someone else to join, they would need to enter the map somehow. I would suggest making a section, like mod section, where there are listed different maps made by other people and you can join them if available (I'd suggest that 4 people being maximum in one map because of lag and difficulty).

 

Different characters - when clicking "Enter" button a player would need to choose a character they have uncovered and that they can't choose a character that another player in the map already has.

 

Being able to create a map - in the "multiplayer" section you would need a button "create" for someone to create a new map. There the creator of the map can choose how the map will be like and what character they want for themselves.

 

Pausing game - it would be unlikely possible at this point. Or if someone pauses the game their character would turn invisible or something and as if they aren't in the game. The game will continue to go and may be the paused player would see what's happening in the game while they have paused (I'd recommend time limit on pausing, because if someone just pauses to get out of trouble that would be quite unfair, so may be 8 minutes max, which would be one whole day and then the player would need to wait a bit to pause again. If the player doesn't unpause within this time he or she would be kicked out of the map and all the stuff that that the player had in their stacks would be dropped). If all players pause the game, then the game stops until someone continues playing.

 

Private maps - maps that can only be accessed with the map's code or something like that and would not be listed publicly.

 

Saving maps - if all players have left, you can still save your map if you want to continue playing it. I think the private maps would work better with this, because every player who played before could continue playing where they finished instead of someone leaving and not coming back to the map, yet taking some stuff with them.

 

Leaving a map - if someone leaves a map, may be you could make the Maxwell's door entering animation happen and all the stuff, that the player had in the stacks would be dropped.

 

Multiple eyebones - it's best if there are more eyebones, or rather an eyebone would appear if another person would enter a map. Each eyebone would be controlling one chester. You couldn't stack the eyebones, but you could carry more than one in another stack in case you want to have two chesters with or something.

 

Kicking a player out of a map - if someone is playing just to troll or something then you would need all the other players to kick them out of the game, like left clicking on the player or something.

 

Chat - well, who wouldn't like to talk to other people in the map?

 

Different world connection - if one of the players decides to go to adventure mode or caves, then if someone else enters there, they would have the same map instead of appearing in completely different place, well you know what I'm talking about. all tho I'm not sure how the end of Adventure mode would work out with multiple people.

 

Maxwell appearing only for player one - if someone finds another player lying with Maxwell talking to them well, that might crash the game, or logically the player 1 would like to attack Maxwell behind their back, lol.

 

Different spawn points and map revealing for all players connected - it's better if different players have spawn points in different places of the map so then the players would need to meet up. All players that reveal some part of the map would be revealed to other players and time would be going while looking at the map instead of game being paused and you could see other players moving if they are while looking at the map.

 

 

This is how far I think is needed for playing non-local multiplayer.

Share this post


Link to post
Share on other sites
Crynux    112

Luasocket as a library should be able to run on both Mac and Linux, not just Windows. Something's presumably gone wrong when including it in the game, or it just hasn't been built for all the platforms. It should be doable, but it's unfortunately something I think Klei will have to do.

 

Also, I'm a bit curious, roughly what is the work around you're using for Linux?

 

PS: I use Mac (amongst other platforms) and can't get the included luasocket to work, just as an FYI.

 

I agree, it's pretty much up to Klei to make it work. As for the workaround in Linux, I added some functionality to functions using LD_PRELOAD(Google it), and can do networking though them. If sockets did work on all platforms, I would gladly adapt to all Mac. But unfortunatley, I don't know a work around for mac...and am unsire if LD_PRELOAD or something similar exists.

 

 

Hmm, don't you need a server to get internet connection for a game for multiple (more than one) to play non-locally? If not then what DO you need?

 

Either way The game is not simple itself, I must tell you.

 

What you must be aware of for the game not to crash or not to work as it shouldn't be is:

...

 

This is how far I think is needed for playing non-local multiplayer.

 

Multiplayer doesn't HAVE to be complicated. Yes, the implementation will take time, and there are multiple things to consider, as you suggest. But ultimately, my first goal for multiplayer is to have something where people can play together on the same map.

 

We already have a number of things taken into consideration... for example, what happens if someone crashes for some reason, or their connection is interrupted. Or how health synchronization is handled, and things alike.

 

Just yesterday I finished rewriting our server code in C (conversion from http to sockets), using threads and a custom synchronization handler. That alone took some time, but as it stands, everything is stable once you connect. There was an issue today regarding connection, but I was playing with my firewall.

 

Our setup with regards to network at the moment is simple; there is a server, and it accepts incoming connections to clients. Anything sent to the server is processed, and sent to the players who need to be notified. If there's a problem sending, then that player is considered to be disconnected, as the socket is broken, and they are removed from the server.

 

At the moment, we have 1 'instance' of a multiplayer session on the server, with a max of 5 players. This is for testing purposes, and will stay that way for some time. I plan to increase the limit, to test network load in the future, as you can imagine there would be quite a bit of data transferred for mobs and the like(although, I know already how to minimalize that data).

 

I more or less know what is required for a multiplayer 'game/mod' to function correctly, but at this point focusing on that is useless. We need a base multiplayer 'system' for the multiplayer 'game/mod' to run on first, before we can consider features such as kicking/banning and the like.

 

With that said, however, you do raise some very valuable points, and it just goes to show that everyone could possibly have something to contribute. I value your ideas and concerns, and thank you for them.

 

At the moment, though, there is only two of us; myself and Desblat. I do all of the server code, Desblat points out and begins the client code changes needed, and I fill in the networking. I'm not much of a lua person, but I know what I'm doing if I know where to do it(I never was a fan of having a ton of source files... but it's what makes the game so flexible, so I'm fine with it).

 

Our greatest limiting factor at the moment would be time difference, we literally live on opposite sides of the planet, so getting together to chat is difficult... it slows development.

 

Anyways, to date, here's what we have done... and are currently focused on:

  • Player Synchornization
    • Connect/Disconnect - should work fine... even if players crash
    • Movement - Done... should be tested more though
    • Items (head/body/weapon) - Also Done, should be tested
    • Health - Finished yesterday... definately needs testing
    • Item Drops - Started yesterday... hopefully will have the network code done today

With that said, we are still keeping testing and such in a 'closed' group. If you're interested in testing/coding/helping, pm me or just let me know however you can. There is a ton of work to be done (as you can imagine), and any help would be more than appreciated.

 

Thanks for the interest

-Crynux

Share this post


Link to post
Share on other sites

im willing to help any way I can, I only have beginners experience in moding Don't Starve but I have a history with programming and some PS experience but little networking experience. I could help with recreating the prefabs accordingly but im sure we all want to know. Is how do you want to make first step?

Share this post


Link to post
Share on other sites
Crynux    112

im willing to help any way I can, I only have beginners experience in moding Don't Starve but I have a history with programming and some PS experience but little networking experience. I could help with recreating the prefabs accordingly but im sure we all want to know. Is how do you want to make first step?

 

Hello,

 

Prefab recreation will be a huge part of the mod. There will have to be at least some modification to all mob prefabs to get them to sync correctly. Help with this would be great.

 

As for 'how we want to make the first step'. What do you mean? With regards to the mod, or joining us in working on the mod?

 

If you mean first steps in getting the mod running... then that's reasonably simple. At the moment, player synchroniziation has a pretty solid base. The next steps are to sync item drops and mobs. I already have a theory for synchronizing mobs, trees/bushes and the such for all players, but it needs a proof of concept before implementation with all mobs (ie. do it for one mob, and if it works, for all).

 

My personal goal is to have one map, with everything synced. One map will be easier at first, it can be extended to others. I actually have a living document with some details, which I plan to add to soon.

 

If you mean how to join us... send me a pm with your skype (or some sort of chat thing), and I can give you all the details you need.

 

Thanks

-Crynux

Share this post


Link to post
Share on other sites
Crynux    112

i WOULD really like to test it and maybe posting some bugs and crash report

 

Hello,

 

At the moment we have enough testers. Currently, we're working on synchronization, which requires constant updates for minor changes. (And multiple server restarts among other things)

 

When we get to a stable beta version of the mod, I will definately contact you in the case we need additional testers.

 

Thank you for the support

-Crynux

Share this post


Link to post
Share on other sites
wiidad    2

Please make this work. Each person who helps this to become a reality would be a super hero ^^.

Share this post


Link to post
Share on other sites
Crynux    112

Please make this work. Each person who helps this to become a reality would be a super hero ^^.

 

Hello, and thank you for the support.

 

Currently we're getting somewhat close to a decent working version of the mod. Players are more or less synced, their items are synced, and (mostly)everything on the map is server spawned.

 

At the moment, we're focusing on synchronizing mob movement across peoples' games. Additionally, we're looking into item drops/pickups, and general animation synchronization.

 

Additionally, we're working on creating the mod in a way so it won't mess up or corrupt your single player games... as a teaser, see below:

 

post-339582-0-58291900-1394609469_thumb.

 

It's only a matter of time...

 

-Crynux

Share this post


Link to post
Share on other sites

Crynux and Team, thanks for doing this. Really exciting. Been keeping an eye on this topic, and I'm glad to see you're putting so much work to make this a reality. I can't help, but you definitely have my support. Keep at it.

Share this post


Link to post
Share on other sites
Zeklo    17,668

I have been keeping an eye on this and I really do hope this works out. Just one quick question, will you guys make it for Reign of Giants too? (once its 100% complete that is) Because I'm gonna get it once its done and well if this mod is successful then I would love to see it for the DLC as well.

Share this post


Link to post
Share on other sites
Crynux    112

Crynux and Team, thanks for doing this. Really exciting. Been keeping an eye on this topic, and I'm glad to see you're putting so much work to make this a reality. I can't help, but you definitely have my support. Keep at it.

 

Thank you for the support. It'll take time and some hard work, but we hope to get it done.

 

 

I have been keeping an eye on this and I really do hope this works out. Just one quick question, will you guys make it for Reign of Giants too? (once its 100% complete that is) Because I'm gonna get it once its done and well if this mod is successful then I would love to see it for the DLC as well.

 

Our current goal is for the mod to work with the base version of the game. Regarding Reign of Giants, we will have to see how many changes would have to be made. From what I hear, the DLC is supposed to add quite a few new features; these features may or may not make it more difficult to make the mod compatible. We may end up with a regular DLC-free version, and a Reign of Giants version.

 

For now though... I would say that eventually, yes, we would like it to work with the DLC.

 

Thanks again to all.

-Crynux

Share this post


Link to post
Share on other sites
Teslaspule    11

To the whole modding team:

 

This is so exciting. A couple of friends and me are waiting for this mod to get done. Its really nice to see that you are making so much progress in a very short period of time.

 

Keep up the great work and much thanks for doing this.

Share this post


Link to post
Share on other sites
Zeklo    17,668

May I ask, when a proper video can be done? I mean I am a very cautious guy and well words are only words to me.

Share this post


Link to post
Share on other sites