Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Agar.io-like Multiplayer Corona Web Game
Started by joecoronasdk Feb 25 2020 09:21 AM

8 replies to this topic
multiplayer websockets html5 luvit node
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

joecoronasdk

[GLOBAL: userInfoPane.html]
joecoronasdk
  • Observer

  • 28 posts
  • Corona SDK

I've made a pretty good system for making io-styled multiplayer games in Corona.

 

Demo link: https://livegames.cc

 pf6ntjR.png

 

Technologies I'm using:

 - Corona SDK (obviously)

 - Node server for handling websockets

 - Luvit for Lua game server

 - Firebase hosting for hosting static Corona HTML5 app

 - Vultr for hosting my Node and Luvit server

 

The Luvit server communicates with the Node server over a localhost socket connection on the same computer.

 

And I'm aware my server isn't secure...I just got this working last night at 1:30am so I didn't get the chance to change policies.

 


  • Michael Flad, StarCrunch, agramonte and 2 others like this

[TOPIC: post.html]
#2

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 809 posts
  • Corona SDK

I couldn't get the demo to work but this looks fantastic.  Please keep us updated with your progress and samples of what you are working on.  Also, count me in for play testing.


  • joecoronasdk likes this

[TOPIC: post.html]
#3

joecoronasdk

[GLOBAL: userInfoPane.html]
joecoronasdk
  • Observer

  • 28 posts
  • Corona SDK

I couldn't get the demo to work but this looks fantastic.  Please keep us updated with your progress and samples of what you are working on.  Also, count me in for play testing.

 

What OS and browser were you using? My friends who use Mac all had it working, but my brother has a Windows machine and it doesn't load for some reason.

 

Thanks for the support too  :D  I'll post updates here



[TOPIC: post.html]
#4

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 2,219 posts
  • Corona SDK

Works on Chrome (windows 10) but it was so lonely lol



[TOPIC: post.html]
#5

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 809 posts
  • Corona SDK

I got it to work on my mac using a Window 10 (Parallels VM and Explorer).

 

I would love to see this as a plugin.  It's functionality I would pay for.



[TOPIC: post.html]
#6

joecoronasdk

[GLOBAL: userInfoPane.html]
joecoronasdk
  • Observer

  • 28 posts
  • Corona SDK

I got it to work on my mac using a Window 10 (Parallels VM and Explorer).

 

I would love to see this as a plugin.  It's functionality I would pay for.

 

Glad it works there! I found the problem though, it's the screen size. If your browser window is too big, then it breaks because I'm using "adaptive" not "letterBox". I prefer using adaptive content scaling in my projects, so I'll probably just change the index.html styling to make sure the Corona canvas doesn't grow too big.

 

And when it comes to a plugin, I'm not sure if I want to share just yet. I'm changing a lot of things quickly. I'm only about 2 weeks into making this so things are moving fast. Maybe open source would be a better option? Things like server passwords and keys are already stored encrypted in an untracked folder, so I think it's something we could open source without any security issues.

 

I've also built it as a Lua CLI which handles everything (including starting new servers with startup scripts). I'll post screenshots of the cli soon. It basically has commands like "hub build html5", "hub build vultr" or "hub deploy vultr" where vultr refers to the nodejs and luvit server.


  • sporkfin likes this

[TOPIC: post.html]
#7

joecoronasdk

[GLOBAL: userInfoPane.html]
joecoronasdk
  • Observer

  • 28 posts
  • Corona SDK

Okay I've split the project into two git repositories:

 - TemplateCoronaIOGame

 - .hub

 

TemplateCoronaIOGame contains ".hub" as a git submodule. The root folder looks like this:

 

https://imgur.com/gCawyfD

 

Basically my idea is that everyone's io-game project can be in a root folder like "CoronaIOGame", and they could have the ".hub" folder just pointing to the shared hub GitHub repo. This way we could make changes to the hub project and benefit all our io games. 

 

Here's how hub CLI looks at the moment.

 

https://imgur.com/YOjCAIQ

 

 

And here's what it looks like when you deploy new luvit changes to a server.

 

 

https://imgur.com/qqSmeCI

 

Anyways I'm not sure if I should open source it until I get it to a stable point. I'm about 3 weeks into this thing...and I'm constantly introducing breaking changes. 

 

I'm also worried about trying to help other developers get started. For example, there are two folders I'm using which might be difficult to explain to newcomers. Most of the content in there is generated by the CLI.

 

https://imgur.com/NFEIVJV

 

https://imgur.com/1ZBYjMq

 

The tracked folder is tracked by your game's git repository and remembers things like where your firebase project is located. I have a lot of data about the project stored on Firebase.

 

The untracked folder is ignored by git, and it contains your passwords for servers and firebase encrypted. These encrypted passwords are also stored on Firebase's realtime database so that you just login once to firebase and everything else populates.

 

So what I'm saying is that I tried a lot of things, and I'm a little nervous about opening up for others at the moment until I've narrowed the project down to a point where I'm not experimenting with new ideas every weekend.


  • sporkfin and joecoronasdk like this

[TOPIC: post.html]
#8

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 809 posts
  • Corona SDK

This is a pretty nifty project!  Is there are particular reason you chose Firebase besides personal preference or familiarity?



[TOPIC: post.html]
#9

joecoronasdk

[GLOBAL: userInfoPane.html]
joecoronasdk
  • Observer

  • 28 posts
  • Corona SDK

I knew how to use Firebases’ real-time database from their CLI. So I just used it to backup project settings and passwords that I didn’t want committed in git. You can do without firebase and it will still work.


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: multiplayer, websockets, html5, luvit, node