Skip to content

Instantly share code, notes, and snippets.

@TrueBrain
TrueBrain / truegrf-primary-firs.js
Last active Jan 5, 2022
TrueGRF custom industry production
View truegrf-primary-firs.js
/*
These next variables can be templated in TrueGRF, and are generated (by TrueGRF) different for each industry.
These values are from the FIRS Steeltown Bulk Terminal industry, and are meant as example.
*/
level_requirements = [
{
level: 0,
percent: 100,
},
@TrueBrain
TrueBrain / readme.md
Last active Jan 27, 2022
TrueGRF custom callback language
View readme.md

TrueGRF uses a custom (RPN-based) language.

RPN (See: https://en.wikipedia.org/wiki/Reverse_Polish_notation), also known as postfix language or stack-based language, is used as NewGRFs have a limit subsets of supported operations. RPN best matches NewGRFs while still being a slightly higher language than NFO is.

Integer-based

As NewGRF is integer-based, so is this language. This is not so much a rule of this language, more a consequence of the rule NewGRF created.

@TrueBrain
TrueBrain / backport-languages.py
Last active Jan 3, 2022
Backporting of PRs and language changes
View backport-languages.py
"""
Put this file in a master checkout under .github/.
It should be next to backport.py.
"""
import argparse
import glob
import subprocess
import shlex
View presets.md

Introduction

If you have played OpenTTD without NewGRFs and GSes for a bit, with the default settings, you get interested in spicing up your game. Currently this requires some pretty good knowledge of all kinds of things:

  • What NewGRFs are good and which work good together?
  • What settings make the game more interested (cargodist) and which should you never touch (inflation)?
  • What GS increases the fun of a game, and in what climate does it work best?

To get answers to these questions is difficult. You need access to any OpenTTD community, and other people need to help you out to piece everything together.

@TrueBrain
TrueBrain / quick-howto-guide.md
Last active Jul 17, 2021
Quick how-to guide in setting up development setup for game coordinator
View quick-howto-guide.md

This guide is build for WSL2 / Linux. For Windows it is also possible, but I can never remember Powershell syntax.

The beginning (one-time effort)

Get Python3.8+. Create a venv (for Debian, install python3-virtualenv package first):

python3 -m venv venv
View network-debug-levels.md

It now follows very simple rules:

  • 0 - Fatal, user should know about this
  • 1 - Error, but we are recovering
  • 2 - Warning, wrong but okay if you don't know
  • 3 - Info, information you might care about
  • 4 -
  • 5 - Debug #1 - High level debug messages
  • 6 - Debug #2 - Low level debug messages
  • 7 - Trace information
View settings.ini
[SDT_OMANY]
var = game_creation.landscape
type = SLE_UINT8
from = SLV_97
guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY
def = 0
max = 3
full.LT_TEMPERATE = temperate, 0
full.LT_ARCTIC = arctic, 1, subartic
full.LT_TOPIC = tropic, 2, subtropic
@TrueBrain
TrueBrain / checklist.md
Last active Jul 18, 2021
Checklist for master -> main
View checklist.md

Few things happening for each repository:

  • Rename "master" into "main"
  • Cleanup workflows to use the new centralized versions (instead of custom shell-scripts copied everywhere)
  • Enable the "check annotation" step
  • Ensure "default" branch can be anything configured

Repositories left to do:

  • aws
@TrueBrain
TrueBrain / network-todo.md
Last active Aug 10, 2021
Network TODO list
View network-todo.md

GC = Game Coordinator

Cleanup

  • ✓ Server name not empty (or default to "playername's server"?)

Client Info

  • 9114 Add GAME_INFO to TCP and use it for lobby
  • 9469 Sync NetworkGameInfo from server with all clients, so clients locally know the server they are on (and sync servername changes when they happen); possibly only sync information client doesn't already know via a Command packet.
  • 9469 Show server name in GUI
@TrueBrain
TrueBrain / integration.md
Last active Apr 5, 2021
Steam / Discord integration (Rich Presence)
View integration.md

To start with, few things to keep in mind:

  • I am not a lawyer.
  • Neither are you.
  • 1000 people 1000 opinions; this is not so much about opinions, but about facts, options, and risk.
  • I did a morning of searching the web to gather this information, just so we have something to talk about. To bring this a bit more into facts rather than opinions we all have on what GPL is and isn't :D

Problem description

With us going to Steam, the request for Steam integration has increased.