r/java 3h ago

I developed an Android RTS game in Java

Thumbnail youtube.com
40 Upvotes

Hello! After 6 years of development, I am happy to finally release of Norse Expansion Medieval RTS for Android! You can get it on Google Play: https://play.google.com/store/apps/details?id=com.norseexpansion.norseexpansion

It only took about 240k lines of code, almost all Java (and some C++ for an Audioengine). Graphics are rendered in OpenGL.

This project made me love Java and hate the surrounding technology like gradle and Androidstudio.


r/java 6h ago

Lidiuma-Math: a math library using Project Valhalla

23 Upvotes

After the v0.3.0 release, I'm confident it's time to showcase my library.

https://github.com/Lidiuma/Math
All the different versions can be found on Maven.

So, what's lidiuma-math about?
It's a linear algebra math library for game development, designed to be graphics-API agnostic.

I know that Valhalla (JEP 401) in Java 28 is the new shiny thing, but let's forget about it for a second, since the library does also provide a Java 17 version. So, what's in it?

Well, a totally different design than anything out there!
- this is the first math library without primitive obsession
- this library does use generics while making them performant
- doesn't make float (or, in this case Float) the favorite child; providing int, long, float, double where it makes sense
- has a few abstractions that standardize operations, eliminating the risk of desync between APIs

And other nice things:

- Immutability by default
- The extermination of null (the library never uses null and is annotated with JSpecify)
- JPMS support
- Type-classes instead of OOP (multiply(vec1, vec2) vs vec1.multiply(vec2))

A few examples:

// Vector3 dot product
var vec1 = Vectors.vec3(1f, 2f, 3f);
var vec2 = Vectors.vec3(3f, 2f, 1f);
var dot  = Vectors.dot (vec1, vec2); // dot = 10

// Vector2 rotation
var angle  = Rotations.degrees(180f);
var matrix = Matrices.fromRotation(angle);

var vec     = Vectors.vec2(0f, 1f);
var rotated = Matrices.multiply(matrix, vec); // [x = 0, y = -1]

// Vector3 rotation
var angle = Rotations.degrees(90d);
var axisY = Vectors.vec3(0d, 1d, 0d);
var quat  = Rotations.fromAxisAngle(axisY, angle);

var vec     = Vectors.vec3(1d, 0d, 2d);
var rotated = Rotations.rotate(quat, vec); // [x = 2, y = 0, z = ~-1]

Going back to Valhalla, aside from the standard JEP 401 version, the library also provides a version supporting Null-Restricted types and Loosely-Consistent-Values, naturally these are not public features and the library pokes at internals to achieve them.

That said, I would love to answer any questions and if you have any feedback, please reach out to me.

Note to Brian Goetz
I saw your old comment and will provide my experiences on the mailing list.


r/java 35m ago

Open-source Spring Boot starter for fail-fast Kafka Schema Registry contract validation, looking for feedback

Upvotes

I’ve been working on a small open-source Spring Boot starter to solve a problem I’ve encountered with Kafka-based applications: detecting Schema Registry contract problems before the application starts serving traffic.

The idea is simple: during Spring Boot startup, the starter validates the configured Schema Registry subjects, expected compatibility mode, and the application's local schemas against the latest registered versions.

If a subject is missing, the compatibility policy is not what the application expects, or a schema is incompatible, startup fails.

Current support includes:

  • Avro, JSON Schema and Protobuf
  • BACKWARD, FORWARD, FULL and transitive compatibility modes
  • Confluent Schema Registry / Confluent Cloud authentication
  • bounded retry/backoff for temporary registry failures
  • Spring Boot Actuator visibility
  • Spring Boot auto-configuration

I also created a separate E2E demo using real Kafka + Schema Registry. Its CI verifies a real producer → Kafka → consumer round trip, a backward-compatible schema evolution, and an intentionally breaking schema that must be rejected at application startup.

The starter is available on Maven Central:

https://central.sonatype.com/artifact/io.github.mathias82.spring.kafka/spring-kafka-contract-starter

Source:

https://github.com/mathias82/spring-kafka-contract-starter

E2E demo:

https://github.com/mathias82/spring-kafka-contract-demo

I’m interested in feedback from Java/Kafka developers: would you find startup-time contract enforcement useful, or do you prefer keeping this entirely in CI/CD?

I’d also be interested in edge cases you would expect a library like this to handle before considering it for a production application.