haxball / haxball-issues

115 stars 43 forks source link

Node.js and headless host #443

Closed olehmisar closed 6 years ago

olehmisar commented 6 years ago

Opening room on VPS isn't easy. There are at least 2 ways:

Any of this isn't perfect. So, what about node.js? In headless host you don't use canvas API and don't play any sounds. There are webRTC libraries for node.js, so no problems with this technology.

Advantages of headless host on node.js:

If you want I can help you to move headless host to node.js platform.

andriyleu commented 6 years ago

Headless Chrome is working fine for me, it takes around 1 min to complete captcha but it works at the end, what's your issue?

olehmisar commented 6 years ago

When I was using headless chrome and was connecting to it via ssh I wasn't able to solve captcha. I was solving it for 4 days before it confirms me as human. That's because chrome remote debugging tools don't use mouse pointer and don't dispatch mousemove event. For captcha my mouse was moving instantly (telepoting). Today I have installed GUI on my server and it worked perfectly. But chrome isn't headless and some resources are used to draw GUI. So, I thought that porting headless host on node.js isn't bad idea at all.

pilaf commented 6 years ago

The captcha isn't there just to annoy you, it has a purpose, so even if @basro decided it's a good idea to port the Headless API to Node.js (spoiler alert: he won't) he'd still need to put in place some sort of captcha.

He has already said he'll implement an alternative method to help solve the captcha in a headless browser through tokens or something of the sort, you'll just have to wait a little for that to happen.

In any case, headless Chrome works fine for me too. Maybe make sure you're connecting to it through the same version of Chrome.

olehmisar commented 6 years ago

I DON'T have problems with chrome. It works perfect. But making server on chrome isn't good. You can use chrome for small rooms where you have almost none functionality. But as room grows you need more possibilities and more powerful platform.

I use code preprocessor to merge all files in one file, so I can't just copypaste code because chrome crashes when I paste 400kb of code in console. I can't store player data in localStorage because it has 4-10mb limit. So, I need to develop separate server to use SQL DB.

With node.js we can avoid these problems. However node.js is same JavaScript but on server, so, I believe it is easy to port headless host if code isn't written awfully.

And finally you don't need VPS server to host node.js application, just regular hosting.

pilaf commented 6 years ago

There are much better ways of interacting with Chrome than copy-pasting into the dev console.

olehmisar commented 6 years ago

I know about this but what's the point of this if you still need to solve captcha? Also you use node.js to start chrome. So, it makes no sense.

basro commented 6 years ago

Sorry but I wont be implementing a nodejs version.

olehmisar commented 6 years ago

Explanation?

pilaf commented 6 years ago

I use code preprocessor to merge all files in one file, so I can't just copypaste code because chrome crashes when I paste 400kb of code in console. I can't store player data in localStorage because it has 4-10mb limit. So, I need to develop separate server to use SQL DB.

None of those limitations are caused by the current implementation of the headless API, but rather by the way you're doing things. You should rethink your approach.

ghost commented 3 years ago

i writed a solution for this with native nodejs packages and without web browser

Haxball-Server-Nodejs is a tool to run Haxball server in native nodejs (without puppeteer). We rewrited headless.min.js from the browser to nodejs (the first package that offers native nodejs support).

https://github.com/MDox1/haxball-server-nodejs

mertushka commented 2 years ago

Sorry but I wont be implementing a nodejs version.

I have implemented a nodejs version.

haxball.js