Jump to content

Recommended Posts

I would also like to join in, as long as it is a serious proposal and not a dream someone has.

To me the biggest question is how to manage the simulator at the server and client levels and coordinating the entities and events across them. Seems as though you would need a 'server" version of the simulator so you can run it alongside a "client" version on the same machine. The "client" version of the simulator would run in "passive mode" and just receive the changes provided by the "server" version via the lan/net.

@WrathOf Regarding the simulation part, I think you are complicating things at least that is how I see it now, you don't really need a separate server to run the simulation, as long as the map loaded is the same (meaning the same gametime, the same everything) I do not see a problem running the simulation client side.

True the next big question would be how to synchronize the events, what happens if two people cut a tree at the same time, you would need to send between clients the "cut" action (with the ent id) so it would take "7.5" swings for a big tree, obviously it goes down, and events are sent between clients that an entity has been removed (based id). As long as time passes the same for both clients the simulations can run locally.

Running locally means that you do not have to store additional data in the map, you just have one playerinfo (yours). When a client connects, you just spawn another "wilson" prefab and stream events to that prefab based on what you receive from the client. You could also mark this entity with some tag so chester will not follow him, it will follow only you, and so on regarding other "specific player" things.

Also I agree the biggest challenge would be the networking code, and synchronizing events.

PS.

If it really needs to be client / server, than you could make one client the server (all others will connect to it) after that you (server) will be responsible for sending game time synchronization, the clients will ask you for ids and so on.

In both cases you don't need a stand alone server.

I do not know if you can change the simulation time from lua, I am 99% sure you can because you have a gametime in the save file. Hmmmmmm.

Edited by RazvanM

I'm for it. It would extend DS's game life almost indefinitely.

But, do you think this is even possible without the Devs offering up a copy of the game code?

Well I really did not investigate to see what the simulation engine is exposing, even if it does not expose everything we need, we still would not need the source code, the devs should add more hooks for us to use (again IF we don't have everything we need already to control the simulation). One thing they should add is socket support, I saw a thread somewhere that this is not included.

The thing that must be decided first is the number of people.

- 2 persons -> a simple one - one connection should suffice, and spam events between clients

- 2-4 persons -> a connection

- one - one (peer 2 peer)

Advantages

- Still the easiest way to do it, just spam commands between clients

- No server to go down (the rest of the players can continue if someone is dropped)

Disadvantages

- More network traffic

- Who has the map to be played ?

- Who has the best data in case of problems with synchronizations ?

- Problems with placing entities ? - unique ID's, this probably can be solved by telling each client from where to start the id count

- normal server - client

Advantages

- Synchronization issues would be solved easily

- No problems with the generation of id's

- Smaller traffic for clients

Disadvantages

- In case it goes down (or exits), everyone is out.

- More people -> Server - client is the best way

In both cases, I do not think the synchronization issue is that bad (both run at the same speed). It's really not FPS where a fraction of a second matters, it is also not so action packed, if a delay of 1ms - 10ms - 50ms....???ms happens between the action of player 1 and being viewed in the screen of player 2, I don't think it would be a problem. Regarding game time synchronization well I do not know if you can go back in time, so the player with the greatest game time has priority, the rest would just have to accelerate to that time.

These are just first impressions, I did not investigate to much, so if I am wrong please correct me.

Edited by RazvanM

Well I really did not investigate to see what the simulation engine is exposing, even if it does not expose everything we need, we still would not need the source code, the devs should add more hooks for us to use (again IF we don't have everything we need already to control the simulation). One thing they should add is socket support, I saw a thread somewhere that this is not included.The thing that must be decided first is the number of people.- 2 persons -> a simple one - one connection should suffice, and spam events between clients- 2-4 persons -> a connection

- one - one (peer 2 peer)

Advantages- Still the easiest way to do it, just spam commands between clients- No server to go down (the rest of the players can continue if someone is dropped)Disadvantages- More network traffic- Who has the map to be played ?- Who has the best data in case of problems with synchronizations ?- Problems with placing entities ? - unique ID's, this probably can be solved by telling each client from where to start the id count

- normal server - client

Advantages

- Synchronization issues would be solved easily

- No problems with the generation of id's

- Smaller traffic for clients

Disadvantages

- In case it goes down (or exits), everyone is out.

- More people -> Server - client is the best wayIn both cases, I do not think the synchronization issue is that bad (both run at the same speed). It's really not FPS where a fraction of a second matters, it is also not so action packed, if a delay of 1ms - 10ms - 50ms....???ms happens between the action of player 1 and being viewed in the screen of player 2, I don't think it would be a problem. Regarding game time synchronization well I do not know if you can go back in time, so the player with the greatest game time has priority, the rest would just have to accelerate to that time.These are just first impressions, I did not investigate to much, so if I am wrong please correct me.
Interesting ... Are you proposing a connection without external server? I mean ... something like a LAN?

@Zuljin Well I'm just saying that you don't really need a headless server, each client has the simulation engine running, you just need to synchronize between them. So it depends on what you mean by "external" server :).

If you mean what I think you mean, than yes, I am proposing a "LAN" type connection, you just need to know the IP of the server.

Edited by RazvanM

@Zuljin Well I'm just saying that you don't really need a headless server, each client has the simulation engine running, you just need to synchronize between them. So it depends on what you mean by "external" server :).

If you mean what I think you mean, than yes, I am proposing a "LAN" type connection, you just need to know the IP of the server.

The main problem is how are you going to connect to the internet

you can't use socket.lua and you can't load a dll to connect to the internet.

If they add socket.core.dll back to the game you could.

Bigfoot sad he might add it if people want it http://forums.kleientertainment.com/showthread.php?19006-Moding-help

[MENTION=26201]no_signal[/MENTION] Thank you for finding the thread :), that is probably the most important thing we need from the devs, as I said in a previous post "One thing they should add is socket support, I saw a thread somewhere that this is not included.". Thanks for adding it :). Perhaps they will add it back.

Regarding loading dll's :-? hmmmm, and I had an ideea to use .NET to create a map browser to be used in game, well that is out the window :(.

[MENTION=26201]no_signal[/MENTION] Thank you for finding the thread :), that is probably the most important thing we need from the devs, as I said in a previous post "One thing they should add is socket support, I saw a thread somewhere that this is not included.". Thanks for adding it :). Perhaps they will add it back.

Regarding loading dll's :-? hmmmm, and I had an ideea to use .NET to create a map browser to be used in game, well that is out the window :(.

so i figured out a way around the problem

I'll test it out.

Edited by no_signal

so i figured out a way around the problemI'll test it out.

Cool :), let us know the results, bad / good does not matter, you could also tell us how you wanted to do it if it does not work, perhaps we can come up with a solution eventually. [MENTION=2]Bigfoot[/MENTION] Please add the socket support, it is the most important thing to start going forward, no_signal is searching for another solution, I think the easiest way is for you guys to add that.

so i figured out a way around the problemI'll test it out.

Cool :), let us know the results, bad / good does not matter, you could also tell us how you wanted to do it if it does not work, perhaps we can come up with a solution eventually. [MENTION=2]Bigfoot[/MENTION] Please add the socket support, it is the most important thing to start going forward, no_signal is searching for another solution, I think the easiest way is for you guys to add that.

[MENTION=26201]no_signal[/MENTION], I did some tests, and I managed to load the luanet.dll (it loads and I can create .NET objects, the app crashes when I try to show something, however that is not the point currently), some things that must be done- New dll's must be in a new folder "lualib" under "bin"- You need lua51.dll and lua5.1.dll placed in the bin folderAlso sockets work.

The code bellow was placed in main.lua

data/scripts/main.lua(140,1) loaded lua net, created form Wilson P. Higgsburydata/scripts/main.lua(141,1) 0.033333335071802data/scripts/main.lua(148,1) Using host '127.0.0.1' and port 13...data/scripts/main.lua(154,1) closedThe folder structure-bin

-lualib

-socket

core.dll

luanet.dll

lua51.dlllua5.1.dll

require "luanet"luanet.load_assembly "System.Windows.Forms"Form = luanet.import_type "System.Windows.Forms.Form"form = Form()form.Text = STRINGS.CHARACTER_NAMES.wilsonprint("loaded lua net, created form "..form.Text)print(TheSim:GetTickTime())local socket = require"socket"local host = "127.0.0.1"local port = 13host = socket.dns.toip(host)local udp = socket.udp()print("Using host '" ..host.. "' and port " ..port.. "...")udp:setpeername(host, port)udp:settimeout(3)local sent, err = udp:send("anything")if err then print(err) os.exit() endlocal dgram, err = udp:receive()if not dgram then print(err) os.exit() endprint(dgram)

[MENTION=26201]no_signal[/MENTION], I did some tests, and I managed to load the luanet.dll (it loads and I can create .NET objects, the app crashes when I try to show something, however that is not the point currently), some things that must be done- New dll's must be in a new folder "lualib" under "bin"- You need lua51.dll and lua5.1.dll placed in the bin folderAlso sockets work.

The code bellow was placed in main.lua

data/scripts/main.lua(140,1) loaded lua net, created form Wilson P. Higgsburydata/scripts/main.lua(141,1) 0.033333335071802data/scripts/main.lua(148,1) Using host '127.0.0.1' and port 13...data/scripts/main.lua(154,1) closedThe folder structure-bin

-lualib

-socket

core.dll

luanet.dll

lua51.dlllua5.1.dll

require "luanet"luanet.load_assembly "System.Windows.Forms"Form = luanet.import_type "System.Windows.Forms.Form"form = Form()form.Text = STRINGS.CHARACTER_NAMES.wilsonprint("loaded lua net, created form "..form.Text)print(TheSim:GetTickTime())local socket = require"socket"local host = "127.0.0.1"local port = 13host = socket.dns.toip(host)local udp = socket.udp()print("Using host '" ..host.. "' and port " ..port.. "...")udp:setpeername(host, port)udp:settimeout(3)local sent, err = udp:send("anything")if err then print(err) os.exit() endlocal dgram, err = udp:receive()if not dgram then print(err) os.exit() endprint(dgram)

[MENTION=3332]Handsome Matt[/MENTION] thank you, I do not know the consequence of running two lua engines in the same process? (Game , and external lua5.1), so this is just a find does not mean it is the solution, I still believe that the devs should add the socket support. Honestly I don't know anything about lua, I had trouble writing a simple for loop. [MENTION=42463]iceage32[/MENTION] Let's not derail this thread, post any questions on the thread you started, I will see it and answer there.

[MENTION=3332]Handsome Matt[/MENTION] thank you, I do not know the consequence of running two lua engines in the same process? (Game , and external lua5.1), so this is just a find does not mean it is the solution, I still believe that the devs should add the socket support. Honestly I don't know anything about lua, I had trouble writing a simple for loop. [MENTION=42463]iceage32[/MENTION] Let's not derail this thread, post any questions on the thread you started, I will see it and answer there.

[MENTION=26201]no_signal[/MENTION], I did some tests, and I managed to load the luanet.dll (it loads and I can create .NET objects, the app crashes when I try to show something, however that is not the point currently), some things that must be done- New dll's must be in a new folder "lualib" under "bin"- You need lua51.dll and lua5.1.dll placed in the bin folderAlso sockets work.

The code bellow was placed in main.lua

data/scripts/main.lua(140,1) loaded lua net, created form Wilson P. Higgsburydata/scripts/main.lua(141,1) 0.033333335071802data/scripts/main.lua(148,1) Using host '127.0.0.1' and port 13...data/scripts/main.lua(154,1) closedThe folder structure-bin

-lualib

-socket

core.dll

luanet.dll

lua51.dlllua5.1.dll

require "luanet"luanet.load_assembly "System.Windows.Forms"Form = luanet.import_type "System.Windows.Forms.Form"form = Form()form.Text = STRINGS.CHARACTER_NAMES.wilsonprint("loaded lua net, created form "..form.Text)print(TheSim:GetTickTime())local socket = require"socket"local host = "127.0.0.1"local port = 13host = socket.dns.toip(host)local udp = socket.udp()print("Using host '" ..host.. "' and port " ..port.. "...")udp:setpeername(host, port)udp:settimeout(3)local sent, err = udp:send("anything")if err then print(err) os.exit() endlocal dgram, err = udp:receive()if not dgram then print(err) os.exit() endprint(dgram)

cool you got it workingbut you're linking to a different instance of lua and that may cause a crash.

[MENTION=26201]no_signal[/MENTION], I did some tests, and I managed to load the luanet.dll (it loads and I can create .NET objects, the app crashes when I try to show something, however that is not the point currently), some things that must be done- New dll's must be in a new folder "lualib" under "bin"- You need lua51.dll and lua5.1.dll placed in the bin folderAlso sockets work.

The code bellow was placed in main.lua

data/scripts/main.lua(140,1) loaded lua net, created form Wilson P. Higgsburydata/scripts/main.lua(141,1) 0.033333335071802data/scripts/main.lua(148,1) Using host '127.0.0.1' and port 13...data/scripts/main.lua(154,1) closedThe folder structure-bin

-lualib

-socket

core.dll

luanet.dll

lua51.dlllua5.1.dll

require "luanet"luanet.load_assembly "System.Windows.Forms"Form = luanet.import_type "System.Windows.Forms.Form"form = Form()form.Text = STRINGS.CHARACTER_NAMES.wilsonprint("loaded lua net, created form "..form.Text)print(TheSim:GetTickTime())local socket = require"socket"local host = "127.0.0.1"local port = 13host = socket.dns.toip(host)local udp = socket.udp()print("Using host '" ..host.. "' and port " ..port.. "...")udp:setpeername(host, port)udp:settimeout(3)local sent, err = udp:send("anything")if err then print(err) os.exit() endlocal dgram, err = udp:receive()if not dgram then print(err) os.exit() endprint(dgram)

cool you got it workingbut you're linking to a different instance of lua and that may cause a crash.

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