Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: MMOsteroids: JS, Go, and Webrtc (emergencevector.com)
86 points by stcredzero on Sept 25, 2017 | hide | past | favorite | 49 comments



In case you're curious, I documented my progress in these videos: https://www.youtube.com/watch?v=7x2uQjLtXkY&list=PLnAL8xf0QQ...

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.


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


There's an old school tutorial here:

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.


Everything is client-server, client wins, except for one thing.

I had the polarity reversed. It's actually client-server, server wins.


> WebRTC is only there as a substitute for UDP.

I knew that this was possible in theory, but my experience with messing around with the available serverside WebRTC libraries gave off a similar first impression to the one you mention in your blog, namely immature libraries.

Looking forward to your blog post on your experiences with Datachannel.


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..


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.


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..


I thought stuff like "1M concurrent connections" was easy this days? I'd love to understand more about your problems.


Sorry when I said scale, I mean.. scale to real world usage. Websockets run over TCP so if you're on a bad connection, packets have to be re-sent, meaning real time gaming becomes very very difficult to implement.

TCP/websockets are good for slower paced games like point and clicks but they don't normally work well for fasted paced games with physics.

WebRTC data channels don't have to re-send lost packets (unlike WebSockets), so if you do WebRTC between client and server it will unlock a new genre of games for the web!


Reminds me of https://en.wikipedia.org/wiki/XPilot

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


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)?

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.


Mmmmmmmmmaybe? ;)


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-2


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!)


very late reply, but you are welcome! :)


I like it! Just listened to both.


I'm making a space ship game too for fun and came to a realization that even without art talent, I can make space ships in a minimal style but have zero clue where to begin with making my own sounds of the same fidelity. So I borrowed a bunch until I can figure that out.

Interesting how much more accessible graphics design is over audio design.


Get ahold of random sounds, then mix them together in Audacity. Apply effects. Reverse them in time. Also, there is: bfxr / sfxr

http://www.bfxr.net/


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.


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!


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


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


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


I just run away


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…


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


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.


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


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/


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?


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


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


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?


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.


Automatic registration with "invisible" recaptcha? https://developers.google.com/recaptcha/docs/invisible


I might have to use this! Thanks!


admin/password works


Oh hey, someone registered that!


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


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


Ha it's like Subspace! But... not as good.

It's mostly a tech demo now. There is one mechanic that is worth a few minutes interest. Can you make it into Hyperspace? If you're really good, you can do it without firing a shot. If you're not that good, then you can thrust away so you're not going towards the center, then snipe the 3 attacking ships. After that, it will be easier to figure out how to get through the stargate without the attackers.


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.


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/

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


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.


I loved Subspace, Cosmic Rift, and Infantry. One day soon we'll have some remakes I'm sure!


Subspace already has a remake on Steam.


This is just awesome! Thanks for sharing!


a PVE game could have client/client communication too.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: