OpenTTD port to Java

Overview

NextTTD (JDrive)

This is an OpenTTD port to Java.

Java CI

Current state: The game is basically playable - aircrafts, trains, ships and road vehicles are working. But Save/load is not completely tested.

You're welcome to take part in testing and/or development!

Screenshots:

27 Aug 2021

23 Aug 2021

What for

OpenTTD is beautiful. But it still carries on most of the original TTD architectural solutions. Bit banging, obscure data structures and crazy assembler style encoding of tile state.

It's time to move on.

My goals:

  • Reduce code complexity and obscurity. Core functions code must be twice shorter in terms of byte count.
  • No more bit fields and C/asm style polymorphism. Make code more OO and, where possible, functional.
  • Make game save automatic. No manual enumeration of fields to save.

As a result game code must be really easy to understand and modify.

Example:

Obscure and long:

FOR_ALL_INDUSTRIES(ind) {
	if (ind->xy != 0 && (cargo_type == ind->accepts_cargo[0] || cargo_type
			 == ind->accepts_cargo[1] || cargo_type == ind->accepts_cargo[2]) &&
			 ind->produced_cargo[0] != CT_INVALID &&
			 ind->produced_cargo[0] != cargo_type &&
			 (t = DistanceManhattan(ind->xy, xy)) < 2 * u) 
	{
		...
	}
}

Easy to understand and short:

Industry.forEach( ind ->
{			
	if (ind.isValid() && ind.acceptsCargo(cargo_type) 
			&& !ind.producesCargo(cargo_type)
			&& (t = Map.DistanceManhattan(ind.xy, xy)) < 2 * u[0]) 
	{
		...
	}
});

One more example. Code:

static bool AnyTownExists(void)
{
	const Town* t;

	FOR_ALL_TOWNS(t) {
		if (t->xy != 0) return true;
	}
	return false;
}

Becomes:

public static boolean anyTownExist()
{
	return stream().anyMatch( t -> t.isValid() );
}

Why Java

  • Portability for free. It just runs everywhere. Really.
  • Cleaner code. (Not yet, but I'm on my way:)
  • It is easier to build complex data structures in a language with GC.
  • Mature graphics, sound and midi subsystems
Issues
Owner
Dmitry Zavalishin
Dmitry Zavalishin
Minecraft Multi-Threading Mod Fabric Port

MCMTFabric - Minecraft Multi-Threading Mod Fabric Port This mod is based on the amazing work on JMT-MCMT. Please check that repository for details. No

Grider 40 Sep 14, 2021
Minecraft 1.16.5 Utility Mod for Anarchy and Crystal PvP

Fabric 1.16.5 port for GameSense. A more interesting readme will be coming soon, but check out the main repo at https://github.com/IUDevman/gamesense-

null 24 Aug 31, 2021
A library that provide informations for minecraft servers (players, maxplayers and motd)

MinecraftServerInformations MinecraftServerInformation is a java library for retrieving informations about Minecraft Servers. Installation Download th

null 12 Sep 1, 2021
Equivalent Exchange 3 Apache 2 Equivalent Exchange 3 pahimar Equivalent-Exchange-3. Mods for Minecraft. License: Apache 2 , .

Welcome to Equivalent Exchange 3! All versions are available here Minecraft Forums page Compiling EE3 - For those that want the latest unreleased feat

Rob Davis 722 Aug 24, 2021
Java / JavaFX / Kotlin Game Library (Engine)

About JavaFX Game Development Framework Why FXGL? No installation or setup required "Out of the box": Java 8-15, Win/Mac/Linux/Android 8+/iOS 11.0+/We

Almas Baimagambetov 2.2k Sep 13, 2021
LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan), audio (OpenAL), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR) applications.

LWJGL - Lightweight Java Game Library 3 LWJGL (https://www.lwjgl.org) is a Java library that enables cross-platform access to popular native APIs usef

Lightweight Java Game Library 3.4k Sep 15, 2021
An efficient map viewer for Minecraft seed in a nice GUI with utilities without ever needing to install Minecraft.

To download it head to the Releases section. To run it: either double click it on it if you have the Java Runtime (JRE) or use the command line (shift

Neil 63 Sep 13, 2021
Java mod library

AdvancedContentInfo AdvancedContentInfo is a Mindustry java mod library for making out stats and stats categories. Usage/Examples You can initialize y

null 5 Aug 23, 2021
A fast, customizable and compatible open source server for Minecraft: Java Edition

Glowstone A fast, customizable and compatible open source server for Minecraft: Java Edition. Introduction Glowstone is a lightweight, from scratch, o

Glowstone Project 1.5k Sep 5, 2021
🗺️ Minecraft map editor and mod

A Minecraft Map Editor... that runs in-game! With selections, schematics, copy and paste, brushes, and scripting! Use it in creative, survival in sing

EngineHub 2.1k Sep 14, 2021
Java mod library

GasLirary GasLirary is a Mindustry java mod library for making new content type: Gas. Usage/Examples Gas creating Gas is created in the same way as It

null 3 Aug 19, 2021
Jetserver is a high speed nio socket based multiplayer java game server written using Netty and Mike Rettig's Jetlang.It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.

Note New version of Jetserver is called Nadron and is in a new netty 4 branch of this same repo. JetServer is a java nio based server specifically des

Abraham Menacherry 1.2k Sep 15, 2021
[LEGACY] LWJGL 2.X - The Lightweight Java Game Library.

[LEGACY] LWJGL - Lightweight Java Game Library WARNING This is the repository of the original LWJGL, which is no longer actively maintained. Unless yo

Lightweight Java Game Library 509 Sep 14, 2021
Game Sales Simulation

Game Sales Platform Kullanıcıların, steam vb. siteler gibi sisteme kayıt olabileceği aynı zamanda kütüphanlerine oyunları ekleyip satın alabileceği bi

Aykut Şahin 10 May 26, 2021
Terasology - open source voxel world

Terasology Welcome! The Terasology project was born from a Minecraft-inspired tech demo and is becoming a stable platform for various types of gamepla

Moving Blocks! 3.2k Sep 16, 2021
A minecraft mod that allows using minecrafts structure block based test system

MC Tester Mod This mod allows using the automated structure based test system Mojang created for minecraft. The test system is only partially included

2No2Name 14 Aug 26, 2021
Desktop/Android/HTML5/iOS Java game development framework

Cross-platform Game Development Framework libGDX is a cross-platform Java game development framework based on OpenGL (ES) that works on Windows, Linux

libgdx 18.9k Sep 16, 2021
BuildCraft

Welcome to BuildCraft on GitHub Reporting an issue Please open an issue for a bug report only if: you are sure the bug is caused by BuildCraft and not

BuildCraft Team 1.2k Sep 4, 2021
please read README to see how to play this. and star me to help me! this is very helpful and thanksful for me.

Sharustry Mod Browser / 모드 브라우저로 다운로드하기 Only possible with 124 or higher, only can download "latest" release 124 버전 이상에서만 가능하고, 오직 가장 최근의 정식 릴리즈만 다운로드

Sharlotte 36 Aug 6, 2021