Introducing Luna: My Rust-based NNUE Chess Engine

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

Spunc595
Posts: 7
Joined: Mon Jul 06, 2026 12:15 am
Full name: Daniele Marpino

Introducing Luna: My Rust-based NNUE Chess Engine

Post by Spunc595 »

​Hello everyone,
​I am thrilled to have been accepted into this community! I would like to take this opportunity to introduce my chess engine, Luna.
​I have been developing Luna from scratch using Rust, focusing on creating a robust and efficient architecture. One of the core components I am particularly proud of is the NNUE evaluation; I have trained the network personally using a custom pipeline written in Python.
​The engine currently supports the standard UCI protocol, and I have implemented features like a bitwise-masked transposition table to enhance search performance. As I am still actively working on optimizations and refining the search algorithms, I would truly appreciate any feedback, constructive criticism, or advice from the experienced developers here.
​You can find the source code and the current status of the project on my GitHub repository:
https://github.com/Spunc595/Luna-Chess-Engine
​I look forward to learning from this community and contributing where I can. Thank you all for your time!
​Best regards,
​Daniele
User avatar
Sylwy
Posts: 5299
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: Introducing Luna: My Rust-based NNUE Chess Engine

Post by Sylwy »

Spunc595 wrote: Wed Jul 08, 2026 3:03 pm ​Hello everyone,
​I am thrilled to have been accepted into this community! I would like to take this opportunity to introduce my chess engine, Luna.
​I have been developing Luna from scratch using Rust, focusing on creating a robust and efficient architecture. One of the core components I am particularly proud of is the NNUE evaluation; I have trained the network personally using a custom pipeline written in Python.
​The engine currently supports the standard UCI protocol, and I have implemented features like a bitwise-masked transposition table to enhance search performance. As I am still actively working on optimizations and refining the search algorithms, I would truly appreciate any feedback, constructive criticism, or advice from the experienced developers here.
​You can find the source code and the current status of the project on my GitHub repository:
https://github.com/Spunc595/Luna-Chess-Engine
​I look forward to learning from this community and contributing where I can. Thank you all for your time!
​Best regards,
​Daniele
viewtopic.php?start=820&t=81223&sid=40b ... 715beeaf45

1.- let static_eval = crate::evaluation::evaluate(board); ...or,

let static_eval = if let Some(n) = nnue {
n.evaluate(board)
} else {
crate::evaluation::evaluate(board)
};

2.- let stand_pat = crate::evaluation::evaluate(board); ...or,

let stand_pat = if let Some(n) = nnue {
n.evaluate(board)
} else {
crate::evaluation::evaluate(board)
};

???

:wink:
Spunc595
Posts: 7
Joined: Mon Jul 06, 2026 12:15 am
Full name: Daniele Marpino

Re: Introducing Luna: My Rust-based NNUE Chess Engine

Post by Spunc595 »

Hi.

I am actually using the second approach. Since the NNUE is passed as an Option, I implemented a fallback to the classical evaluation function in both the main search (for static_eval) and the quiescence search (for stand_pat) in case the network file is missing or fails to load.

This allows me to test and compare the search behavior with and without the neural network weights.
User avatar
Graham Banks
Posts: 46114
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Introducing Luna: My Rust-based NNUE Chess Engine

Post by Graham Banks »

There is already a chess engine named Luna.
gbanksnz at gmail.com
Spunc595
Posts: 7
Joined: Mon Jul 06, 2026 12:15 am
Full name: Daniele Marpino

Re: Introducing Luna: My Rust-based NNUE Chess Engine

Post by Spunc595 »

Thanks for pointing that out! Yes, I’m aware that "Luna" is a beautiful and popular name, and there might be older or other projects out there sharing it.

To avoid any confusion, my project is officially named Luna Chess Engine (LCE). It’s a completely new, independent engine written from scratch in Rust, featuring a custom NNUE evaluation. I'll make sure to use the full name or the acronym LCE in the future to keep things distinct!
User avatar
Sylwy
Posts: 5299
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: Introducing Luna: My Rust-based NNUE Chess Engine

Post by Sylwy »

Graham Banks wrote: Wed Jul 08, 2026 5:43 pm There is already a chess engine named Luna.
This engine is named (exactly) Luna Chess Engine (LCE) (v1.0.0). The other is Luna (2.0.0)-Thomas Mergener chess engine.
Spunc595
Posts: 7
Joined: Mon Jul 06, 2026 12:15 am
Full name: Daniele Marpino

Re: Introducing Luna: My Rust-based NNUE Chess Engine

Post by Spunc595 »

Exactly, thanks Sylwy for clearing that up!

Luna Chess Engine (LCE) is a completely independent, modern project built from scratch in Rust with a custom NNUE evaluation. There is no connection with the older engine by Thomas Mergener. Thanks everyone for the support!
User avatar
Graham Banks
Posts: 46114
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Introducing Luna: My Rust-based NNUE Chess Engine

Post by Graham Banks »

Could you please give more information regarding your net?
gbanksnz at gmail.com
tomitank
Posts: 291
Joined: Sat Mar 04, 2017 12:24 pm
Location: Hungary

Re: Introducing Luna: My Rust-based NNUE Chess Engine

Post by tomitank »

Graham Banks wrote: Wed Jul 08, 2026 10:26 pm Could you please give more information regarding your net?
// --- NNUE ARCHITECTURE CONFIGURATION ---
// 768 input features (12 piece types * 64 squares)[cite: 5].
const INPUT_SIZE: usize = 768;
// Size of the first hidden layer (Feature Transformer)[cite: 5].
const L1_SIZE: usize = 256;
// Size of the second hidden layer[cite: 5].
const L2_SIZE: usize = 32;

short: 768x256x32x1