[SOLVED] How do i hook pyplanet into my server

Python 3 Server Controller for Trackmania and Shootmania for script-only modes.

Moderators: TheM, toffe, NADEO

Locked
mattman0123
Posts: 3
Joined: 15 May 2019, 21:51

[SOLVED] How do i hook pyplanet into my server

Post by mattman0123 »

Hi all i am running a server and pyplanet on the same server

how do i make them talk to eachother?

Code: Select all

"""
This file contains the basic settings and overrides the default ones that are defined in the core.
Documentation: ###

If you want to use other configuration methods like YAML or JSON files, take a look at ### and head to the
configuration pages.
"""
import os

# Set the root_path to the root of our project.
ROOT_PATH = os.path.dirname(os.path.dirname(__file__))

# Set the temporary location for the project.
TMP_PATH = os.path.join(ROOT_PATH, 'tmp')

# Create temporary folder if not exists.
if not os.path.exists(TMP_PATH):
	os.mkdir(TMP_PATH)

# Enable debug mode to get verbose output, not report any errors and dynamically use the DEBUG in your code
# for extra verbosity of logging/output.
DEBUG = bool(os.environ.get('PYPLANET_DEBUG', False))

# Add your pools (the controller instances per dedicated here) or leave as it is to use a single instance only.
POOLS = [
	'default'
]

# Owners are logins of the server owners, the owners always get *ALL* the permissions in the system.
OWNERS = {
	'default': [
		'"'
	]
}

# Allow self-upgrading the installation. Disable on shared servers with one installation (hosting environment)!
SELF_UPGRADE = True

# Databases configuration holds an dictionary with information of the database backend.
# Please refer to the documentation for all examples.###
DATABASES = {
	'default': {
		'ENGINE': 'peewee_async.MySQLDatabase',
		'NAME': 'pyplanet',
		'OPTIONS': {
			'host': 'localhost',
			'user': 'root',
			'password': '',
			'charset': 'utf8mb4',
		}
	}
}

# Dedicated configuration holds the different dedicated servers that the instances will run on including the names of
# the instances.
DEDICATED = {
	'default': {
		'HOST': '127.0.0.1',
		'PORT': '5000',
		'USER': 'SuperAdmin',
		'PASSWORD': 'SuperAdmin',
	}
}

# Map configuration is a set of configuration options related to match settings etc.
# Matchsettings filename.
MAP_MATCHSETTINGS = {
	'default': 'Maplist-BaseLan34.txt',
}

# Blacklist file is managed by the dedicated server and will be loaded and writen to by PyPlanet once a
# player gets blacklisted. The default will be the filename Maniaplanet always uses and is generic.
BLACKLIST_FILE = {
	'default': 'blacklist.txt'
}

# The storage configuration contains the same instance mapping of the dedicated servers and is used
# to access the filesystem on the dedicated server location.
# Please refer to the documentation for more information.###
STORAGE = {
	'default': {
		'DRIVER': 'pyplanet.core.storage.drivers.local.LocalDriver',
		'OPTIONS': {},
	}
}

# Define any cache backends that can be used by the core and the plugins to cache data.
# This is not yet implemented. As soon as it's implemented you can activate it with the documentation, available on
# ###
# CACHE = {
# 	'default': {
#
# 	}
# }

# Songs is a list of URLs to .ogg files of songs to be played by the music server.
SONGS = {
	'default': []
}
LOGGING_WRITE_LOGS = True
LOGGING_ROTATE_LOGS = True
LOGGING_DIRECTORY = 'logs'

Am i missing something? when i try to enter the commands in it doesnt work
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: How do i hook pyplanet into my server

Post by toffe »

Hi Mattman,

First of all, do you have your maniaplanet dedicated server running on the same machine? And what settings does it have? The default?

The following lines in the base.py are for the communication between PyPlanet and the dedicated server:

Code: Select all

DEDICATED = {
	'default': {
		'HOST': '127.0.0.1',
		'PORT': '5000',
		'USER': 'SuperAdmin',
		'PASSWORD': 'SuperAdmin',
	}
}
Try to find those and adjust it. The current values are the default dedicated configuration values from Maniaplanet.

For more information on how to set up PyPlanet, check the site and small tutorial: http://pypla.net/en/stable/intro/index.html

Good luck,
I remain at your disposal for any further information that you might require,

Toffe
mattman0123
Posts: 3
Joined: 15 May 2019, 21:51

Re: How do i hook pyplanet into my server

Post by mattman0123 »

That is exactly what i have:

Setup
Main Server
- IP:192.207.*.*
running Dedicated maniplanet server
- can access and race on maps
Also running PyPlanet

base python

Code: Select all

"""
This file contains the basic settings and overrides the default ones that are defined in the core.
Documentation: **

If you want to use other configuration methods like YAML or JSON files, take a look at ** and head to the
configuration pages.
"""
import os

# Set the root_path to the root of our project.
ROOT_PATH = os.path.dirname(os.path.dirname(__file__))

# Set the temporary location for the project.
TMP_PATH = os.path.join(ROOT_PATH, 'tmp')

# Create temporary folder if not exists.
if not os.path.exists(TMP_PATH):
	os.mkdir(TMP_PATH)

# Enable debug mode to get verbose output, not report any errors and dynamically use the DEBUG in your code
# for extra verbosity of logging/output.
DEBUG = bool(os.environ.get('PYPLANET_DEBUG', False))

# Add your pools (the controller instances per dedicated here) or leave as it is to use a single instance only.
POOLS = [
	'default'
]

# Owners are logins of the server owners, the owners always get *ALL* the permissions in the system.
OWNERS = {
	'default': [
		'******************''
	]
}

# Allow self-upgrading the installation. Disable on shared servers with one installation (hosting environment)!
SELF_UPGRADE = True

# Databases configuration holds an dictionary with information of the database backend.
# Please refer to the documentation for all examples. **
DATABASES = {
	'default': {
		'ENGINE': 'peewee_async.MySQLDatabase',
		'NAME': 'pyplanet',
		'OPTIONS': {
			'host': 'localhost',
			'user': 'root',
			'password': '*****************',
			'charset': 'utf8mb4',
		}
	}
}

# Dedicated configuration holds the different dedicated servers that the instances will run on including the names of
# the instances.
DEDICATED = {
	'default': {
		'HOST': '127.0.0.1',
		'PORT': '5000',
		'USER': 'SuperAdmin',
		'PASSWORD': 'SuperAdmin',
	}
}

# Map configuration is a set of configuration options related to match settings etc.
# Matchsettings filename.
MAP_MATCHSETTINGS = {
	'default': 'Maplist-BaseLan34.txt',
}

# Blacklist file is managed by the dedicated server and will be loaded and writen to by PyPlanet once a
# player gets blacklisted. The default will be the filename Maniaplanet always uses and is generic.
BLACKLIST_FILE = {
	'default': 'blacklist.txt'
}

# The storage configuration contains the same instance mapping of the dedicated servers and is used
# to access the filesystem on the dedicated server location.
# Please refer to the documentation for more information. **
STORAGE = {
	'default': {
		'DRIVER': 'pyplanet.core.storage.drivers.local.LocalDriver',
		'OPTIONS': {},
	}
}

# Define any cache backends that can be used by the core and the plugins to cache data.
# This is not yet implemented. As soon as it's implemented you can activate it with the documentation, available on
# **
# CACHE = {
# 	'default': {
#
# 	}
# }

# Songs is a list of URLs to .ogg files of songs to be played by the music server.
SONGS = {
	'default': []
}
LOGGING_WRITE_LOGS = True
LOGGING_ROTATE_LOGS = True
LOGGING_DIRECTORY = 'logs'


Default config for dedicated

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>

<dedicated>
	<authorization_levels>
		<level>
			<name>SuperAdmin</name>
			<password>SuperAdmin</password>
		</level>
		<level>
			<name>Admin</name>
			<password>Admin</password>
		</level>
		<level>
			<name>User</name>
			<password>User</password>
		</level>
	</authorization_levels>
	
 	<masterserver_account>
		<login>****************</login>
		<password>**************</password>
		<validation_key></validation_key>
	</masterserver_account>
	
	<server_options>
		<name>***********</name>
		<comment></comment>
		<hide_server>0</hide_server>					<!-- value is 0 (always shown), 1 (always hidden), 2 (hidden from nations) -->

		<max_players>64</max_players>
		<password></password>
		
		<max_spectators>32</max_spectators>
		<password_spectator></password_spectator>
	
		<keep_player_slots>False</keep_player_slots>			<!-- when a player changes to spectator, hould the server keep if player slots/scores etc.. or not. --> 	
		<ladder_mode>forced</ladder_mode>				<!-- value between 'inactive', 'forced' (or '0', '1') -->
		
		<enable_p2p_upload>True</enable_p2p_upload>
		<enable_p2p_download>False</enable_p2p_download>
		
		<callvote_timeout>60000</callvote_timeout>
		<callvote_ratio>0.5</callvote_ratio>				<!-- default ratio. value in [0..1], or -1 to forbid. -->
		<callvote_ratios>
			<voteratio command="Ban" ratio="-1"/>
			<!-- commands can be "Ban", "Kick", "RestartMap", "NextMap", "SetModeScriptSettingsAndCommands"... -->
		</callvote_ratios>

		<allow_map_download>True</allow_map_download>
		<autosave_replays>False</autosave_replays>
		<autosave_validation_replays>False</autosave_validation_replays>

		<referee_password></referee_password>
		<referee_validation_mode>0</referee_validation_mode>		<!-- value is 0 (only validate top3 players),  1 (validate all players) -->

		<use_changing_validation_seed>False</use_changing_validation_seed>

		<disable_horns>False</disable_horns>
		<clientinputs_maxlatency>0</clientinputs_maxlatency>		<!-- 0 mean automatic adjustement -->
	</server_options>
	
	<system_config>
		<connection_uploadrate>8000</connection_uploadrate>		<!-- Kbits per second -->
		<connection_downloadrate>8000</connection_downloadrate>		<!-- Kbits per second -->
		<packetassembly_threadcount>1</packetassembly_threadcount>     <!-- Number of threads used when assembling packets. Defaults to 1. --> 

		<allow_spectator_relays>False</allow_spectator_relays>

		<p2p_cache_size>600</p2p_cache_size>

		<force_ip_address></force_ip_address>
		<server_port>2350</server_port>
		<server_p2p_port>3450</server_p2p_port>
		<client_port>0</client_port>
		<bind_ip_address>192.207.**.**</bind_ip_address>
		<use_nat_upnp></use_nat_upnp>

		<gsp_name></gsp_name>						<!-- Game Server Provider name and info url -->
		<gsp_url></gsp_url>						<!-- If you're a server hoster, you can use this to advertise your services -->

		<xmlrpc_port>5000</xmlrpc_port>
		<xmlrpc_allowremote>False</xmlrpc_allowremote>			<!-- If you specify an ip adress here, it'll be the only accepted adress. this will improve security. -->

		<scriptcloud_source>nadeocloud</scriptcloud_source>		<!-- Specify the cloud storage mode for Titles that use it. Can be "localdebug" or "xmlrpc" or "nadeocloud" (default). "nadeocloud" will work only if the creator of the title subscribed to the cloud service. -->

		
		<blacklist_url></blacklist_url>
		<guestlist_filename></guestlist_filename>
		<blacklist_filename></blacklist_filename>
		
		<title>TMStadium</title>		<!-- SMStorm, TMCanyon, ... -->

		<minimum_client_build></minimum_client_build>			<!-- Only accept updated client to a specific version. ex: 2011-10-06 -->

		<disable_coherence_checks>False</disable_coherence_checks>	<!-- disable internal checks to detect issues/cheats, and reject race times -->

		<disable_replay_recording>False</disable_replay_recording>	<!-- disable replay recording in memory during the game to lower memory usage. -->
		<save_all_individual_runs>False</save_all_individual_runs>	<!-- Save all the ghosts from the match replay to individual ghost.gbx files, in folder {servername}/Autosaves/Runs_{mapname}/  -->

		<use_proxy>False</use_proxy>
		<proxy_url></proxy_url>
	</system_config>
</dedicated>


both are running in screen on linux ubuntu
mattman0123
Posts: 3
Joined: 15 May 2019, 21:51

Re: How do i hook pyplanet into my server

Post by mattman0123 »

Issue was with the my sql not loading the DB now it does work
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: [SOLVED] How do i hook pyplanet into my server

Post by toffe »

It’s good to hear that you got it working.

Toffe
Locked

Return to “PyPlanet”

Who is online

Users browsing this forum: No registered users and 2 guests