
Show HN: MMOsteroids: JS, Go, and Webrtc - stcredzero
https://www.emergencevector.com/
======
stcredzero
In case you're curious, I documented my progress in these videos:
[https://www.youtube.com/watch?v=7x2uQjLtXkY&list=PLnAL8xf0QQ...](https://www.youtube.com/watch?v=7x2uQjLtXkY&list=PLnAL8xf0QQaD0bN5tCGnvh7Qq_kpFZznO)

EDIT: I guess I'm not going to get anywhere near my max theoretical population
of 560.

EDIT: Had to reboot the instance server. The WebRTC processes are holding up,
though.

~~~
crucio
Are you using webrtc for client to server communication? or just for client to
client? if the former, what library did you use on the server?

I've made lots of small browser games but haven't tried in the last few years.
Websockets have never scaled well for the obvious reason that over bad
connections data gets blocked up!

I don't understand what to do on your game, and the UI needs work. You're
obviously very good at the physics/networking side of things, but maybe get
some help on the UI :D I played for 10 seconds then had to close it

~~~
stcredzero
There's an old school tutorial here:

[https://secure.emergencevector.com/tutorial/](https://secure.emergencevector.com/tutorial/)

If you can't figure out how to make it into Hyperspace, you are officially a
weakly interacting massive particle! :D

Everything is client-server, client wins, except for one thing. (Left as an
exercise.) WebRTC is only there as a substitute for UDP.

~~~
crucio
Ahh nice, sounds like a good setup. Did you use an open source library for the
server side part of WebRTC? I'm super interested in having a play with a good
implementation if you have any tips..

~~~
stcredzero
I used some variation of node-electron. Here is the top of the node server
file:

    
    
        var wrtc = require('electron-webrtc')({ headless: true });
        var SimplePeer = require('simple-peer');
        var requestify = require('requestify');
        var dgram = require('dgram');
    

The Go server uses UDP to talk to one of the 4 node server processes, which
are running instances of Chromium under xvfb under tmux. There's a lot of code
load overhead for the 4 processes, in terms of a lot of Chromium loaded but
not running, but EC2 servers are RAM heavy, so not an issue.

I haven't looked into exploiting the new true headless mode in Chrome yet,
which should simplify things a lot. I'm also thinking of doing a full port to
Go for WebRTC. That's a lot of stuff, however.

~~~
crucio
Ahh interesting, thank you for that. That's an interesting point re headless
mode in Chrome (and Firefox now I guess!). It's a shame there's not an easier
way though yet..

------
jff
Reminds me of
[https://en.wikipedia.org/wiki/XPilot](https://en.wikipedia.org/wiki/XPilot)

I'll give it a shot when I get home from work!

------
mikejarema
It's a long shot... but are those sound effects from Starcon 2? Particularly
the rockets fired from these guys
([https://imgur.com/a/TU5kr](https://imgur.com/a/TU5kr))?

I played Star Control 2 many times over as a kid and can't help but think that
my many (many!) hours in front of that game have trained a part of my neural
nets to excel at recognizing the sounds and readying for battle. 20 seconds
into this game those paths were triggered, hence my Q.

~~~
stcredzero
Mmmmmmmmmaybe? ;)

~~~
gavanwoolery
Yeah, the laser sound as well I think? :) The instruments for the two songs I
made for Voxel Quest were ripped from Star Control and other tracker files.
[https://soundcloud.com/gavan-woolery/voxel-quest-
song-1](https://soundcloud.com/gavan-woolery/voxel-quest-song-1)
[https://soundcloud.com/gavan-woolery/voxel-quest-
song-2](https://soundcloud.com/gavan-woolery/voxel-quest-song-2)

~~~
mikejarema
Wow, that first one is like Ur-Quan + Yehat + Spathi all wrapped into one!
These both definitely nailed the SC2 aesthetic, thanks for sharing. (And also
for all your work on VQ, it was an amazing journey to follow!)

~~~
gavanwoolery
very late reply, but you are welcome! :)

------
vosper
I played it, and to be honest I couldn't figure it out. I did read the
instructions. I pressed shift and some yellow things went flying out of my
ship. I don't know what they did. Could do that about 3 times, then it didn't
happen when I pressed shift again. Tried pressing space bar to shoot, nothing
happened. Got killed right away by a group of three ships. Played a couple of
times, gave up.

~~~
stcredzero
You kept firing and ran out of energy. That's okay. I'm from the 80's arcade
days. It's a level of difficulty that's way too much for you younguns. I
swear, I had Battlezone set up, and so many kids walked up to it, spend 2
seconds wiggling the joysticks then walked away. There was this one kid who
was like, "what is that clock doing?" (That was the RADAR!)

Back in my day, at summer computer camp we'd wander around the college campus
looking for a teletype that actually printed on paper to break into the system
to play a game. We'd be so hard up for games, we'd type in source code
listings from paper magazines. That's how we learned how to program!

It was just too hard for you! Them's the breaks!

~~~
jksmith
Haha old guy bias. I did make it all the way through Stargate btw. That game
was a screaming bitch.

------
wiz21c
I tried playing it but there's a group of spaceships that is constantly
destroying me in less than a minute :-(

~~~
stcredzero
Try thrusting so your velocity doesn't take you into the central swarm.

------
NinoScript
This was fun, a bit hard to figure out, but I did eventually manage to kill
quite the number of enemy (?) ships and even travel through hyperspace!

I also tried to save some other players by killing the ships that were
following them, but they never survived…

~~~
stcredzero
I know. People die so easily, then just give up. Kids these days!

------
lcw
I think the sounds effects blew out my speakers in my headphones... well at
least my ear drum. I was not prepared, and I was listening to music loudly ;-)
. Warning to all to turn your sound down before playing.

------
Thaxll
I'm curious about Webrtc vs WS with binary protocol?

~~~
stcredzero
WebRTC lets you get out of head-of-line blocking. (TCP stream semantics.) This
can be a real killer with regards to latency with bad network.

[https://gafferongames.com/post/udp_vs_tcp/](https://gafferongames.com/post/udp_vs_tcp/)

------
ptx
The look reminds me of an old Asteroids-like game for OS/2 (I forget the
name). Just a coincidence, or was that an inspiration?

~~~
stcredzero
There's a lot of ripping off of Star Control 2: The Ur-Quan Masters.

~~~
yobert
Yeah the main weapon sound is from a poor copy of the Earthling Cruiser :)

------
danellis
I would have tried it, but it wanted me to create an account. For an Asteroids
game tech demo. Why not just ask for a name?

~~~
stcredzero
This is the second time that I have posted a link to a multiplayer game server
on HN. With my first server (which was also written in Golang with a
Javascript front end) I "automatically" logged in the player. When you do
that, some smarty pants on HN writes a script to do nothing but log in.

I've thought of some low-friction registration methods, but making them @sshat
proof takes more effort than just having a registration and slapping a captcha
on it.

~~~
ryanlol
Automatic registration with "invisible" recaptcha?
[https://developers.google.com/recaptcha/docs/invisible](https://developers.google.com/recaptcha/docs/invisible)

~~~
stcredzero
I might have to use this! Thanks!

------
ChuckMcM
Nicely done! The basics are there, the next step could easily be something
pretty compelling.

------
IshKebab
Ha it's like Subspace! But... not as good. Subspace deserves a web-based
conversion.

~~~
vvanders
Ahhh Subspace. I break that out every once in a while as a game that was
perfectly designed for it's constraints. 200-400 player real-time battles all
over a 28.8 modem, truly a work of art.

I think the community took over it at some point and it's still kicking around
somewhere.

~~~
stcredzero
_Ahhh Subspace. I break that out every once in a while as a game that was
perfectly designed for it 's constraints._

Oh yeah! Subspace! Its successor is on Steam. The original implementation
suffered greatly because it had a client-trusting architecture, and it was
subject to endless cheating.

[http://store.steampowered.com/app/352700/Subspace_Continuum/](http://store.steampowered.com/app/352700/Subspace_Continuum/)

I'm explicitly not trying to be Subspace. I actually can't support (to my high
standards) the kind of real-time Subspace was trying for. (I can't guarantee
your angular orientation is what you think it is down to 1/60th of a second.)
My eventual goal is to try to implement a Space MMO, sort of like a 2D arcade
space Eve Online.

Also:
[https://www.youtube.com/watch?v=E3DPalL7p5w](https://www.youtube.com/watch?v=E3DPalL7p5w)

~~~
IshKebab
Are you sure it isn't still client-based? Continuum was protocol-compatible
with Subspace so was also client-based (and was released when dialup was still
popular so it had to be). This Steam version doesn't really look like they
have rewritten it (why would they?), so I suspect it is still client-based
unless you have any evidence to the contrary.

------
freekh
This is just awesome! Thanks for sharing!

------
jlebrech
a PVE game could have client/client communication too.

