Jump to content

Simple form of multiplayer, some development questions


Forced1988

Recommended Posts

Hey guys,

I want to create a simple multiplayer plugin for KSP (No timewarp, sync Vessels/Parts)

Some questions in order to do that,

Is it possible to create a standalone plugin (not requiring a part).

Is it possible to dynamically add Vessels/Parts via code ?

Link to comment
Share on other sites

No intention to downplay this or anything, but to start with (and avoid the significant downside of no timewarp), I've been thinking that it'd be interesting to see the "Commie" Kerbals (or "American" if you're playing the other side) doing their own exploration and stuff from the other side of Kerbal. As long as the CPU can handle all the additional "stuff", that is. And if you're really crazy/ambitious - KWIII in space with space weapon mods.

Link to comment
Share on other sites

My intention of this form of multiplayer is to create a space station with multiple people, or set up a base on the mun, more things would require timewarp.

Timewarp fcks everything up for multiplayer.

Link to comment
Share on other sites

You could make it so that time warp slows down to the lowest selected time warp of all players. This way, if one player needs regular game speed for, say, docking or something, they can do so, but if everyone agrees to do so, they can all set their time warps higher for interplanetary missions

Link to comment
Share on other sites

There are few ways you could do a timewarp:

  • A public vote
  • Admin command (forced)
  • Setting timewarp for current player, and disallowing any further actions until everyone else have used the same amount of timewarp

Well, the admin command should be available always.

Link to comment
Share on other sites

Those are some good ideas to get around the timewarp issues... including just avoiding it (almost) entirely by staying local to one planetary system. Could be made more interesting by adding nearby asteroids or moons near Kerbin.

With a public vote it'd have to be unanimous (and of course default to 1x speed), otherwise you'd have the "minority" player missing key timings needed for important actions. Still not really sure how feasible it all is though - I can imagine lots of issues with people being in the middle of important stuff while others are ready for a timewarp. The idle time in 1x could be spent elsewhere such as launching stuff or surface operations, but at some point you have to launch something, at which point timewarp is impossible. Coordination could get hard as you add new players. Still a cool idea worth pursing.

A can think of a few mods/features that would be useful, since people would be doing a LOT more multitasking:

-Powerful timer/alarm system to alert when attention is needed for something or an event occurs

-Save/load partially built vehicle components, rather than just one vehicle at a time (I imagine this is on the dev's TODO list)

-Ability to change which command module is the "main" module without having to click the New vehicle button

-Probably already possible, but a way to clean up garbage easily is going to be pretty important

Link to comment
Share on other sites

I'm actually looking into this at the moment, I might be able to post some PoC videos/pictures soon. There is a problem thought, when someone else is using a mod you don't have, I must either disable every other plugin, or allow only plugins the server is allowing, which are needed for all players, if not found the player will be disconnected and a warning will be shown. Also I have some ideas to prevent hacking, as most of this is done on client side, there must be checks on the server side too.

Link to comment
Share on other sites

What would need doing is set up a master server, wich people would connect to, this server will keep time and sync everyone, some issues concerning this setup is disabling timewarp.

Is this even possible ?

How to handle people pausing, as of now the whole simulation is put to a hold.

Does time still continue when in 1 of the assembly buildings ?

What happens when 2 people simultaniously launch something on the launch platform.

Loads of unknowns and ways to deal with em.

Do we only sync vessels in orbit etc etc etc.

At the moment im kinda busy with work, i plan on making a prototype this weekend.

There are some things i will need to look into tho as i dont have much experience with them (Async sockets, Serializing objects over sockets, Eliminating portforwarding requirements for online play (Upnp ?).

I program websites in ASP.net for a living, so coding skills wont fall short.

It will just take some time.

If and when i do have a prototype it will be up on github for people to either download or work with me to develop it.

Link to comment
Share on other sites

I would demonstrate basic synchronisation first, that's a big challenge in itself. Stuff like pause and warp are only design issues - They've already been solved by many other games and it'll just be a matter of picking the most appropriate solution rather having to work out how to do it.

Link to comment
Share on other sites

You could just not put in time warp, and just get it to work, but design the code so that it would be easier to put in timewarp. Then do timewarp. Getting timewarp and the other basics of multiplayer to work at once would be a nightmare.

Link to comment
Share on other sites

You could work without timewarp... I imagine using craft from the get-to-the-mun-fastest challenge could be used. you could get to the mun in just 30 minutes! Heck, send a whole convoy!

Link to comment
Share on other sites

I program websites in ASP.net for a living, so coding skills wont fall short.

I don't mean to be rude or anything, but coding websites with ASP.NET won't be useful, true, it will give you basic understanding of most stuff. But you must have done a lot of other projects in various languages to be able to tackle all the problems.

Link to comment
Share on other sites

As i said, i do asp.net and some windows applications for a living, all i was trying to point out is that i have skills in programming.

I in no way pointed out that ASP.net / websites have anything to do with NET programming (Sockets etc).

Link to comment
Share on other sites

I had an idea earlier that I haven't mentioned anywhere yet, where you have many bases dotted over Kerbin, and they have different colors, traditional red at the 0,-75 base, yellow in the deserts of the continent to the west, green to the north of the standard continent, and when you set up a server you can select which players get which faction. In .20 we'll get flags, so you could start with factions, and their flags. In further updates you can make it so that you can make alliances and have wars with other programs, which changes which craft you see. You can add detection units to see enemies, and perhaps add some parts and features to make war more 'interesting'. This is all after heavily developing the mod to make 'workable' multiplayer. Also, if we can a) assume you have loads of money or B) start a fund here, you can get an epic computer to have all the servers run on, so that epic multiplayer is epic

Edited by PLB
Link to comment
Share on other sites

Unfortunately, I have heard that network sockets necessary for multiplayer in KSP is not supported. :(

You can try to prove me wrong!

Here are some links to get you started: http://wiki.unity3d.com/index.php/Simple_TCP/IP_Unity_Code

http://docs.unity3d.com/Documentation/ScriptReference/Network.TestConnection.html

I already have code that can load and spawn a ship from one KSP instance to another through a server.

Link to comment
Share on other sites

What would need doing is set up a master server, wich people would connect to, this server will keep time and sync everyone, some issues concerning this setup is disabling timewarp.

Is this even possible ?

I'd go for an admin or vote controlled time warp.

How to handle people pausing, as of now the whole simulation is put to a hold.

Simply there is no pause, just like in all other multiplayer games. When you press escape, you get the menu, but the game runs in background.

Does time still continue when in 1 of the assembly buildings ?

I think the time doesn't pause in SP as well, wherever you are.. VAB, tracking station or space center. It only pauses in in-game menu.

What happens when 2 people simultaniously launch something on the launch platform.

Easy! Get a launch scheduled xD Just like in real life.. "Player 1 has a launch window starting at 12:25 and lasting 2 minutes until clearing from the pad. Player 2 has a launch window starting at 12:27.." If you want more time on the launch pad, buy the time with money! xD

Loads of unknowns and ways to deal with em.

Do we only sync vessels in orbit etc etc etc.

That passive multiplayer mod syncs up distant ships pretty well, I guess there won't be problems to sync up orbiting ships. The bigger problem is syncing up objects when in range (2.5km), but still it's not undoable.

Now, how would you handle mods? In modding friendly games (rfactor, for example) the game checks mod files and reports a "mismatch" if you don't have a mod that the server has (or is other version). While joining server, the server should send a list of cfg-s installed and then compare with those of the joining player. Another way to handle mods, is that YOU don't need to have the mods, but if another player has a mod you don't have, the game displays a "generic models" like a box (eg.) that shows up instead of a mod model. When you install the mod, it would shape correctly. This of course could lead to collider problems.

Link to comment
Share on other sites

I already have code that can load and spawn a ship from one KSP instance to another through a server.

Well stick a fork in me, I'm done!

If this really works, it definitely should have its own page with a banner, company logo, videos, screenshots, etc! This Development forum is the right place for it, and then you have to make a new thread under Releases once you have the mod up. :shrug:

If and when i do have a prototype it will be up on github for people to either download or work with me to develop it.

I think that should work fine. All releases should go onto www.kerbalspaceprogram.com, that is the official location for mods. I would recommend putting something up now, for some reason the first upload of a new mod to KSPort takes more than a day but all updates after that are instant.

Just for some more ideas, I think one of the greatest issues will be how KSP puts on rails anything out of atmosphere that is more than 2.5km away, and auto-destroys anything in atmosphere! I just heard that it is possible to extend this range, however, through a Scott Manley video: http://youtu.be/8ovbMe6Sboo?t=17m0s

It appears that Romfarer's plugin is the same with both the manipulator arms and the Lazor system, but only the Lazor mod comes with the source code. It's too deep for me to go through right now, but that could help a lot.

The modders and devs often are on the IRC channel #kspmodders at irc.esper.net, port 6667. I've learned a lot in a short time when talking to them.

I am not very socket-savvy yet, but I do have about a year's experience with a bunch of KSP mods. I would be happy to contribute to this project.

Link to comment
Share on other sites

How to handle Timewarp: It's client side. So when you timewarp you disconnect from multiplayer and warp. Then when you unwarp, the servers catches up with you and to the other players your appear there. This would only work in space and not anywhere in a SOI though.

KSP is cool in that it moves the whole solar system all the time. The system would have to be forced static, unmoving, in order for people to time warp separately.

Link to comment
Share on other sites

How to handle Timewarp: If you press timewarp a screen would appear in the game asking other players to timewarp and what speed, sorta voting screen, if every one is ready then go it timewarps, and anyone can stop it anytime.

I'm sure It will work because I'm sure it would get to a point where all the players will be done doing their thing and will need timewarp, you may wait 5 minutes for some one to do something, but regardless it will still lead to a simultaneous timewarp for all players. thus cutting a significant amount of boring time

The game would feel like a turn based game then. Waiting for other players before a warp session, then play again, then all warp, then play, then all warp. but then it's the only way and it still would be awesome

Link to comment
Share on other sites

ok listen guys, don't know if this have been suggested, but! a way to make multiplayer work with moving planets and separate warp could be: Player position relative to orbiting planet. let me explain. the server have a ongoing watch on where the planets are(NO WARP HERE) together with where the spaceships are, and the clients output their position according to nearest planet. say you want to warp to the mun, from kerbal, then on the client side, things speed up, but you have a position according to the planets, and when you stop warp, you simply output the position to the server. the server now knows where you are according to the mun, and simply put your model there. serverside this would recuire a whole lot of stuff i don't even want to think about, and for other players a warp then would look like someone was going the speed of light. BUT on warp, disable physics, and collision, the player that warps becomes a ghost on the server, and when he finishes warping he materialize again. so on paper:

Server tasks:

Gather player positions and output according to where they are relative to planets.

keep a "unwarped" universe

decide if a player is a "ghost"(warping) or alive(non warping)

Client:

Send player position relative to planets and warp state(non warp/warp level)

Catch information from server.

I may have a wrong idea on how we can get player position, but if we remove the fact that planets move, and only concentrate on the orbital information from the craft, this might work. Im only a 3D artist, with some programming knowledge, so have an open mind to my idea :P

Link to comment
Share on other sites

You could make it so that time warp slows down to the lowest selected time warp of all players. This way, if one player needs regular game speed for, say, docking or something, they can do so, but if everyone agrees to do so, they can all set their time warps higher for interplanetary missions

There we are, timewarp solved. And no need for any weird asynchronous multiplayer and stuff! Plus, it's much easier to understand because everyone sees each other exactly where they are - no crazy "time bubbles" or anything.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...