Wazarr94 / haxball_bot_headless

Ready-to-go scripts and functions for the HaxBall Headless API !
MIT License
46 stars 74 forks source link

Clarification on VPS approach #46

Closed theCrius closed 2 years ago

theCrius commented 2 years ago

New to haxball management and I'm trying to understand how to properly set up the VM (ubuntu 18) on which my installation of Haxroomie is running already 2 vanilla rooms with some of saviola777/hhm-plugins plugins.

In your readme you say to write a configuration like this:

    {
        autoStart: true,
        roomName: 'YOUR ROOM NAME HERE',
        maxPlayers: 16,
        public: true,
        noPlayer: true,
        token: 'YOUR TOKEN HERE',
        roomScript: '/path/file/Haxbot_public.js',
    }

But when I checked the content of Haxbot_public.js in your repo, I see that it would "re-initialise" the room. Can you clarify? Maybe because the token will be the same it will simply "load" the room to be able to access the hooks? If it's an oversight, can you provide some guidance or a version of the file for VBS?

Thank you

theCrius commented 2 years ago

To clarify, as it was quite late when I wrote this yesterday, The room spin up but when I join I see that I'm a normal user (no admin rights) and there is no bot running. Checking the logs of Haxroomie shows nothing of note.

I'll try and debug a bit today.

theCrius commented 2 years ago

In haxroomie, selecting the room and running plugins return no results.

theCrius commented 2 years ago

Turns out I was writing the wrong path to the script file. Haxroomie only outputting it at the very top and then going on with a wall of green text didn't help.

Having fixed that however, I get this error message. No stack trace. Is there somewhere I can get some more detailed logs?

Unable to execute plugin. SyntaxError: Identifier 'message' has already been declared
Invalid plugin ./custom-script.js, either an error happened during plugin execution or HBInit() was not called
Wazarr94 commented 2 years ago

Hi, I have tested successfully that launching with haxroomie works fine without plugins.

I haven't tested using plugins, I assume they don't do much outside of what is being provided in the script. Could you tell me what you want? Not sure to understand this part.

theCrius commented 2 years ago

At this point I don't know then. I created a simple configuration for haxroomie following your example on the readme but the room start without any functionality. Meaning the room start, there is that error above but there is no bot, no commands, nothing really.

There is no plugin loaded, just the roomScript that load the Haxbot public script in your readme.

I'm struggling to find out how exactly haxroomie or even haxball works in terms of "the actual code" that would help me understand a bit more of what might be going wrong.

Unfortunately it seems to be a very niche project with little sources of documentation.

Wazarr94 commented 2 years ago

OK I just tried doing the hosting on my machine with WSL, it didn't work well. However, following the instructions on a Google Cloud VPS worked just fine.

I guess that a better approach that is slightly more technical would be to use puppeteer. It's a library to control the browser, and haxroomie is based on it.

Wazarr94 commented 2 years ago

I've just made a very simple repo to host your script using puppeteer: https://github.com/Wazarr94/haxball-puppeteer

Simply install the LTS version of node, run npm install and npm run start to launch your script. Make sure to edit the haxball_script file to your liking and add the token in the file.

theCrius commented 2 years ago

My tries are on a freshly made VM on Azure with Ubuntu 18.04. Installed only the necessary for the headless.

I'll take a look and tomorrow will try your repo over there :)