Development Log - 2023-11-24

Author: b0in

The first module!

I have the first module up, the API for the extensible codec. The server protocol is made up of a few different groups of packets, some optional, so this shared API provides a way for our individual servers to define their own packets and expose them to the core netty TCP server.

Thoughts

I have a proof of concept working that is the full login workflow. It has been a unique challenge separating out this proof of concept into a more thought out, documented codebase.

All the maven scaffolding has been a nightmare, but now I have a working maven site that I can write with, hit save, and see results almost immediately. This is what you are reading now!

Features brainstorm

As I mentioned in the FAQ, I like the idea of having a standalone runnable jar. So some brainstormed features have this in mind

Embedded DB: A persistence layer based on an existing embeddable Java DB. H2, Derby, HSQLDB… these are some old classics. Nitrate looks neat but rocksdb requires JNI (can use mvstore, same as H2).

Admin interfaces: A nicety and a way for quick configuration and bootstrapping. Both web and textual interfaces, with the latter possibly being provided via OSGI and GoGo.

Planned modules

We have a few planned modules I'll list here and their jobs and their statuses. Anything unlisted would be considered near-0% completed.

crow.game.codec.api - [90%]

The shared API for serializing and deserializing packets. The bottom contains an example of a packet handler for Ping.

crow.game.codec.netty - [10-20%]

The netty specific code (FrameCodec, PacketCodec, etc.) The code is working and done but needs to imported in to this repository.

crow.game.compat.rathena.proto - [1-10%]

This is the packet specification for the rathena-specific calls, specifically used for HA packets between the login, char, and map servers.

crow.game.compat.rathena.components - [1%]

The rathena components which implement behavior that would make your servers compatible with existing rathena servers. This includes DB connectivity and querying, logic handlers and workflow systems for connecting to and listening for connections from other servers.

There is a proof-of-concept as part of the larger login server, but it needs separation and design.

crow.game.server.common - [1%]

Common server components (TCP handlers, lifecycle management).

crow.game.server.login - [1%-10%]

The server which speaks the login protocol expected by the client. This has a proof-of-concept working but requires some decoupling from the rathena specific parts as well as error handling and in-memory state management.

crow.game.release.omnibus - [0%]

This would be the release of 100% of any server and client that is implemented as a runnable JAR.

Example: PingPacketHandler.java

This is a working packet handler for the Ping operation (0x2719). It's a 0-length packet, once you remove the packet identifier. It is NOT packet version specific so the simple rule() implementation works. And our needs in fromPacket and toPacket are equally simple.

public class PingPacketHandler implements PacketHandler<Ping> {
	@Override
	public Ping fromPacket(Context context, ByteBuf buffer) {
                  // The ping packet is 0-length and requires no reading from
                  // the buffer.
		return new Ping();
	}

	@Override
	public void toPacket(Context context, ByteBuf buffer, Ping t) {
                  // The ping packet is 0-length and requires no writing.
	}

	@Override
	public PacketRule rule(Context context) {
		return PacketRule.Static(0x2719, /*length=*/0, Ping.class);
	}
}