Server

Configuration

Compile and Run on Linux

Prerequisits Assuming Debian/Ubuntu

For Ubuntu 22.04, sudo add-apt-repository ppa:dotnet/backports

For Debian or other qurirky setups:

wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

Then continue installation:

sudo apt-get update && sudo apt-get install -y dotnet-sdk-10.0

Get Basis

Change to the folder you wish to download Basis to, and execute the following command:

git clone -b long-term-support-20260425 https://github.com/BasisVR/Basis

Build Basis Server

Open a new terminal and cd /to/directory/with/Basis Server/, i.e. cd Basis/Basis\ Server

dotnet restore

Then build, with either:

dotnet build (for debug)

or

dotnet build --configuration Release (For release)

Executing

Navigate to the BasisServerConsole directory (Something like /BasisServerConsole/bin/Debug/net10.0/BasisNetworkConsole) and run:

dotnet .\BasisNetworkConsole.dll

:::tip For More Targeted Linux Release

You may compile with the following:

dotnet publish -f net10.0 --self-contained --os Linux

The --self-contained switch is added to allow running on a OS without dotnet installed.

If you compile via this method (Or your build targeted the system) are on a you should be able to run

./BasisNetworkConsole

from BasisServerConsole/bin/Debug/net10.0/BasisNetworkConsole.

:::

Firewall

You may want to open ports:

  • 1234/tcp
  • 10666/tcp
  • 4296/udp


Configuration Files

The first time you run the server a variety of config files and structure will be created in the directory the server exe rests in.

File/FolderDescription
config.xmlMain configuration file for the server.
initialresources/This directory contains world and object files the server will load upon request.
Log/Folder where server logs are stored.
admins.xmlList of users with admin privileges.
banned_players.xmlList of banned player accounts.

Config.xml

VariableDefaultDescription
PeerLimit65535Maximum number of connected peers.
SetPort4296UDP port the server listens on.
UseNativeSocketstrueUse OS-native socket calls instead of the managed path.
NatPunchEnabledfalseEnable NAT punch-through for peer introduction.
PingInterval1500Interval between keep-alive pings, in milliseconds.
DisconnectTimeout30000Time with no response before disconnecting a peer, in milliseconds.
SimulatePacketLossfalseArtificially drop outgoing packets for testing.
SimulateLatencyfalseArtificially delay packets for testing.
SimulationPacketLossChance10Packet-loss percentage when packet-loss simulation is enabled.
SimulationMinLatency50Minimum added latency, in milliseconds.
SimulationMaxLatency150Maximum added latency, in milliseconds.
ReconnectDelay500Time before attempting reconnect.
MaxConnectAttempts10Max number of reconnect attempts.
ReuseAddresssfalseSocket reuse option; note the field spelling.
DontRoutefalseSocket routing option.
EnableStatisticstrueCollect transport statistics for health/status reporting.
IPv6EnabledtrueEnable IPv6 dual-stack socket support.
MtuOverride0Force a fixed MTU; 0 disables override.
MtuDiscoverytrueEnable path-MTU discovery.
DisconnectOnUnreachablefalseDisconnect on ICMP unreachable.
AllowPeerAddressChangetrueAllow a peer endpoint to change mid-session.
HasFileSupporttrueEnables writing logs, moderation lists, auth identity data, and other disk-backed files.
HealthCheckHostlocalhostHost/interface used for health checks. Use * to bind to any interface.
HealthCheckPort10666TCP port used for health checks.
HealthPath/healthPath to health check endpoint.
BSRSMillisecondDefaultInterval50Base send interval in milliseconds for the server reduction system.
BSRBaseMultiplier1Base multiplier applied before distance scaling.
BSRSIncreaseRate0.005How quickly send intervals grow with distance.
BSRSlowestSendRate2.55Slowest send-rate floor handed to clients for distant peers.
HighQualityDistance3Distance threshold for high-quality avatar sync.
MediumQualityDistance10Distance threshold for medium-quality avatar sync.
LowQualityDistance20Distance threshold for low-quality avatar sync.
OverrideAutoDiscoveryOfIpvfalseBind exactly the configured addresses instead of auto-discovering IP version.
IPv4Address0.0.0.0IPv4 bind address.
IPv6Address::IPv6 bind address.
Passworddefault_passwordServer access password.
UseAuthtrueEnable or disable password authentication.
UseAuthIdentitytrueRequire DID identity verification when auth is enabled.
BasisUserRestrictionModeNormalPlayer join restriction mode: Normal, BlackList, or WhiteList.
HowManyDuplicateAuthCanExist2Number of simultaneous connections allowed for the same auth identity.
AuthValidationTimeOutMiliseconds9000Timeout for auth validation, in milliseconds.
EnableConsoletrueEnable the interactive server console.
DisableWriteUnlessAdminPersistentFlagtrueReject persistent key/value writes unless the caller is an admin.
DisableReadUnlessAdminPersistentFlagfalseReject persistent key/value reads unless the caller is an admin.
UseNetworkFinalCompressionfalseEnable final network compression pass.
EnableBSRProfilingfalseEmit server reduction system profiling output.
DisallowHeadlessfalseReject headless clients from connecting.
AvatarsLockedfalseBlock avatar loading for users without bypass permission.
PropsLockedfalseBlock prop loading for users without bypass permission.
WorldsLockedtrueBlock world loading for users without bypass permission.
Any environment variable whose name matches a public config field overrides that field at launch.

Authentication Settings

<UseAuth>true</UseAuth> 

Meant to be used for turning off auth all together.

<UseAuthIdentity>true</UseAuthIdentity>

Enables disable DID auth provider.

<BasisUserRestrictionMode>Normal</BasisUserRestrictionMode>

Not finished yet. Admin moderation.

<HowManyDuplicateAuthCanExist>2</HowManyDuplicateAuthCanExist>

How many people can connect with the same Auth credentials.

Example Config.xml

The default settings you may find in the config.xml:

config.xml
<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <PeerLimit>65535</PeerLimit>
  <SetPort>4296</SetPort>
  <UseNativeSockets>true</UseNativeSockets>
  <NatPunchEnabled>false</NatPunchEnabled>
  <PingInterval>1500</PingInterval>
  <DisconnectTimeout>30000</DisconnectTimeout>
  <SimulatePacketLoss>false</SimulatePacketLoss>
  <SimulateLatency>false</SimulateLatency>
  <SimulationPacketLossChance>10</SimulationPacketLossChance>
  <SimulationMinLatency>50</SimulationMinLatency>
  <SimulationMaxLatency>150</SimulationMaxLatency>
  <ReconnectDelay>500</ReconnectDelay>
  <MaxConnectAttempts>10</MaxConnectAttempts>
  <ReuseAddresss>false</ReuseAddresss>
  <DontRoute>false</DontRoute>
  <EnableStatistics>true</EnableStatistics>
  <IPv6Enabled>true</IPv6Enabled>
  <MtuOverride>0</MtuOverride>
  <MtuDiscovery>true</MtuDiscovery>
  <DisconnectOnUnreachable>false</DisconnectOnUnreachable>
  <AllowPeerAddressChange>true</AllowPeerAddressChange>
  <HasFileSupport>true</HasFileSupport>
  <HealthCheckHost>localhost</HealthCheckHost>
  <HealthCheckPort>10666</HealthCheckPort>
  <HealthPath>/health</HealthPath>
  <BSRSMillisecondDefaultInterval>50</BSRSMillisecondDefaultInterval>
  <BSRBaseMultiplier>1</BSRBaseMultiplier>
  <BSRSIncreaseRate>0.005</BSRSIncreaseRate>
  <BSRSlowestSendRate>2.55</BSRSlowestSendRate>
  <HighQualityDistance>3</HighQualityDistance>
  <MediumQualityDistance>10</MediumQualityDistance>
  <LowQualityDistance>20</LowQualityDistance>
  <OverrideAutoDiscoveryOfIpv>false</OverrideAutoDiscoveryOfIpv>
  <IPv4Address>0.0.0.0</IPv4Address>
  <IPv6Address>::</IPv6Address>
  <Password>default_password</Password>
  <UseAuth>true</UseAuth>
  <UseAuthIdentity>true</UseAuthIdentity>
  <BasisUserRestrictionMode>Normal</BasisUserRestrictionMode>
  <HowManyDuplicateAuthCanExist>2</HowManyDuplicateAuthCanExist>
  <AuthValidationTimeOutMiliseconds>9000</AuthValidationTimeOutMiliseconds>
  <EnableConsole>true</EnableConsole>
  <DisableWriteUnlessAdminPersistentFlag>true</DisableWriteUnlessAdminPersistentFlag>
  <DisableReadUnlessAdminPersistentFlag>false</DisableReadUnlessAdminPersistentFlag>
  <UseNetworkFinalCompression>false</UseNetworkFinalCompression>
  <EnableBSRProfiling>false</EnableBSRProfiling>
  <DisallowHeadless>false</DisallowHeadless>
  <AvatarsLocked>false</AvatarsLocked>
  <PropsLocked>false</PropsLocked>
  <WorldsLocked>true</WorldsLocked>
</Configuration>

Loadable Configuration Files

You may setup world and object files to load on demand. These are the files you place in the InitialResources folder.

Note that the remote urls you use must be served from a proper server that supports chunking. Any modern server should do this but simple local dev servers may not.

To upload something

One avenue you can use to test out a new scene is to create a scene in Unity, export the scene as a BEE file. Upload that BEE file to a server that supports HTTP, then, place the URL in CombinedURL, and get the password from dontuploadmepassword.txt and place it in UnlockPassword.

VariableDefinition
ModeMode of the configuration: 0 = Game object, 1 = Scene.
LoadedNetIDA Network ID: Server keeps a list of Network Objects that Clients can query and spawn with this value as a reference.
UnlockPasswordPassword required to unlock or access the resource.
CombinedURLURL to the .BEE file
IsLocalLoadIndicates whether the resource is loaded locally (true) or from the internet (false).
PositionXX-axis world position of the object.
PositionYY-axis world position of the object.
PositionZZ-axis world position of the object.
QuaternionXX component of the object's rotation (quaternion).
QuaternionYY component of the object's rotation (quaternion).
QuaternionZZ component of the object's rotation (quaternion).
QuaternionWW component of the object's rotation (quaternion).
ScaleXX-axis scale factor.
ScaleYY-axis scale factor.
ScaleZZ-axis scale factor.
PersistIf the player that spawned the object leaves the server does the object continue to exist?

Example Configuration

BasisLoadableConfiguration Example
<BasisLoadableConfiguration>

    <!-- Mode of the configuration: Mode  0 = Game object, 1 = Scene -->
    <Mode>0</Mode>

    <!-- A Network ID: Server keeps a list of Network Objects that Clients can query and spawn with this value. -->
    <LoadedNetID></LoadedNetID>

    <!-- Unlock password -->
    <UnlockPassword>ffee4439eff</UnlockPassword>

    <!-- Combined URL link to BEE file -->
    <CombinedURL>https://www.example.com/2lkj23j.BEE</CombinedURL>

    <!-- Does this resource exist on the internet or in the client? -->
    <IsLocalLoad>false</IsLocalLoad>

    <!-- Position values -->
    <PositionX>0</PositionX>
    <PositionY>0</PositionY>
    <PositionZ>0</PositionZ>

    <!-- Quaternion values -->
    <QuaternionX>0</QuaternionX>
    <QuaternionY>0</QuaternionY>
    <QuaternionZ>0</QuaternionZ>
    <QuaternionW>1</QuaternionW>

    <!-- Scale values -->
    <ScaleX>1</ScaleX>
    <ScaleY>1</ScaleY>
    <ScaleZ>1</ScaleZ>

    <!--  If the player that spawned the object leaves the server does the object continue to exist?  -->
    <Persist>false</Persist>

</BasisLoadableConfiguration>

*/}

Edit on GitHub

Last updated on