Multicompany via Virtual Machines?

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
User avatar
AntoninKyrene
Engineer
Engineer
Posts: 69
Joined: 29 May 2011 17:32
Location: SW US

Multicompany via Virtual Machines?

Post by AntoninKyrene »

Hello!

Can two or more virtual machines on the same host be connected to act as separate companies in a multiplayer game? I have a continental map that is separated from some smaller "nations" by water, and I'd like to have control over how those nations evolve so they can feed goods into the continental empire as I see fit. I'm trying to avoid any AI use - the feeders will only have one or two services, so for most of the game, they can be built and left to run their course.

I have been doing some reading on the multiplayer capabilities, but all of what I'm reading seems to apply to multiple physical machines on the same network. If this option already exists as a self-contained "thing" in OpenTTD, then I'm just plain missing it. 99% of my OpenTTD games are single-player/no-competitor, so this is new ground for me.

-Marc
Kuolema Tekee Taiteilijan
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: Multicompany via Virtual Machines?

Post by Sylf »

A single copy of openttd can run simultaneously multiple times on a single PC, no need for any virtualization. One instance should act as a server, and use other instances as clients.

You should also check out this thread regarding to running multiple company by yourself.
User avatar
AntoninKyrene
Engineer
Engineer
Posts: 69
Joined: 29 May 2011 17:32
Location: SW US

Re: Multicompany via Virtual Machines?

Post by AntoninKyrene »

Multiple instances on a Mac means a script. Thinking...remembering...scripting. :)

Well, they are running, but they can't see each other. But I have a better grasp now of what I'm trying to do. A little more reading may be in order.

(Edit for Spelling)
Kuolema Tekee Taiteilijan
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Multicompany via Virtual Machines?

Post by Alberth »

AntoninKyrene wrote:Multiple instances on a Mac means a script. Thinking...remembering...scripting. :)
Can't just open 2 terminals and start openttd in each of them? :shock:
AntoninKyrene wrote:Well, they are running, but they can't see each other. But I have a better grasp now of what I'm trying to do. A little more reading may be in order.
Assuming you connect through localhost, there might be a firewall blocking the tcp/udp connection to access the server.
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
AntoninKyrene
Engineer
Engineer
Posts: 69
Joined: 29 May 2011 17:32
Location: SW US

Re: Multicompany via Virtual Machines?

Post by AntoninKyrene »

I could use multiple Terminals, but the AppleScript is a one-click solution, and it was super-easy to write. Write once, click many! :)

The fundamental problem here is Antonin (that's me) didn't do enough research before posting. Had he done a little more research on this fine forum, he'd have discovered he needs a refresher in networking, which was never his strong point to begin with, along with some reading on new features that have appeared over the last...oh I don't know, three years?...so as to better understand how he should get from Point A to Point B. Then, after doing some homework, he should be able to return with some intelligent questions, or at least some helpful information as to why it's not working, so others can help him.

Right now, the best I can tell you is "I have a server and two clients running and they won't talk to each other and I don't know why and I want my binky!"


Running multiple instances of OpenTTD? Not a problem.
Initiating a non-advertised server? Not a problem.

Next step: how to point one of the clients to the server.
Kuolema Tekee Taiteilijan
User avatar
AntoninKyrene
Engineer
Engineer
Posts: 69
Joined: 29 May 2011 17:32
Location: SW US

Re: Multicompany via Virtual Machines?

Post by AntoninKyrene »

OK, someone needs to send me to my room to think about my actions.

1) Nothing is going to happen when the firewall shows OpenTTD with a "block all connections" option enabled.
2) That "Find Server" button is a true miracle of network programming.

It's working exactly as I hoped.

I am so embarrassed. :oops:
Kuolema Tekee Taiteilijan
User avatar
Pilot
General Forums Moderator
General Forums Moderator
Posts: 7629
Joined: 04 Aug 2010 15:48

Re: Multicompany via Virtual Machines?

Post by Pilot »

Are you not basically wanting the same thing as in this thread?

Because if all you want is multiple companies working on the same map, then all you need is the Cheat Menu (accessed through Control + Alt + C) and multiple instances of the IdleMore AI. This is an AI that will not build anything on it's own, but you can build stuff for it. Whilst you stated in the first post that you don't wish to use AIs, I feel this particular option is much easier to implement than getting multiple instances of OTTD set up in a multiplayer game.
User avatar
AntoninKyrene
Engineer
Engineer
Posts: 69
Joined: 29 May 2011 17:32
Location: SW US

Re: Multicompany via Virtual Machines?

Post by AntoninKyrene »

That was the thread that got me thinking about this whole idea. Tonight, I'm going to fire up two separate machines and fiddle with multiple instances of OpenTTD versus a single instance with the companies cheat. Right off the bat I liked the multiple instances option last night because I could put each company on its own monitor, but I know that can be done in another form in a single instance.

I have discovered another possible issue for consideration: station sharing. If the nations are going to provide goods and services as separate entities, there has to be a place where those goods and services can be exchanged. If Moldova is going to send iron ore to Russia so Russia can make steel, and Russia wants to export that steel to Mongolia for final processing...

This game has evolved way beyond what I realized. I've always played my way, using my D&D Randomizing Rules to dictate what my limits were in a single-player game, and never got bored or looked for something different. I'm not even sure exactly what version I'm using - probably an RC, knowing me and how I do things. But now that I dig deep...wow.
Kuolema Tekee Taiteilijan
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Multicompany via Virtual Machines?

Post by Alberth »

Oil rigs can be used to exchange cargoes between companies.
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
AntoninKyrene
Engineer
Engineer
Posts: 69
Joined: 29 May 2011 17:32
Location: SW US

Re: Multicompany via Virtual Machines?

Post by AntoninKyrene »

That might work, depending on where they can be placed.

Pilot wrote:Are you not basically wanting the same thing as in this thread?
Looks like it, except the cargo handoff becomes the problem. Oil Rigs would work. Something more realistic might be IS. Going to look at both and see if my compiling skills are still up to snuff. I really like running separate companies as separate instances. That is working nicely so far. I'm going to re-read that thread and see if I missed anything that might facilitate.
Kuolema Tekee Taiteilijan
User avatar
AntoninKyrene
Engineer
Engineer
Posts: 69
Joined: 29 May 2011 17:32
Location: SW US

Re: Multicompany via Virtual Machines?

Post by AntoninKyrene »

Well, after much studying and experimenting, I believe I found my solution: JGR's Patch Pack.

It took several tries to compile, and after finally realizing I needed to update the compiler, I produced a working nightly with the patch pack. Red is now sharing stations with Blue. Mission accomplished. Now...we start the process of finding a good configuration, cloning the VM for historical purposes (in case JGR stops updating the .diff) and beginning our story.

Way cool. :bow:
Kuolema Tekee Taiteilijan
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 17 guests