Noobhub - Free Opensource Multiplayer And Network Messaging For Coronasdk

aren’t you forgetting network permissions for the pp…?

the app on the phone should ask for permission to access internet.

I was supposed to ask android for permission :0

thanks for pointing that, i didn’t know it…

I searched all over internet i couldn’t find your thread/posts on creating lobby and matchmaking.

Can u please guide me on how to set my server so when the clients connect they all go to waiting-room channel from where the server pair 4-6 players, create a random room and send them there and do it for all waiting players in the waiting-room.

Thanks again!

Oh, it was on old Noobhub discussion thread http://developer.coronalabs.com/code/noobhub

Here’s copypaste:

All users of the game should be subscribed to the same channel, say,
“my-super-game-lobby”. This is called “lobby”.
Once somebody needs to find a gaming partner, he posts a message to the lobby channel, like, ‘who_wants_to_play’.
Every client on lobby who is up for a game, answers ‘i_wanna_play’.
Ofcourse, initial ‘who_wants_to_play’ message should carry unique identifier of request, and ‘i_wanna_play’ answers should carry this identifier as well (and unique user id also).
Once game starter got responses to his ‘who_wants_to_play’ request, he can choose (random?) user to play with, so he posts a message to lobby ‘lets_play_in_channel’, carrying id of the user to play with, and new unique name of the channel. The user who this message was intended for should instantly subscribe to this new channel, where all in-game interactions will happen. That’s it, game begins.

This whole process is called ‘negotiation’, and ofcourse it can be more complex than the brain-dead-simple variant I described :stuck_out_tongue:

hi again @overtorment,

I am getting some frame difference between clients, have a look at the following picture please…

difference.jpg

I create a bullet and send the message to all the clients to create the bullet too and the difference is visible in the picture, what do u recommend to fix it?

Thanks @overtorment!

I have this up and running on my raspberry Pi :slight_smile:

Both your ping example, and the lobby example from the other thread work as advertised!

I am using a dynamic DNS name in the corona client in stead of an IP address , this way I can move the server around, without having to worry about creating a new client build if the IP address changes, but I’ll keep the hard coded L33t port.

Have you experimented with a data back end ? I installed mongo db on the Pi as well,  (took houuuuuurs) , but haven’t done anything to integrate the two.

Fun times ahead!

@coolromin - Sounds like we’re all going to have to learn techniques that minimize the effects of network lag.

  Maybe we could wait for the client to receive its own ‘fire’ message before firing the bullet?

 Or let the server predict where everyone ‘should’ see an object, and use a transition to move that distance between messages?

Hello,

Sorry for a dumb question, I own a corona game code I am trying to get on the app store.  It had multiplayer I believe running through noobhub but is no longer supported on the original developers server.  I am trying to get the multiplayer functional so I can get it back on the app store.  Are these the credentials to test on your server?

server = “198.57.44.231”; port = 1337

I tried plugging that into the game code but doesn’t seem to work. 

I would appreciate any help you can offer.  Also willing to play a corona develper for help getting multiplayer functional.

William

Hi overtoment!

I am almost done with the client side and now it is time to start work on server script. It is my first time creating an online game so i am very confused with server side.

My game is somehow similar to famous “fun run” game.

What do you think how they implemented the client server? Is that similiar to what you posted above?

Can you please guide me a little how to setup my client server with that type of game?

Thanks Alot!

Bro, you dont need to set-up anything.

Just write the god-damn code  :slight_smile:

Those are the tutorials I highly recommend:

https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking

http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/

http://gafferongames.com/networking-for-game-programmers/

And yes, Noobhub will do for any type of multiplayer communication.

@coolromin yes it looks like a network latency lag. This is where lag-compensation and prediction algorithms should be thinked of.

Vavle has nice tutorials on how they do it in their multiplayer games (I posted the links above).

Easiest solution is: when client receives event, place it not on the same coordinates where it originated, but calculate new ones based on the time it took the message to travel through the network (tens to hundreds of milliseconds, it depends).

I posted some diagrams of how my algorithm to determine actual network latency between 2 clients works on the 1st page of this thread.

@tfargason yes credentials look correct:  https://github.com/Overtorment/NoobHub/blob/master/client/lua-corona/main.lua

Ive just checked, server is up and running. You can try downloading example app from github, and check if it works.

Maybe you’ll have to update Noobhub client library…

@r.delia Good job! But anyway, I think Noobhub should be used for publish-sibscribe messaging only, and should not handle heavy backend calls. So I suggest you to do backend stuff via plain requests to your scripts (php, python etc) to do stuff with database, and leave Noobhub only for messages routing.

Hey overtorment!

What database solution would you recommend me to use alongside noobhub? And if u can point me to any script or tutorial on how to use it with corona?

Thanks Again!

I would recommend CouchDB (its a key-value storage) because of its REST interface.

And as I said, I would not recommend hooking it up with Noobhub. Your clients (on Corona-Lua) should talk with it.

Thanks for your suggestion…I really appreciate your quick replies and useful guides/helps.

What about Sqlite which is supported by corona? Oops sqlite support open database from url :stuck_out_tongue:

Anyway, I would very apreciate it if you give me an example on how to use couchDB with lua. (I am very new to lua and apart from using NoobHub for networking, i haven’t used any network functions of lua so i have no idea abou it.)

Thanks Again!

I found a lua framework for couchDB HERE ,  I really don’t want or need to make stuff very complicated, i will be using couchDB to login users and update their scores etc, So do u recommend using this framework or it is better to go without it?

Sorry for asking so many question :d

overtorment you’re doing an awesome job with noobhub! just sayin

Anyways, I’m working on my first online game and I don’t know how to set up an amazon ec2 server with noobhub. Any suggestions where I could look to figure this out or is there a simple way someone could explain it?

hi again @overtorment,

I am getting some frame difference between clients, have a look at the following picture please…

difference.jpg

I create a bullet and send the message to all the clients to create the bullet too and the difference is visible in the picture, what do u recommend to fix it?

Thanks @overtorment!

I have this up and running on my raspberry Pi :slight_smile:

Both your ping example, and the lobby example from the other thread work as advertised!

I am using a dynamic DNS name in the corona client in stead of an IP address , this way I can move the server around, without having to worry about creating a new client build if the IP address changes, but I’ll keep the hard coded L33t port.

Have you experimented with a data back end ? I installed mongo db on the Pi as well,  (took houuuuuurs) , but haven’t done anything to integrate the two.

Fun times ahead!

@coolromin - Sounds like we’re all going to have to learn techniques that minimize the effects of network lag.

  Maybe we could wait for the client to receive its own ‘fire’ message before firing the bullet?

 Or let the server predict where everyone ‘should’ see an object, and use a transition to move that distance between messages?

Hello,

Sorry for a dumb question, I own a corona game code I am trying to get on the app store.  It had multiplayer I believe running through noobhub but is no longer supported on the original developers server.  I am trying to get the multiplayer functional so I can get it back on the app store.  Are these the credentials to test on your server?

server = “198.57.44.231”; port = 1337

I tried plugging that into the game code but doesn’t seem to work. 

I would appreciate any help you can offer.  Also willing to play a corona develper for help getting multiplayer functional.

William

Can’t get the php console to work, even tough node.js is (well, was…) running just fine, untill it didn’t and made me look into the php to have some log information.

First, what I get on the php when I run it on my server:

Hello. Noobhub online.  Warning: stream\_select(): supplied argument is not a valid stream resource in /var/www/flashgames/mobile/console.php on line 52 Warning: stream\_select(): supplied argument is not a valid stream resource in /var/www/flashgames/mobile/console.php on line 52 Warning: stream\_select(): supplied argument is not a valid stream resource in /var/www/flashgames/mobile/console.php on line 52 Warning: stream\_select(): supplied argument is not a valid stream resource in /var/www/flashgames/mobile/console.php on line 52 .......

What and where the problem seems to be:

if(non\_block\_read(STDIN, $x)) {

already you can see a problem there, where “STDIN” is not formatted right for a php variable…

My search on “STDIN” on the page gave me this line:

$in = fopen('php://stdin', 'r');

So I thought to myself, replace “STDIN” with “$in” and the problem should be solved.

Of course I was wrong.

Can you give me hint in the right direction? At this point I had node.js running just fine on our server, working like a charm, today, it doesn’t, so I’ll need, or want, the console to see some messaged from it so I’ll be able to debug it.

Thanks again for all your effort!

Yuval.

Well, console connects to Noobhub, its not intended to debug nodejs code.

If the problem is with Noobhub server, php script will fail as well.

I suggest to turn verbose mode on Noobgub server, re-run it and see whats wrong.

PS. STDIN is a valid php constant pointing to real stdin.

Thanks for the replay, I was not aware of that, I was sure the php console file was meant as a way to view the log messages generated by the server running, if that is not the case, what am I missing here? how can I see the _log messages the noobhub generates? (I’m sorry for needing all this information, this is not my native language, I’m trying my best to understand what I’m doing by applying information from other languages I use to your code, some I’ve made work just fine, like sending a user name when subscribing along side with the channel name, so I could store the sockets in an associative array and not a numeral one, so I could easily send message client to client instead of client to room, which worked perfectly).

The problem I’m seeing with noobhub at the moment is not that it does not work, since I can connect to it from my corona project, but for some reason the messages sent are not reaching their destination, which worked find until 2 days ago, but with out being able to see at the moment the log messages, it’s a hard time debugging this…