User Projects
You're able to use TrashSim in your own project. TrashSim allows automatic player data loading, which will be used for simulating a battle.
Use the API key
To automatically load the defender you can call the following URL, including 1 required parameter and optionally a language:
- https://trashsim.universeview.be/?SR_KEY={KEY}
- https://trashsim.universeview.be/{LANG}?SR_KEY={KEY}
Parameters:
{KEY} (required) - should be replaced by the SR-key which can be found behind the API button in the espionage report messages.
{LANG} (optional) - can be replaced with a language supported by TrashSim, this can be an advantage for your international users. (supported languages)
Example:
https://trashsim.universeview.be/en?SR_KEY=sr-en-680-fc3b242fb73e700f3da54748844d90506a0cd705
Use the prefill feature
It's also possible to automatically load multiple players via a base64 encoded JSON string. To do this you can call the follow URL, please note that we use a hash (#) here and not a questionmark, this method secures our caching system:
- https://trashsim.universeview.be/#prefill={BASE64JSON}
- https://trashsim.universeview.be/{LANG}#prefill={BASE64JSON}
Parameters:
{BASE64JSON} (required) - should be replaced by the base64 encoded JSON string, the format will be discussed below.
{LANG} (optional) - can be replaced with a language supported by TrashSim, this can be an advantage for your international users. (supported languages)
JSON format:
The JSON is pretty self explaining, the root can contain 3 properties:
- 0 -> Contains the attacking party, an array of the attacking players.
- 1 -> Contains the defending party, an array of the defending players.
- settings -> Contains the server settings.
The player element has the following properties, which are all optional, resources, research, ships, defence & planet. The name of the research, ships and defende properties is set by the technologie ID's.
A party can contain as many players as you want, ofcourse you know that you can only send a maximum of 16 fleets, so adding more is not needed. In the defending party the first player object in the array will be the main defender, who can have defence and resources. Below you'll find 2 tables, the first tables explains the properties of the player objects and the second table is for the settings property.
Main property | Sub property | Value | Example |
---|---|---|---|
class * | 0 ... 3 | 0 | |
resources | metal | integer | 100 |
crystal | integer | 50 | |
deuterium | integer | 10 | |
research | 106 | {"level": integer} | {"level": 10} |
... | |||
199 | {"level": integer} | {"level": 4} | |
ships | 202 | {"count": integer} | {"count": 1347} |
... | |||
219 | {"count": integer} | {"count": 453} | |
defence | 401 | {"count": integer} | {"count": 2794} |
... | |||
503 | {"count": integer} | {"count": 20} | |
planet | galaxy | integer | 3 |
system | integer | 287 | |
position | integer | 11 | |
speed | integer | 80 |
* The class property supports 4 values: 0, 1, 2, 3. Being: 0: no class, 1: Collector, 2: General, 3: Discoverer.
Ofcourse you'll only need to add the properties where they make sense. For example: an attacker won't need the resources & defence properties and the main defender doesn't need the speed property and drive technologies. As for the research, only the drive and combat technologies will work.
The settings property has the following properties which are all required except for plunder & simulations.
Property | Value | Example |
---|---|---|
speed_fleet | integer | 2 |
galaxies | integer | 7 |
systems | integer | 499 |
rapid_fire | integer | 1 |
def_to_tF | 0 or 1 | 0 |
debris_factor | 0.0 to 1.0 | 0.3 |
repair_factor | 0.0 to 1.0 | 0.7 |
donut_galaxy | 0 or 1 | 1 |
donut_system | 0 or 1 | 1 |
plunder | 50, 75 or 100 | 75 |
simulations | 1 to ... | 15 |
characterClassesEnabled | 0 or 1 | 1 |
minerBonusFasterTradingShips | integer (%) | 100 |
minerBonusIncreasedCargoCapacityForTradingShips | integer (%) | 25 |
warriorBonusFasterCombatShips | integer (%) | 100 |
warriorBonusFasterRecyclers | integer (%) | 100 |
warriorBonusRecyclerFuelConsumption | integer (%) | 25 |
combatDebrisFieldLimit | integer (%) | 25 |
JSON Example:
{"0":[{"research":{"109":{"level":17},"110":{"level":17},"111":{"level":19},"115":{"level":17},"117":{"level":14},"118":{"level":13}},"ships":{"203":{"count":124},"204":{"count":5342},"206":{"count":1943}},"planet":{"galaxy":1,"system":124,"position":8},"speed":80}],"1":[{"resources":{"metal":5932712,"crystal":3742953,"deuterium":1284233},"research":{"109":{"level":15},"110":{"level":14},"111":{"level":16},"115":{"level":16},"117":{"level":13},"118":{"level":11}},"ships":{"202":{"count":2353},"203":{"count":438}},"defence":{"401":{"count":3842},"402":{"count":1438},"407":{"count":1},"502":{"count":10}},"planet":{"galaxy":2,"system":235,"position":11}}],"settings":{"speed_fleet":"2","galaxies":"7","systems":"499","rapid_fire":"1","def_to_tF":"0","debris_factor":"0.5","donut_galaxy":"1","donut_system":"1","plunder":50,"simulations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X2dhbGF4eSI6IjEiLCJkb251dF9zeXN0ZW0iOiIxIiwicGx1bmRlciI6NTAsInNpbXVsYXRpb25zIjoxNX19
Full example:
The example below will add 124 Large Cargo's to the first attacker his fleet and is will also set the fleet speed in the settings to 2.
https://trashsim.universeview.be/en#prefill=eyIwIjpbeyJzaGlwcyI6eyIyMDMiOnsiY291bnQiOjEyNH19fV0sInNldHRpbmdzIjp7InNwZWVkX2ZsZWV0IjoiMiJ9fQ==
JSON used: {"0":[{"ships":{"203":{"count":124}}}],"settings":{"speed_fleet":"2"}}
Below you'll find a list of the supported languages (the default value is en)::