Quick Start
Start your Server and first Package in under 10 minutes!
Step 1: Download the Server
You have two options for downloading HELIX server:
- Use the executable (.exe) already located at
HELIX/Server/HELIXGameServer.exe
(if you downloaded the base game). - Or download HELIX™ Dedicated Server tool from Itch.
Step 2: Creating a Basic Package
After downloading the server, let's create a basic Package. We will use the handy CLI tool to speed up the proccess:
For that, open a terminal in your server folder and run the following command:
- Windows
- Linux
./HELIXGameServer.exe --cli add package my-awesome-package
./HELIXGameServer.sh --cli add package my-awesome-package
This command will run the CLI to interactively create your new package:
[display] Please enter the Package Name: (my-awesome-package)
[display] Please enter the Package Author: ()
[display] Please enter the Package Version: (0.0.1)
[display] Please enter the Package Image URL: ()
[display] Please enter the Package Author: ()
[display] Please enter the Package Type: (game-mode)
After that, you will end up with a new folder inside Packages/
called my-awesome-package/
. Inside that there will be 3 other folders: Server/
, Client/
and Shared/
, and a package file Package.toml
.
Additionally, if this was the first time running the CLI, it will also create a Config.toml
file at the root of the server folder executable. This is the server configuration file!
Step 3: Adding Script functionalities
Open the file my-awesome-package/Server/Index.lua
in your preferred editor (we recommend using VSCode), and let's edit our first script. Let's spawn some Props!
-- Let's print to Console a friendly message
Console.Log("Loading some Props =D")
-- Let's spawn some props
prop_table = Prop(Vector(200, 0, 0), Rotator(0, 0, 0), "helix::SM_WoodenTable")
prop_chair = Prop(Vector(400, 200, 0), Rotator(0, 0, 0), "helix::SM_WoodenChair")
prop_tire = Prop(Vector(600, 0, 0), Rotator(0, 0, 0), "helix::SM_TireLarge")
Step 4: Starting the server
Now let's start the server with the package you just created! For that, simply double click or launch the server from the terminal:
- Windows
- Linux
./HELIXGameServer.exe
./HELIXGameServer.sh
After starting it, your console will display something like this:
[display] HELIX (C) Copyright HELIX. All Rights Reserved.
[display] Starting Server at Port: 7777. Version: 0.0.0. Map: 'helix::TestingMap'.
[display] Loading Package 'my-awesome-package'...
[script] Loading some Props =D
[display] Package 'my-awesome-package' loaded.
[display] Loading Package 'map-package'...
[display] Package 'map-package' loaded.
You can see it loaded your package and outputted the text "Loading some Props =D" on it.
Step 4: Join your server
Now let's see the results in-game! Open HELIX and connect to localhost at 127.0.0.1:7777
.
After connecting, you will be a flying pawn and will be able to see the props spawned! 😁
Extra Step: Spawning Characters
Spawning a Character for the Player
You may have noticed you are just a wandering soul flying around, let's give you some flesh! For that, we will need to interact with some Events.
Let's append some code in your Index.lua
, to spawn a Character when the Player join the server:
-- Function to spawn a Character to a player
function SpawnCharacter(player)
-- Spawns a Character at position 0, 0, 0 with default's constructor parameters
local new_character = Character(Vector(0, 0, 0), Rotator(0, 0, 0), "helix::SK_Male")
-- Possess the new Character
player:Possess(new_character)
end
-- Subscribes to an Event which is triggered when Players join the server (i.e. Spawn)
Player.Subscribe("Spawn", SpawnCharacter)
-- Iterates for all already connected players and give them a Character as well
-- This will make sure you also get a Character when you reload the package
Package.Subscribe("Load", function()
for k, player in pairs(Player.GetAll()) do
SpawnCharacter(player)
end
end)
To apply your changes, run the command in the server console: package reload all
. This will also live reload the packages and apply the changes immediatelly.
Destroying the Character when the Player leaves the Server
Note that the Character isn't destroyed automatically when the Player disconnects. For that, we will need to Subscribe for when the Player leaves the server (Destroy
event) and manually destroying the Character.
Append this code:
-- When Player leaves the server, destroy it's Character
Player.Subscribe("Destroy", function(player)
local character = player:GetControlledCharacter()
if (character) then
character:Destroy()
end
end)
To apply your changes, run the command in the server console: package reload all
.
Conclusion
- How to setup your Server
- How to setup a simple Package
- Basic interaction with entity Events
- Spawning Props
- Spawning & Destroying Characters