Skip to content

akama/hyxor-js-scaffold

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hyxor Javascript Scaffolding

This is a Node.js program that connects to the Hyxor game server using WebSocket and plays the game autonomously. The bot receives game state updates from the server, analyzes the current state, and makes strategic moves based on the implemented strategy.

Prerequisites

  • Node.js (version 12 or above)
  • npm (Node Package Manager)

Installation

  1. Clone the repository or download the source code.
  2. Open a terminal and navigate to the project directory.
  3. Run the following command to install the required dependencies: npm install

Configuration

  1. Open the index.js file in a text editor.
  2. Modify the following configuration variables according to your setup:
  • serverURL: Set the URL of the Hyxor game server WebSocket endpoint.
  • playerName: Set the name of your player.

Running the Bot

  1. In the terminal, navigate to the project directory.

  2. Run the following command to start the bot: node index.js

  3. The bot will connect to the game server and start playing the game automatically.

  4. Monitor the console output for any messages or logs generated by the bot.

Testing with Docker

  1. Make sure you have Docker installed.
  2. Test building the image docker build .
  3. Record the image id
  4. Download the trial server for dots at hyxor.com/akama/dots docker pull registry.hyxor.com/akama/dots
  5. Run the game container docker run -p 9090:9090 -p 9091:9091 -e LEVEL=level_one --hostname coresrv registry.hyxor.com/akama/dots
  6. Run the player docker run <ID>

Customizing the Strategy

The game strategy is implemented in the makeMove function inside the index.js file. You can modify this function to implement your own strategy based on the current game state.

The gameState object contains the following properties:

tick: The current tick of the game.

players: An array of player names.

systems: A map of system objects, where the keys are system IDs and the values are system objects.

fleets: A map of fleet objects, where the keys are a combination of origin and goal system IDs, and the values are fleet objects.

stats: An object containing game statistics.

You can access the game state data from the gameState object and use the sendMove function to send moves to the server.

About

A small nodejs scaffold for playing hyxor.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published