1
1
Fork
You've already forked basalt-engine
0
⚙️ An ECS server-side modding engine for Minecraft: Java Edition.
Scala 98%
Shell 2%
Pedro c1120ccec2 feat: archetype-based storage and initial pipeline
This commit implements the initial code for efficient archetype-based storage, metaprogramming-based querying, cats-effect integration, and ticking and pipeline intercepting
2023年05月18日 00:10:59 -03:00
basalt-engine-core feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
basalt-unsafe feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
buildSrc feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
gradle feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
linux-scripts feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
.gitattributes feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
.gitignore feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
.scalafmt.conf feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
build.gradle feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
gradle.properties build: initial commit 2023年04月18日 15:09:33 -03:00
gradlew build: initial commit 2023年04月18日 15:09:33 -03:00
gradlew.bat build: initial commit 2023年04月18日 15:09:33 -03:00
LICENSE build: initial commit 2023年04月18日 15:09:33 -03:00
README.md feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00
settings.gradle feat: archetype-based storage and initial pipeline 2023年05月18日 00:10:59 -03:00

Basalt Engine

An ECS1 server-side modding engine for Minecraft inspired by Bevy. Built from ground up in Scala 3 with architectural support for Cats Effect and modularity in mind.

Roadmap

  • Entity composition
  • Platform-agnostic object and event abstraction
  • Synchronous (main-thread) code execution
  • Input/output support in queries with FS2
  • Advanced entity querying
  • Query composition with entities and streams
  • Persistent Data Container (PDC) support on Paper
  • Data persistence and (de)serialization to Circe
  • Network pipeline injection/transformation
  • Server-side data pack replication
    • Resource pack integration
    • HUD and font rendering
    • Custom blocks and items
  • Multi-platform Scala support
  • Minecraft: Java Edition protocol implementation
  • Not confirmed: Server-side Fabric toolchain support
  • Not confirmed: The Kotlin Programming Language support
  • Not confirmed: Bedrock Edition support

Background

Minecraft does not have a server extension standard through all of its modding toolchains and server implementations. Basalt strives to solve this problem by allowing users to follow the "write once, run everywhere" principle.

Basalt is built on top of the Scala 3 programming language, which is a modern, general-purpose multi-paradigm programming language. Since the Kotlin programming language has a really huge market value, Basalt will also try to support it as possible, although it wouldn't as prioritized as Scala is.

Basalt strives to be as modular, clean, performant, and built on top of modern mainstream and solid technologies as possible, such as the Typelevel ecosystem and FS2, allowing interchangeability between Minecraft and non-Minecraft environments easily.

Inspired by Bevy Engine – a data-driven game engine written in Rust – ECS implementation, we focus on logic built on top of resources, entities, and systems (could be simplified as data and functions). This approach is really nice because it's a very flexible and powerful design pattern that allows code to be easily reused, extended, and quickly written.

Server-only features you could see on data packs is planned to be supported as well! This includes, but not limited to, resource packs, custom blocks and items, HUD rendering, biomes, world generation, etc.

Optimization and data saving is also a big concern for Basalt, for that specific reason, we decided to follow up with the following design choice: attributes are data attached to an entity or object by default, such as health, position, etc. Those are treated as components but aren't serialized unless specified otherwise.

Example

Yet to be implemented. Take this as a proof of concept.

import scala.concurrent.duration.TimeUnit
import basalt.core.{Extension, Component}
import basalt.core.event.PlayerJoin
import basalt.core.protocol.java.JavaProtocol
import basalt.core.syntax.java._
import basalt.core.syntax._
def extension[F[_]: Sync: Clock]: Extension[F] =
 Extension[F](JavaProtocol.compat(from = v"1.19.0", to = v"1.19.4"))
 .metadata { namespace = "my-welcoming-extension"
 version = "0.0.0-SNAPSHOT" }
 .withSystems(firstJoinWelcome[F]) 
object FirstJoin extends Component[FirstJoin.Data]("first-join"):
 case class Data(timestamp: Long)
def firstJoinWelcome[F[_]: Clock]: System[F] =
 System[F].builder(name = "first-join-welcome")
 .tuple2(EventReader[PlayerJoin], !has(FirstJoin)) { reader, _ =>
 reader.map(event => Clock[F].realTime(TimeUnit.MILLISECONDS)
 .flatMap(event.assignee.addComponent(FirstJoin(_)))
 .flatTap(_ => event.assignee.send("{\"text\":\"Hello!\"}")))
 }

Limitations

  • The build system here has to be Gradle due to better compatibility with the Fabric mod loader, Paperweight Gradle plugin, and Kotlin support

Reference

1: Software architectural pattern "Entity component system".

  • ECScala - An ECS Scala framework. This is such a nice proof-of-concept that helped this project to get started, so I'd like to thank its developers!
  • flecs - A fast entity component system (ECS) for C & C++
  • Dominion - Insanely fast ECS (Entity Component System) for Java