Not being a game itself, but a tech demo... AGS networking!

Started by void, Tue 10/04/2012 01:07:34

Previous topic - Next topic

void

Hi there,

as some of your might have already noticed from the AGS Multiplayer topic ( http://www.adventuregamestudio.co.uk/yabb/index.php?topic=45536.0 ), i'm currently in the process of developing a plugin that enables you to incorporate coop multiplayer in your AGS games. I know that might sound a bit strange, and I can tell you it is :-D

During the last few days I've done lots of work in getting this to run and I managed to find a concept that will be (relatively) easy to implement and, unlike the slightly out-dated TCP-Plugin (don't get me wrong here, i don't want to be offensive. It's surely a great piece of work, but I haven't been able to use it because of the recent changes in the String handling.), already provides mechanisms for game state mangement such as character movement, inventory item propagation and object handling.

I've set up a small test game that uses some FoA sprites and allows you to play with Indy and Sophia in a cooperative way. Even though we only had two rooms and just some basic objects, items and a chat function, the experience we had while testing this out has actually been surprisingly entertaining. Currently I'm in the process of testing things out, tracking bugs and making sure everything's working as excepted. There're still some issues, mainly regarding animation synching and savegame handling, but once I get a feeling that everything works like it should, I'm planning to release it here, but I haven't been able to post threads in the Plugins section of this board.

Just wanted to let you know, so be prepared for some old school multiplayer experience ;-)

UPDATE: You can download a modified version of the AGS demo game here

Also, the modified demo game sources are available here


Armageddon

It would be awesome to play games like Monkey Island with a friend. Looking good mate. :)

Kweepa

Yes, I've always thought this would make for a fun experience.
I played the Monkey Islands, Fate of Atlantis and Day of the Tentacle together with friends that are currently in another country and it would be awesome to play a new adventure co-op.
Still waiting for Purity of the Surf II

Shane 'ProgZmax' Stevens

Very nice.  Efforts like this remind me of the not-so-well-known Club Caribe, one of the very very first attempts at a multiplayer gaming experience (by Lucasfilm Games, no less!).  You could solve puzzles as a team (albeit rather limited ones, think Maniac Mansion) you could, for some odd reason, remove your head and trade it to people or buy a new one....or, in my friend's case, lose it.  It was a weird game, and it would be neat to see a low-fi interactive online game like that make a comeback.

budgerigar

Quote from: ProgZmax on Tue 10/04/2012 08:38:22
you could, for some odd reason, remove your head and trade it to people or buy a new one....or, in my friend's case, lose it.

Looks like Sophia's playing that game, too  ;D

void

Some news on this. I implemented multiplayer features in the AGS demo game (which took me roughly around 15 minutes ;-). You can't really do anything there and I haven't tested it completely, but it should be playable. I'm sorry for the debug text, I forgot to recompile the plugin, but you could always switch to D3D9 Mode, where the text shouldn't be displayed at all.

The multiplayer demo can be found here:

http://www.file-upload.net/download-4261998/DemoGameNet.zip.html

Sources will follow.

EDIT: Most recent version is in the first post.

Tentacles


The site wont let me download it, because Avast keeps having it come up as a trojan horse.

void

It is not. The zip file just contains the normal Demo game (compiled) along with the plugin dll. I'm afraid most antivirus applications are somewhat paranoid when dealing with dynamic linked libs or executables obtained from the net.

By the way: If there're any errors regarding missing dlls (libstd-c++ or somewhat), let me know. This happens to be an issue with my current c++ compiler.


void

I just updated the link above. The new zip file contains both libgcc_s_dw2-1.dll and libstdc++-6.dll, which are needed to run the dll. Sorry for the inconvenience.

.M.M.

Could you please upload the multiplayer AGS demo with the Game.agf file, or with the script files? I'd really like to see how it should be done.

void

Have a look at the first post of this thread. I've just inserted the link for the demo game sources there.

Construed

Just stopping by to give you some words of encouragment,
GREAT JOB!

Let me know if you need any help beta testing or debugging :D
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

void

Thank you very much! :-)

And yes, I do need help in testing. Getting the synchronization between both clients requires a lot of replication outside AGS that sometimes yields to rather complex results. This was why I opened this thread, I was hoping to get some report on the functionality of the plugin, but the attention it got so far was somewhat less than I expected. Nevertheless, I appreciate and I'd like to take your offer.

Right now I'm in the process of refactoring the plugin. What was done by now can be seen as a quick attempt that made its way into something quite promising. The next step is to rethink some attempts and implement them in a more robust and clean way. When this step has been done, there'd be another release. But as for now, any bugs reported will be taken into account for further development, so beta testing would be very welcome.

Construed

Awesome, Just pm me and let me know what you need tested or meet me on our web based IRC chat at http://gamersplanet.tk/chat/
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

void

As for now it would be okay to download the demo game above and play :-)

You might want to inform me about bugs you discovered then.

Construed

What's your server IP?
Tried connecting to my own IP and localhost with no luck.
When starting the game without connection get fatal error.
Second try clicking play worked, It appears to be transferring data however when i run 2 instances of the game multiple players do not appear.
I'm guessing it must not have a default IP when you click play.
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

void

There is no such thing as a public server. I decided to implement it directly inside the plugin, so clicking on "Play" will automatically create a host.

You should be able to login via a second workstation using your local lan IP. You could also run the game twice on the same pc, but since losing the focus of the window will block anything that's been processed, you would have to toggle between both constantly. Also, if you do so, be sure not to use localhost or 127.0.0.1. There have been some problems addressing the loopback interface for some reason, so I temporarily turned it off.

Construed

You could probably use:

SetMultitaskingMode(1);

to stop that losing focus thing.
I ran 2 instances of the game on the same IP but they dont seem to be transfering chat or x,y coords.
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

Well, You wanted me to beta test, that requires communication!
If there's some other form of communication you'd prefer let me know.
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

void

I did not intend to make the testing something exclusive, so I put up the sources and binaries of the demo game above. While the second one contains the actual plugin, the first can be used for reference. I'm doing this plugin in my spare time and unfortunately I'm currently quite busy with other things going on.

However, the plugin is in a usable alpha state, it only seems that people aren't very interested about it and therefore not much testing appears to be done.

But I will inspect your suggestion about setMultitaskingMode(), thank you very much for that idea.

Construed

Ah, Well no problem.
I'll surely play around with a bit and perhaps extend upon it, I need a break from GrimQuest every once and awhile.
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

deee

I know it's a bit late to post in a 4 months old thread, but hopefully this is still being worked on.
First of all, I have to say that this is a fantastic thing and you did a great job, void.
Having multiplayer features in AGS games would be so wonderful.

After copying some *.dlls to the project folder, everything but the chat function (GlobalScript.asc(104): Error (line 104): undefined symbol 'PopArgInt'
) worked for me.
I would really love to work with this in my game project, but I have no c++ programming skills. Is there a way to access the plugin or to make a module out of it?
It would be great to synchronize custom events, like NPCs entering the room and walking around when a specific action is used, but I don't know if there is a way to do stuff like that in the normal script files without having to access the plugin directly.


deee

At least, if there was a way to send any variable's value from one instance of the game to the other.
Imagine Action-RPG-Adventures with Coop-Mode and Duels ;)
Void, maybe you could make the user of the plugin decide what actions will be synchronized and when ?


subspark

Hey this sounds incredibly awesome. It's been a long time since I mucked about with coop in AGS! (nod)

Btw, I tried to download the demo game, but: "Diese Datei wurde vom User oder durch eine Abuse-Meldung gelöscht."
English Translation: "This file was deleted by the user or by an abuse message."

Could you re-upload a compiled binary for folks currently short of an AGS installation?
Thankies.  :-D

void

Well, first of that you very much for your positive comments :-)

The sad news is that I accidentially lost the sources of this plugin. I basically did this in about 24 hours for a compo, so I didn't pay too much attention in making sure nothing gets lost. Sorry bout that :-(

Now over to the not so bad news: While this happened to be a research project, I began to put some more effort in it a few months ago and eventually started a new project from scratch. Reading your posts made me want to reconsider taking on this project again. At all there's not much interest in having some sort of cooperative gameplay style in an adventure game, but I still kind of like the idea.

The new approach at this is to make the network interface more open for customizations, while still doing the 'hard work' in keeping track of the game world. First of all I started out with a global caching and advanced event system that aims a bit beyond the native plugin API. You can, for instance, control objects that are far away and not only those in your current room.

As for networking, I'm thinking about a dedicated server. I did not like the fact that the host needs to start the game as well and players are only allowed to join as long as this game is open. It is needless to say that the technical gameplay and the style of playing an adventure game is much more slow and careful than a more common multiplayer game and I don't wan't to invent some Monkey Island Tournament here. So I guess the idea of having a dedicated server gives the game more time and therefore hopefully retains the spirit that we do love when playing adventure games.

Following your advice in terms of synchronization, I came up with a pretty flexible event system that allows components to be linked to certain actions if the user (better:game developer) decides so. I think that should do the trick. What do you think of that idea? Is it still something or am just totally wasting my time? :-D

Baron

    Interesting project!  I think your disappointment at lack of enthusiasm may be due to this thread's location -you'd get much more exposure starting a GIP thread (since you are building an AGS game, after all). 
    I have nothing to contribute programming wise, but as an AGS developer I think it'd be great if you could communicate in real time between an AGS game on multiple computers through a server.  I know this has been partially done (i.e. the Awards Ceremony) but that only had more-or-less real time chat and coordinated movements.  If you could have chat, movement, multiple rooms (so players could be in separate locations), common inventory, variables and saved states even though no one is currently playing, that would be something worth building a game around.  But to popularize it you must make sure that it comes with some thorough documentation, or not many people are going to be able to figure out its true potential.

void

Just an update of the current progress. I tried to consider as many of the suggestions made in this thread as possible. I spent most of the time working on a plugin interface that allows me to make more advanced implementations to the engine (through many custom native and scripting events). Recently I started working on the network code. It really isn't that much of a problem since the basics have been set up and as time goes by I'm glad to see everythings slowly taking shape. I'm planning to install a git repository, but the code is not polished enough yet.

About your feature requests/suggestions:
- Chat is not implemented yet, but should be a piece of cake. I'm pretty sure that could be solved with a pure scripted implementation (based on the functionality provided by the plugin of course)
- Full synchronization of character and object movement will be there. The old plugin already had this feature and I'm currently on reimplementing it.
- Multiple rooms are also supported (due to caching the visited rooms in backround)
- Inventory will be synched. This is already implemented.
- Script variables are not synchronized. I clearly see no possibility of doing that without hacking the interpreter (which I'm not planning to do because of compatibility). But I could think of a couple of NetSet/NetGet functions allow the user to store primitive types (numbers and strings). However, this is absolute low priority right now.
- Save states might be synchronized. Didn't think about that too much right now, but I guess it's doable.

Although I'm planning to make this plugin as flexible as possible, there are certain things I'd like to automate. These things are most likely synchronization tasks. I guess this is the kind of hard work I'd like to take out of the game developers hands. If there is anything I forgot about, please let me know!

DoorKnobHandle

Since I've been working on something similar, I'd like to know about the more technical specifications, are you supporting TCP or UDP connections (or both?) How are you planning to do NAT punchthrough or does the plugin still require people to use a fake LAN environment such as Hamachi? Are you supporting blocking and/or non-blocking sockets? Oh and is it peer-to-peer or client-server?

void

Well, i think these questions are a little bit out of topic, because they're restricted only to the type of network connection and do not relate to anything regarding AGS. However:

- I'm using TCP. Adventure games do not need this kind of perfection in terms of timing. UDP would be overkill and needlessly complicated.
- I don't have any plans to implement such a thing like NAT punchthrough. This might be implemented later, but is not a big concern right now.
- It's a combination of both. The sockets are timed (blocked for a certain amount of time), but run in a seperate thread, so the game won't be affected at all.

DoorKnobHandle

So, this does mean that your plugin would be limited pretty much to adventure games made in AGS as far as I can tell. That's a shame, apart from that, it sounds like this is going to be very fun to play with (although I'm still not buying into the idea that true point'n'clicks can work in a multiplayer setting, but we'll see).

I disagree about NAT punchthrough though, I mean, to the average player it would make a HUGE difference if they could just hit the multiplayer button, find a game and play away just the way they're used to in any other game. Otherwise it's going to be kinda technical to set up games, you would have to share contact details with people before playing etc.

void

Quote from: dkh
I disagree about NAT punchthrough though, I mean, to the average player it would make a HUGE difference if they could just hit the multiplayer button, find a game and play away just the way they're used to in any other game. Otherwise it's going to be kinda technical to set up games, you would have to share contact details with people before playing etc.

Well, honestly this barely has anything to do with hole punching. What you're describing is (in both cases) a server-client model. While your preferred choice also provides a static login server (that is a dedicated machine where players register through a static IP or DNS entry), the second model is a decentralized approach. In both cases, this has nothing to do with the IP-Layer or number of P2P internodes (such as a NAT), but with the network topology. You could do both without providing punch through. A login server is indeed a nice thing, but since it uses its own protocol and sits in a dedicated place it could be retrofitted anytime.

DoorKnobHandle

Well, I was asking about whether the plugin works peer-to-peer or server-client. If it was peer-to-peer then yes, you do need to NAT punchthrough assuming either player sits behind a router. But it sounds like you're going for the client-server model instead, would be really neat if you or anybody else was able to run a login server once your plugin comes out!

Calin Leafshade

#33
You are misusing the term "NAT punchthrough"

NAT punchthrough is not strictly necessary for any networking model and very few games implement it because to do it right can be quite complicated and requires a central master server to do the matchmaking.

Most games simply rely on the user forwarding the correct ports to bypass the NAT or, alternatively, implementing uPnP which allows the application to do the same thing automatically.


DoorKnobHandle

I am sure that, for a peer-to-peer model (which is uncommon for games, admittedly), if either player is behind a router you will have to do your own NAT punchthrough to set up a connection peer-to-peer. In that special case it is absolutely necessary, I've done this before! I was asking about NAT punchthrough in the first place because I didn't know whether or not this plugin uses a peer-to-peer or client-server model.

void

Just for clarification: It doesn't matter what network model you choose to decide for or against NAT punchthrough. This is simply the step of readressing packets coming from a given subnet (i.e. www) into another most commonly local subnet (lan) using a bottle-neck node such as a router or modem. Since all connections made through this are addressed at the same IP, that is to say the public IP provided by the ISP, NAT routing is required in order to propagate the packet further over the "black box" subnet (LAN) to the correct receiver.

The reason I'd like to point this out is to make sure other readers of this topic won't be anxious about wheter the plugin uses a server-client structure with login functionality or not... just because - sorry to repeat myself, but I'd stick to the fact that this has absolutely nothing to do with NAT traversal.

DoorKnobHandle

I did indeed (wrongly) consider getting past PC and router firewalls to be a part of the NAT punchthrough process, sorry for the mess up on my part, that is what I was talking about!

But it really sounds like you'd rather keep the people here out of the technical innards of how your plugin works so as not to confuse them, so I'm going to shut up now! Sorry for the bother and good luck!

void

I'm sorry if I upset you. It is not that I don't want to expose technichal details on the implementation here, but the whole network thing got quite a bit beyond this topic, you know. I'd really like to discuss those details, but maybe this thread is just not a good place to do so. I hope you understand and do not feel offended by my response.

DoorKnobHandle

No offense taken, I literally got the feeling that it was in your interest to hide away a lot of technical mumbo jumbo from the average reader and, in the end, user of your plugin, which is understandable! I personally feel that, since this is the critic's lounge where, otherwise, art is examined and criticized in technical aspects, it's not out of place to talk about the technical innards here but it's your thread, I'm fine with, without or with a new thread! :)

SMF spam blocked by CleanTalk