Author Topic: P2P Library  (Read 2852 times)

Marcus

  • Administrator
  • Hero Member
  • *****
  • Posts: 541
    • View Profile
P2P Library
« on: June 24, 2016 »
I have been working on a library/extension for peer-to-peer multiplayer support. Since a thing like that is mighty hard to test alone, I'm looking here for users that would like to participate in a short and simple test this Sunday. Just reply to this message if you're interested in helping.

DOWNLOAD:   The latest version of the library can be found at http://naalaa.com/p2p_next/p2p.zip (updated 2016-08-27)
« Last Edit: August 27, 2016 by Marcus »
.\\\opz

Marcus

  • Administrator
  • Hero Member
  • *****
  • Posts: 541
    • View Profile
P2P Library Betatest
« Reply #1 on: June 24, 2016 »
The beta test will take place this Sunday around 16:00 (Stockholm time, UTC/GMT +1). I will post a zip here with the "game". Basicly it's just a chat room, where you can walk around with an avatar and post messages to the other "players". I've already made local tests and a test with a friend on a remote computer. What I wanna see now is how well it works with more clients connected.

For those of you interested, the sourcecode (NaaLaa, C and some PHP scripts for keeping track of " live" lobbies) will be included in the archive.
.\\\opz

cvirus

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: P2P Library Betatest
« Reply #2 on: June 25, 2016 »
Well you got me with the code :-).

Marcus

  • Administrator
  • Hero Member
  • *****
  • Posts: 541
    • View Profile
Re: P2P Library Betatest
« Reply #3 on: June 25, 2016 »
Well you got me with the code :-).

Haha :)

I've got a feeling it'll just be me and you, but it'll still be interesting to try since I've made (and will make) lots of changes since I tested with a friend the other day.
.\\\opz

cvirus

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: P2P Library Betatest
« Reply #4 on: June 25, 2016 »
Well you can count with me, :-). Where is the app? Do you supply the instructions?

Thanks.

Marcus

  • Administrator
  • Hero Member
  • *****
  • Posts: 541
    • View Profile
Re: P2P Library Betatest
« Reply #5 on: June 25, 2016 »
I don't think I'll modify the app any further, so I'm attaching it to this post.

When we test on Sunday I will create a "lobby", and you (and anyone else interested) will join it. There's no difference between my app and the app you'll be running.

When you start the app, and after entering your name, you'll have three options to choose from, displayed like this:

  1 - Search for existing lobbies
  2 - Start a new lobby
  3 - Quit

When you select the first option on Sunday, the app will fetch a list of available lobbies through a php script and a mysql database on naalaa.com. You'll be presented with a list:

  0 - LOCALHOST
  1 - User: Marcus  IP: 217.210.95.67

And you should press 1 to connect to my server (my computer running the same app).

Then you'll enter the "game", where we can jump around and chat with eachother :)




Now you may wonder what happens if you choose to start a lobby yourself. Well, on success, you will be listed when other people search. But if you're behind a router, no one will be able to connect to your lobby. For that to work, you have got to log in to your router and make a "port forward" to your computer for port 31903. The same procedure goes for most p2p based online games when you want to host your own lobby.

However, if you start an instance of the game and start a lobby, you can start another instance of the game and connect to yourself by choosing to connect to LOCALHOST. You can give this a shot already, if you want. You'll end up with two running apps where you can chat with yourself ;)  If you don't terminate the lobby by pressing Esc, your lobby will remain in the public list though (don't worry about that, I'll clear the list tomorrow). I have yet to write a check for "dead" lobbies.

Edit I just fixed a "lag" issue and removed the display of IP addresses - now you only see the name of the user who's hosting a lobby.

Sunday edit I added a separate log window for chat messages and other stuff, you can write your messages there too.

Sunday edit 2 Added word wrap to the log window ...
« Last Edit: June 26, 2016 by Marcus »
.\\\opz

cvirus

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: P2P Library Betatest
« Reply #6 on: June 25, 2016 »
Ok, i got it, what time should i lohg in? I have london time :-), gmt +00.

Marcus

  • Administrator
  • Hero Member
  • *****
  • Posts: 541
    • View Profile
Re: P2P Library Betatest
« Reply #7 on: June 25, 2016 »
Ok, i got it, what time should i lohg in? I have london time :-), gmt +00.

I just updated the zip, since there was a lag issue. I also removed the display of IP addresses - only username is shown now for lobbies.

I had to google it since I doubted my own mathematical skills ... you should login at 15:00 :D
.\\\opz

cvirus

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: P2P Library Betatest
« Reply #8 on: June 25, 2016 »
I like it, very cool, maybe some suggestion?

-Bigger delay so we can read better.
-check if the ballon is bigger so the words wrapp

F... awsome man, great work on this :-).

darkhog

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: P2P Library Betatest
« Reply #9 on: June 25, 2016 »
Actually about hour or so ago I was playing around with it and created a lobby and Marcus or someone claiming to be him (Name used was Test) came along and we talked and short delay was mentioned and I've proposed a chatlog as a solution. He said that if he has time, he'll implement it.

Marcus

  • Administrator
  • Hero Member
  • *****
  • Posts: 541
    • View Profile
Re: P2P Library Betatest
« Reply #10 on: June 26, 2016 »
Yeah, that was me :)

I updated the program so that it opens an extra window for chat (and connection) log, it's easier to write in that window too. For some reason my avatar sometimes started running right while i was using the old chat ...
.\\\opz

darkhog

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: P2P Library Betatest
« Reply #11 on: June 26, 2016 »
About running right issue. I've nailed it down to pressing apostrophe (') key.

Marcus

  • Administrator
  • Hero Member
  • *****
  • Posts: 541
    • View Profile
Re: P2P Library Betatest
« Reply #12 on: June 26, 2016 »
About running right issue. I've nailed it down to pressing apostrophe (') key.

Haha, well done :)

After adding the extra window for the log, I experienced some weird issues with chatting the "old" (yesterday ...) way. It's probably because naalaa now receives key input from two windows at the same time (IUP sort of hijacks naalaa). So, just use chat window, not the old one.

About the test. All i really want to check is that connecting and disconnecting works well and if there are any serious lag issues with more than two users (not that I'm sending that much data). Should have added some "enemies" too that everyone could interact with, since it would show lag problems better, but ... that will be in a future test.  I'm just so bloody happy I could make the thing work at all, having no previous experience in socket programming :)
.\\\opz

Marcus

  • Administrator
  • Hero Member
  • *****
  • Posts: 541
    • View Profile
Re: P2P Library Betatest
« Reply #13 on: June 26, 2016 »
Thanks to those of you who dropped by during the test time! Also thanks to those who joined in earlier while i was running short tests on my own :)   I was so surprised when you popped up, Rick :D

During the next test there will be bots/enemies that all users can interact with. That will probably be more interesting, since it will show "lag" issues. Hopefully the test will take place already next weekend, not sure if it will be a 2D or 3D environment yet.

If you have looked at the "game" code and have an idea of how things work, feel free to come up with suggestions for the library.
« Last Edit: June 26, 2016 by Marcus »
.\\\opz

darkhog

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: P2P Library Betatest
« Reply #14 on: June 26, 2016 »
Shit, I've missed it :(.