Skip to content

Commit

Permalink
Add Bootstrap.bat to ease installation
Browse files Browse the repository at this point in the history
- Also updated readme
  • Loading branch information
Codinablack committed Dec 25, 2024
1 parent 9ca0ead commit ceaeb5c
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 30 deletions.
47 changes: 17 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
Black Tek Server [![Linux Build](https://github.com/Black-Tek/BlackTek-Server/actions/workflows/linux_build_runner.yml/badge.svg?branch=master)](https://github.com/Black-Tek/BlackTek-Server/actions/workflows/linux_build_runner.yml) [![Windows Build](https://github.com/Black-Tek/BlackTek-Server/actions/workflows/windows_build_runner.yml/badge.svg)](https://github.com/Black-Tek/BlackTek-Server/actions/workflows/windows_build_runner.yml)
===============
# Black Tek Server [![Linux Build](https://github.com/Black-Tek/BlackTek-Server/actions/workflows/linux_build_runner.yml/badge.svg?branch=master)](https://github.com/Black-Tek/BlackTek-Server/actions/workflows/linux_build_runner.yml) [![Windows Build](https://github.com/Black-Tek/BlackTek-Server/actions/workflows/windows_build_runner.yml/badge.svg)](https://github.com/Black-Tek/BlackTek-Server/actions/workflows/windows_build_runner.yml)

Black Tek Server is a free and open-source MMORPG server emulator written in C++. It is a fork of the [TheForgottenServer](https://github.com/otland/forgottenserver) project. To connect to the server, you can use [OTClient Redemption](https://github.com/mehah/otclient).

### Getting Started
If you don't want to bother with source code or compiling. You can download from our release sections the binaries with everything needed ready to go.
## What is BlackTek Server?
__________________
**BlackTek Server** is an open source **2D Top Down MMORPG Game Server**, with tailor-made gameplay and tile based movement, developed in modern C++.

#### Compiling
## What is the point of BlackTek Server?
_______________
**BlackTek Server** is intended to provide a user-friendly experience building 2D MMORPG's in a _**rapid development environment**_. Ultimately the goal is to create a user experience that removes the barrier between _**content creator**_ and _**programmer**_.

For windows users looking for the quickest way to get started with BlackTek Server, you can follow the steps provided [here](https://otland.net/threads/tutorial-blacktek-from-nothing-to-fully-installed-with-aac-on-windows.289572/)
## What sparked this idea?
__________________

Otherwise please follow the steps provided below:
BlackTek Server's origins started first with [OpenTibia](https://github.com/opentibia/server) and later [The Forgottenserver](https://github.com/otland/forgottenserver) , both are game servers designed to emulate a popular 2D MMORPG known as Tibia. <br>
<br> Having had my fun growing up tinkering with OpenTibia servers like TFS, I always wished they were not built so strict (explicitly emulating tibia), and allowed much more custom types of things. Since that never happened, I decided to do it myself! <br>
<br> BlackTek Server's starting codebase is [The Forgottenserver 1.4.2](https://github.com/otland/forgottenserver/releases/tag/v1.4.2), and BlackTek Server [1.0]() and [1.1]() were built to be almost completely backwards compatible with TFS 1.4.2.

To compile you will need to install and integrate vcpkg.
You can find detailed instructions for [Windows](https://github.com/microsoft/vcpkg?tab=readme-ov-file#quick-start-windows) and [Unix](https://github.com/microsoft/vcpkg?tab=readme-ov-file#quick-start-unix) based operating systems.
## Getting Started
____________
If you wish to get started immediately you may download all the binaries along with the datapack and other required files from our [Release Section](https://github.com/Black-Tek/BlackTek-Server/releases).

Once you have successfully installed vcpkg, and integrated the installation, you will need to download the newest [premake](https://github.com/premake/premake-core.git) from the dev branch (must use dev branch, its the one hyperlinked).

Please follow instructions on how to compile premake for your Operating System. Once you have premake compiled, place the binary in BlackTek-Server's folder. Then run premake via terminal/command line/bash using the following command:

Windows:
```premake5 vs2022```

Linux:
```./premake5 gmake2```

OSX aka Mac:
```premake5 xcode4```

This will generate your project files.

If you are using linux, please ensure you have manifest mode enabled.
You can find more information about manifest mode [here.](https://learn.microsoft.com/en-us/vcpkg/concepts/manifest-mode)

### Support
### Issues
Getting setup for compiling can be done the easy way by running either the ```bootstrap.bat```(Windows) or ```bootstrap.sh```(Linux). <br>
<br>If you prefer compiling manually, or you are looking for a more thorough getting started guide, you can find the information needed, based on your specific needs in our wiki [here](https://github.com/Black-Tek/BlackTek-Server/wiki/Getting-Started#compiling).<br>
178 changes: 178 additions & 0 deletions bootstrap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
@echo off
setlocal enabledelayedexpansion

set projectDir=%CD%

echo ::::::::::::::::::::::::::::::::::::::
echo ::::::::::::::::::::::::::::::::::::::
echo ::::: Black Tek Server Bootstrap :::::
echo ::::: (for windows) :::::
echo ::::::::::::::::::::::::::::::::::::::
echo ::::::::::::::::::::::::::::::::::::::


:: Check if vcpkg is installed first.
where vcpkg >nul 2>&1
if %ERRORLEVEL%==0 (
echo Vcpkg installation has been found!
echo skipping vcpkg installation..
goto premake_input
) else (
echo Vcpkg installation has not been detected!
echo moving forward with vpckg installation...
)

:vcpkg_input
echo Please provide the path to the directory you wish to store your vcpgk installation!
echo Warning!! This folder MUST ALREADY EXIST, or it won't be accepted.
echo Example input: C:\Packages\vcpkg
set /p VCPKG_INSTALL_PATH=Path:

:: Remove quotes if user included them
set VCPKG_INSTALL_PATH=!VCPKG_INSTALL_PATH:"=!

:: Check if path exists
if not exist "!VCPKG_INSTALL_PATH!" (
echo Error: The specified path does not exist.
echo Please enter a valid path.
goto vcpkg_input
)

cd "!VCPKG_INSTALL_PATH!"

:: Download and extract vcpkg
echo Downloading vcpkg...
curl -L "https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip" -o vcpkg.zip || (
echo Failed to download vcpkg.
exit /b
)
tar -xf vcpkg.zip
del vcpkg.zip
ren "vcpkg-master" "vcpkg"

:: Setup vcpkg
echo Setting up vcpkg...
cd "!VCPKG_INSTALL_PATH!\vcpkg"
call bootstrap-vcpkg.bat || (
echo Failed to bootstrap vcpkg.
exit /b
)
vcpkg integrate install || (
echo Failed to integrate vcpkg.
exit /b
)
cd "!projectDir!"

:premake_input
echo Please enter a path to a folder for storing premake
echo Warning: This folder must already exist, or it won't be accepted.
echo Example: C:\premake
set /p PREMAKE_PATH=Path:

set PREMAKE_PATH=!PREMAKE_PATH:"=!

:: Check if path exists
if not exist "!PREMAKE_PATH!" (
echo Error: The specified path does not exist.
echo Please enter a valid path.
goto premake_input
)

cd "!PREMAKE_PATH!"

:: Download and extract premake.
:: We are currently locked into a version of premake
:: which does not fail to build using its bootstrap.bat
:: but also supports our needed features.
echo Downloading premake...
curl -L "https://github.com/premake/premake-core/archive/490686ceb24b29f16c1ec817ed05c07c5cce89c6.zip" -o premake.zip || (
echo Failed to download premake.
exit /b
)
tar -xf premake.zip
del premake.zip
ren "premake-core-490686ceb24b29f16c1ec817ed05c07c5cce89c6" "premake-core"
set premakeBin=!PREMAKE_PATH!\premake-core\bin\release\premake5.exe

:: Build premake
echo Building premake...
cd premake-core
cmd /c Bootstrap.bat || (
echo Premake build failed.
exit /b
)
cls

:: Copy premake5.exe to BlackTek-Server
echo Copying premake5.exe...
if not exist "!premakeBin!" (
echo Source file does not exist: "!premakeBin!"
exit /b
)
if not exist "!projectDir!" (
echo Destination directory does not exist: "!projectDir!"
exit /b
)
copy "!premakeBin!" "!projectDir!"
if errorlevel 1 (
echo Failed to copy premake5.exe.
echo Error level: %errorlevel%
echo From: "!premakeBin!"
echo To: "!projectDir!"
exit /b
)

:select_vs_version
cls
echo Select Visual Studio version:
echo [1] Visual Studio 2022
echo [2] Visual Studio 2019
echo [3] Visual Studio 2015
echo [4] Visual Studio 2013
echo [5] Visual Studio 2012
echo.

set /p choice="Enter number (1-5): "

:: Set the vs_version variable based on user choice
if "%choice%"=="1" (
set "vs_version=vs2022"
) else if "%choice%"=="2" (
set "vs_version=vs2019"
) else if "%choice%"=="3" (
set "vs_version=vs2015"
) else if "%choice%"=="4" (
set "vs_version=vs2013"
) else if "%choice%"=="5" (
set "vs_version=vs2012"
) else (
echo Invalid selection. Please try again.
timeout /t 2 >nul
goto select_vs_version
)

:: Confirm selection
echo.
echo You selected Visual Studio %vs_version%
echo.
set /p confirm="Is this correct? (Y/N): "
if /i not "%confirm%"=="Y" goto select_vs_version

:: Run premake with selected version
echo.
echo Generating solution files for %vs_version%...
cd !projectDir!
cmd /c premake5.exe %vs_version%

if errorlevel 1 (
echo Failed to generate solution files.
echo Error level: %errorlevel%
pause
exit /b 1
)

echo Solution files generated successfully!
echo Setup complete. BlackTek has been successfully installed!
pause
exit
endlocal

0 comments on commit ceaeb5c

Please sign in to comment.