Git Product home page Git Product logo

go-lanty's Introduction

Lanty server component

Go

Hey hey, gamers! ๐ŸŽฎ๐Ÿ‘พ

So, guess what? There's this awesome new app called Lanty, and let me tell ya, it's like the ultimate tool for LAN parties! Picture this: you're at your buddy's place, everyone's hyped to game together, and boom! Lanty swoops in to save the day!

First off, Lanty hooks you up with all the games you need. No more hunting around for CDs or downloads. It's all right there, ready to roll.

And get this โ€“ setting up game servers? Piece of cake! With Lanty, it's like hitting the "easy" button. Just a few clicks, and boom, you're hosting your own server like a pro.

Now, remember how sometimes it's a pain trying to figure out who's who at a LAN party? Not anymore! Lanty's got your back with easy-peasy participant discovery. Plus, it automatically picks up and shares IP addresses, so no more hassle!

So, what are you waiting for? Grab Lanty, gather your crew, and let the LAN party madness begin! ๐Ÿš€๐ŸŽ‰

๐Ÿš€ Ready to Get Lanty Up and Running? Let's Do This! ๐Ÿš€

Alright, fellow gamers, it's time to dive into the installation process for Lanty! Here's what you gotta do:

Step 1

Head on over to the latest release of the server application and grab that bad boy. Oh, and don't forget to snag the client application too, both with the same version, of course. We need 'em to be on the same page! ๐Ÿฆ–

Step 2

Once you've got those files, it's time to work some magic. Extract the server artifact like a pro and then slide that client zip artifact into the download directory of the server application. Easy peasy, right?

๐ŸŽ‰ Woohoo! You did it! ๐ŸŽ‰

Now give yourself a pat on the back because you, my friend, are now officially a Lanty pro! Get ready to level up your LAN party game and dive into some serious gaming fun. ๐ŸŽฎ๐Ÿ‘พ

๐ŸŒฑ Let's Get Lanty All Set Up and Ready to Roll! ๐ŸŒฑ

Before Lanty can start showcasing all those epic games to your clients, we've got a bit of setup to do. But don't worry, it's nothing you can't handle! Here's the lowdown:

๐Ÿ“ฆ Add game data ๐Ÿ“ฆ

Alrighty, first things first. We gotta get those game files zipped up and ready to roll. Pop each game files into a zip archive and toss the bad boys into the game-data folder. Oh, and remember to name the zip file with a slug so the server can find it later. (For example, if it's Call of Duty 4, you'd name it call-of-duty-4.zip)

โ— Pro Tip: Keep it clean! Zip those game files without any extra subfolders. We want 'em neat and tidy. โ—

โœ…                          โ›”
โ”œโ”€โ”€ call-of-duty-4.zip      โ”œโ”€โ”€ call-of-duty-4.zip
โ”‚   โ”œโ”€โ”€ Docs/               โ”‚   โ”œโ”€โ”€ subfolder/
โ”‚   โ”‚   โ”œโ”€โ”€ ...             โ”‚   โ”‚   โ”œโ”€โ”€ Docs/
|   โ”œโ”€โ”€ Mods/               |   |   |   โ”œโ”€โ”€ ...
|   |   โ”œโ”€โ”€ ...             |   |   โ”œโ”€โ”€ Mods/
โ”‚   โ”œโ”€โ”€ iw3mp.exe           โ”‚   |   |   โ”œโ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ ...                 โ”‚   |   โ”œโ”€โ”€ iw3mp.exe
                            |   |   โ”œโ”€โ”€ ...

๐Ÿ–ผ๏ธ Add game icon ๐Ÿ–ผ๏ธ

Next up, let's give those games some flair! Every game needs its own icon, right? Make sure it's a .png file, or else it won't get picked up. Drop those icons into the game-icon folder and rename 'em using the same slug as the game data zip files. (For example, if it's Call of Duty 4, you'd name it call-of-duty-4.png)

โš™๏ธ Add game config โš™๏ธ

Last but certainly not least, we need to add a configuration file for each game. These files are written using yaml, so get ready to flex those config muscles! Need help? Check out the game configuration files section for all the deets.

And there you have it, folks! Lanty is well on its way to becoming your ultimate LAN party wingman. Now go forth, add those games, and let the gaming adventures begin! ๐ŸŽฎ๐Ÿš€

๐ŸŽ‰ Woohoo! You are going above and beyond! ๐ŸŽ‰

And there you have it, fellow gamer! Lanty is poised and ready to elevate your LAN party experience to legendary status. So what are you waiting for? Dive in, unleash those gaming masterpieces, and let the fun times roll! Remember, with Lanty by your side, the gaming world is your oyster. ๐ŸŒŸ๐ŸŽฎ Let's game on! ๐Ÿš€๐Ÿ”ฅ

๐ŸŽฎ Ready to Get the Party Started with Lanty? Gogogo! ๐ŸŽฎ

Alrighty, once you've wrapped up the setup for Lanty, it's time to dive right into the action! Here's what you gotta do:

๐ŸƒRun Lanty ๐Ÿƒ

It's as simple as that โ€“ just fire up Lanty and you're good to go! No fuss, no muss, just pure gaming goodness awaits you.

โ˜๏ธ Download the Client โ˜๏ธ

Now, here's where the magic happens! Users can easily grab the client application by cruising over to http://<server-url>:<port>/download with their trusty web browser. A quick download will kick off, and all they gotta do is unzip and they're basically ready to roll! For more juicy details on how to use the client application like a pro, check out its README.

๐ŸŽฎ Let the LANParty Begin! ๐ŸŽฎ

With Lanty in your corner, it's time to crank up the excitement and let the LANParty madness commence! Gather your pals, fire up those games, and get ready for an epic gaming extravaganza like no other! Let's make some gaming memories that'll last a lifetime! ๐Ÿš€๐Ÿ”ฅ

๐Ÿ› ๏ธ Game Configuration Files ๐Ÿ› ๏ธ

Alright, let's get down to business with the nitty-gritty details of game configuration files for Lanty. This might sound a tad boring, but hey, it's essential stuff! Here's what you need to know.

Required Fields - Basic Configuration

At its core, a game configuration file is a yaml file containing a few essential fields:

  • Required

    • slug - A unique identifier for the game
    • name- A human-readable name for the game
    • client - Game startup information for launching the game and joining a server
      • executable - Relative path to the game's executable within the game folder
  • Optional

    • client
      • arguments - Command-line options for the game executable
        • seperator - Specifies how command-line options are separated and parsed
        • items - A list of individual command-line options
    • server - Game startup information for starting a server
      • executable - Relative path to the game's server executable within the game folder
      • arguments - Command-line options for the server executable
        • seperator - Specifies how command-line options are separated and parsed
        • items - A list of individual command-line options

๐Ÿ” Simple things first ๐Ÿ”

Alright, let's simplify things a bit. If a game doesn't have any command-line options available, then all you need is the following configuration file:

slug: "call-of-duty-4"
name: "Call of Duty 4"
client:
  executable: "iw3mp.exe"

slug

The slug serves as a unique identifier for each game. It should only contain lowercase characters, numerals, and dashes. This identifier is crucial for locating the game data zip file and game icon file.

name

The name field is a user-friendly string used to display the game's name to users.

client

The client section specifies the relative path within the game folder to the game's executable, used for launching the game and joining a server. Additionally, it can include command-line arguments for the executable. For more details on specifying arguments, check out the arguments section.

slug: "call-of-duty-4"
name: "Call of Duty 4"
client:
  executable: "iw3mp.exe"
  arguments:
    items:
    - ...

server

Now, let's talk about the server section. This part of the configuration file specifies the relative path within the game folder to the executable used for starting a server. It also includes any command-line arguments for the executable. For more detailed information, check out the arguments section.

slug: "call-of-duty-4"
name: "Call of Duty 4 - Modern Warfare"
client:
  executable: "iw3mp.exe"
server:
  executable: "iw3mp.exe"
  arguments:
    items:
    - ...

Alright, there you have it โ€“ the essential rundown on game configuration files for Lanty. It might not be the most thrilling read, but mastering these details will ensure smooth sailing in your gaming adventures.

๐Ÿ•ต๏ธโ€โ™‚๏ธ๐Ÿš€ Embarking on the Adventure of Configuration ๐Ÿš€๐Ÿ•ต๏ธโ€โ™‚๏ธ

Hold on tight, fellow explorer! We're diving deep into the realm of configuration, where only the bravest dare to tread. This section is for the experts, the trailblazers ready to conquer command-line complexities and emerge victorious.

Are you ready? Let's do this!

Specifying arguments

Welcome, fellow adventurer, to the realm of arguments โ€“ a crucial aspect of command-line configuration. Here, we wield the power to specify command-line arguments for an executable, shaping its behavior with precision and finesse.

But what exactly does this entail? Let's break it down:

  • arguments serves as our gateway to customizing the behavior of executables.
  • It comprises a global seperator, which acts as the default separator for each command-line argument.
  • This global seperator can be overridden by each individual command-line argument, providing flexibility and control.
  • Command-line arguments themselves are detailed under items, allowing for fine-grained configuration.

For a deeper understanding of seperator, consult the seperator section. Likewise, for comprehensive information on items, refer to the items section.

Prepare yourself, brave adventurer, for within the realm of arguments lies the key to unlocking limitless possibilities in command-line configuration. ๐Ÿš€๐Ÿ”ง

arguments:
  seperator:
    arguments: "?"
    argumentvalue: "="
  items:
  - name: "Server Base Argument"
    type: "base"
    mandatory: true
    argument: "server"
    seperator:
      arguments: " "
  - name: "Map"
    type: "enum"
    mandatory: true
    argument: ""
    seperator:
      argumentvalue: ""
    items:
      - name: "Arena [FFA]"
        value: "AOCFFA-Arena3_p"
      - ...

Specifying seperator

Diving into the Depths of seperator a fundamental component of command-line configuration. In this realm, we define how command-line arguments are parsed, setting the stage for seamless execution of our commands.

But what exactly does this entail? Let's uncover the secrets:

  • A seperator dictates how command-line arguments are separated and parsed.
  • It defines the delimiter between each command-line argument and specifies the delimiter between the argument and its value, if applicable.
  • The global seperator serves as the default for all command-line arguments, ensuring consistency in parsing.
  • If no global seperator is provided, the Space-Seperator ๐Ÿ‘พ will be utilized by default.
                                  ๐Ÿ‘พ Space-Seperator
seperator:                        seperator:
  arguments: "?"                    arguments: " "
  argumentvalue: "="                argumentvalue: " "

Individual Override per Item

Each command-line argument has the power to override the global seperator, granting autonomy in parsing. Take control by specifying the seperator for each item, as demonstrated below:

arguments:
  seperator:
    arguments: "?"
    argumentvalue: "="
  items:
  - type: "base"
    argument: "server"
    seperator:
      arguments: "+"

Specifying items

Let's unveil the mysteries of items. Items define a list of command-line arguments, each serving a specific purpose and contributing to the overall functionality of the executable.

But what secrets lie within items? Let's uncover the details:

Various predefined types are at your disposal, each tailored to specific use cases. All types share common required and optional fields, ensuring consistency in configuration:

  • Required

    • type - Indicates the type of command-line argument.
    • argument - Defines the command-line argument itself.
  • Optional

    • name - Provides a human-friendly name for the command-line argument.
    • mandatory - Determines if this command-line argument is compulsory.
    • disabled - Indicates whether this command-line argument is active during parsing.
    • seperator - Sets the specific seperator to apply to this command-line argument, thereby overriding the global seperator.

With items at your disposal, you are poised to embark on a journey of command-line mastery, shaping the behavior of your executable with precision and expertise. ๐Ÿš€๐Ÿ”ง

type: base

We encounter command-line directives of type base as stand alone, devoid of any accompanying values. A base argument serves as a fundamental building block, allowing for streamlined execution of specific commands. Particularly useful is the scenario where a server can be launched using the same executable as the game client, contingent upon the presence of a command-line directive such as server.

name: "Name to display"
type: "base"
mandatory: true
disabled: false
argument: "server"
seperator:
  arguments: "?"

type: string

Command-line arguments of type string expand upon the foundation laid by base arguments. Distinguishing itself, a string argument boasts an essential addition: a mandatory attribute named default. This attribute serves as a pivotal tool, allowing for the specification of a default value.

name: "String Argument"
type: "string"
mandatory: false
disabled: true
argument: "+set sv_hostname"
seperator:
  arguments: "?"
  argumentvalue: "="
default: "lanserver"

type: integer

Command-line arguments of type integer build upon the foundation established by string arguments. Setting itself apart, an integer argument introduces essential enhancements, including two mandatory fields: minvalue and maxvalue. These fields play a crucial role in validating the range of possible values assigned to the command-line argument.

name: "Integer Argument"
type: "integer"
mandatory: false
disabled: true
argument: "+set sv_clients"
seperator:
  arguments: "?"
  argumentvalue: "="
default: 32
minvalue: 0
maxvalue: 64

type: float

Command-line arguments of type float build upon the foundation established by string arguments. Setting itself apart, an float argument introduces essential enhancements, including two mandatory fields: minvalue and maxvalue. These fields play a crucial role in validating the range of possible values assigned to the command-line argument.

name: "Float Argument"
type: "float"
mandatory: false
disabled: true
argument: "+set g_gravitiy"
seperator:
  arguments: "?"
  argumentvalue: "="
default: 15.0
minvalue: 1.0
maxvalue: 99.99

type: boolean

Command-line arguments of type boolean extend beyond the capabilities of string arguments. Distinguishing itself, a boolean argument introduces an optional attribute: values. This attribute enhances flexibility by allowing the specification of potential values associated with the command-line argument.

name: "Boolean Argument"
type: "boolean"
mandatory: false
disabled: true
argument: "+set dedicated"
seperator:
  arguments: "?"
  argumentvalue: "="
default: true
values:
  type: custom
  true: TRue
  false: FaLse
values

The values field determines the specific values assigned to true and false for a boolean argument. It consists of the following attributes:

  • Required

    • [type] - Determines the data type to be utilized for the boolean values, which may be selected from the following options: bool, boolupper, boolupperfull, integer, or custom.
  • Optional

    • [true] - Designates the value attributed to true, contingent upon the type being specified as custom.
    • [false] - Identifies the value assigned to false, applicable only when the type is set to custom.
type true false
bool true false
boolupper True False
boolupperfull TRUE FALSE
integer 1 0
custom - -
values:
  type: custom
  true: "TRue"
  false: "FaLse"

type: enum

Command-line arguments of type enum extend beyond the capabilities of base arguments. A enum argument introduces an essential addition: a mandatory attribute known as items. This attribute houses a collection of key-value pairs, each representing a specific option. This functionality proves invaluable for scenarios where arguments must be restricted to predefined values, such as selecting maps.

Moreover, the optional name field provides an opportunity for customization, allowing for user-friendly labels to be displayed in the user interface.

name: "Enum Argument"
type: "enum"
mandatory: true
disabled: false
argument: "+map"
seperator:
  arguments: "?"
  argumentvalue: "="
items:
  - name: "Ambush"
    value: "mp_convoy"
  - name: "Backlot"
    value: "mp_backlot"
  - name: "Bloc"

type: connect

Command-line arguments of type connect dictate how a game establishes a direct connection to a game server via command-line, but exclusively for use within the client field. The primary objective of a connect argument is therefore to specify the connection mechanism between the game client and the game server. To achieve this, the character ? functions as a wildcard placeholder for the game server's IP address.

type: "connect"
argument: "+connect ?"

Configuration โš™๏ธ

Important configuration can be set via the settings.yaml file.

Config Description
port Port of the http server to listen on
game-config-directory Directory of the game configuration files
game-file-directory Directory of the game files
game-icon-directory Directory of the game icon files

โŒจ๏ธ Command-line โŒจ๏ธ

Argument Type Default Example Description
loglevel string info lanty-server --loglevel debug Sets the log level (disable, trace, debug, info, warning, error, panic, fatal)
logenablefile boolean - lanty-server --logenablefile Enables logging to file
logfile string lanty.log lanty-server --logfile lanty.log Sets the log filename
logdir string log lanty-server --logdir log Sets the log directory
logbackups integer 0 lanty-server --logbackups 10 Sets the number of old logs to remain
logfilesize integer 10 lanty-server --logfilesize 25 Sets the size of the logs before rotating to new file
logage integer 0 lanty-server --logage 1 Sets the maximum number of days to retain old logs
port integer 8090 lanty-server --port 8091 Port of the http server to listen on
graceful-shutdown integer 10 lanty-server --graceful-shutdown 25 Timeout in seconds to wait for a graceful shutdown of the server
game-config-dir string game-config lanty-server --game-config-dir config Directory of the game configuration files
game-file-dir string game-data lanty-server --game-file-dir data Directory of the game files

๐Ÿ› ๏ธ Building from Source ๐Ÿฅด

Before diving into the installation process, let's first tackle the task of building from source. Here's your roadmap:

  • Clone the Repository: Begin by cloning this repository to your local environment.
  • Run the Commands: Once cloned, execute the following commands in your terminal:
$ go build -o ./build/lanty-server.exe -v ./cmd
$ cp ./settings.yaml ./build
$ mkdir ./build/game-config ./build/game-icon ./build/game-data ./build/download
  • Proceed to Installation: With the build process complete, you're now ready to move on to the installation section and continue setting up Lanty. ๐Ÿฆ–

โš”๏ธ Cross-compiling on Linux for Windows

To cross-compile on Linux for Windows, all you need is a cross-compiler. Here's how to get started:

  • Set Up the Compiler: Begin by setting up your cross-compiler. We recommend using MinGW-w64, but you're free to use any cross-compiler of your choice.
  • Run the Commands: Once your cross-compiler is set up, execute the following commands in your terminal:
๐ŸšจAttentione: If you opt to use a cross-compiler other than MinGW-w64, you'll need to adjust the CC variable to align with your compiler.๐Ÿšจ
$ GOOS=windows CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-win32 go build -o ./build/lanty-server.exe -v ./cmd
$ cp ./settings.yaml ./build
$ mkdir ./build/game-config ./build/game-icon ./build/game-data ./build/download

go-lanty's People

Contributors

seternate avatar

Watchers

 avatar

go-lanty's Issues

[FEATURE] Use configuration library

Feature Request

User Story

As a Developer,
I would like to use a configuration library instead of my own implementation,
so that I can easily managed configuration that is is set via config-file, env-variables, command-line arguments etc.

Acceptance Criteria

  • Code maintainability increased
  • Code readability increased
  • Configuration is picked up from different places and they overwrite each other (the higher one overwrites the lower one)
    1. config-file
    2. env variables
    3. command-line argument

[FEATURE] Downloaded client app will be pre-configured with server URL

Feature Request

User Story

As a End-User,
I want to have the downloaded client application pre-configured with the server URL,
so that I do not need to enter the server URL again after using the URL to download the client.

Acceptance Criteria

  • Server URL is present in client configuration file after being downloaded

[FEATURE] Check that all game slugs are unique when loading the games

Feature Request

User Story

As a Developer,
I want to validate at the start of the application (when loading the games) that the games have unique slugs,
so that I can not load different game definitions with the same slug and run into the problem that the wrong game definition is served through the REST interface.

Acceptance Criteria

  • Loading different games with the same slug returns an error
  • The error should be fatal and kill the application
  • Proper error logging in place
    • both file names are displayed
    • state that they both have the same slug

[FEATURE] Add OpenAPI documentation

Feature Request

User Story

As a Developer,
I want to have documentation about the REST interface provided,
so that I know how to use it.

Acceptance Criteria

  • Document the REST interface available to the user
  • Use OpenAPI for the documentation
  • Render it also as Markdown and upload to git repo as well (if possible)

[FEATURE] Check for slug naming convention

Feature Request

User Story

As a Developer,
I want to validate at the start of the application (when loading the games) that the game slugs adhere to the slugs naming convention,
so that I can be confident in the application I will not have malformed slugs.

Acceptance Criteria

  • Loading games with malformed slugs returns an error
  • The error should be fatal and kill the application
  • Proper error logging in place
    • file name displayed
    • state that the slug is malformed
    • display regex showing the naming convention

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.