Dragon banner

Dragon & Fox
Collective

Fox banner

Dot functions

Published by Jady on 5/21/24, 11:17 PM

Remember how I said everything's a function? I've been working on dot notation, which of course are also functions. But they're procedurally generated functions at compile time to keep them safe, which is... particularly goofy.


Foo
{
    Int a
    
    Int GetA(Foo this)
    {
        Return this.a
    }
}

Void Main()
{
    Declare Foo foo
    Foo.GetA(foo)
    foo.GetA()
}

becomes


Foo
{
    Int a
    
    Int GetA(Foo this)
    {
        Return Get_a(this)
    }
    
    Int* Get_a(Foo this)
    as "$0.a"
    {
        Return #access(this, a)
    }
}

(Foo => Int) Get_GetA(Type<Foo> foo)
as "$0.GetA"
{
    Return #access(foo, GetA)
}

(() => Int) Call_GetA(Foo foo)
as "$0.GetA"
{
    Return () => #access(foo.Type, GetA)(foo)
}

Void Main()
{
    Declare Foo foo
    Get_GetA(Foo)(foo)
    Call_GetA(foo)()
}

These extra generated functions only exist in the compiler though, and can't be accessed any other way.

Cetus Script

Published by Jady on 5/18/24, 6:49 PM

The "make a game > make a game engine > make a programming language" pipeline is strong. Here's what I've done in Cetus Script so far!


extern Void printf(String format, Int... values)

struct Foo
{
    Int a
    Int b
}

Void main()
{
    Foo foo = New
    foo.a = 2
    printf("Starting at %i\n", foo.a)
    
    While (foo.a < 6)
    {
        foo.a = foo.a + 1
        printf("Loop %i\n", foo.a)
    }
    
    printf("Ending at %i\n", foo.a)
    Return
}

The first really big feature of Cetus has already been implemented, at least compiler-side. Every single statement in main is a function! Foo foo = New is secretly just Declare(Foo, foo). foo.a = 2 is secretly Assign(Get(foo, a), 2). These functions just have patterns associated with them that let them be used more fluently. Patterns will also eventually be able to be used for types as well, so you can say Foo? instead of Option.

Another interesting feature is that pointers are handled automatically! foo.a returns Int* when used in Assign, but it also returns Int when used in printf! You don't get to handle reference and dereference pointers manually, but it can figure out what's usable on it's own.

Other quirks of the language include using PascalCase for things that public and camelCase for things that are private, whitespace means nothing and semicolons are optional, etc.

The next thing I'm trying to work on is something like rust's traits, but also allows you to define fields in trait objects, which you can't do with rust. Other planned features are things like properties being automatic type definitions instead of just functions.

Post-stream editor size stuff

Published by Jady on 5/6/24, 4:12 PM

When I ended the stream half the text too big or too small or out of place. Turns out I never considered scale when calculating minimum size! so text size and bounds are fixed now. Here's the grayboxed version of the "Add Component" window, which is the main tool that will allow users to connect components together into prefabs.

Editor favorite fields

Published by Jady on 5/1/24, 2:54 PM

I've been mainly working on the Echidna Engine editor. Currently everything is very grayboxed, but slowly but surely we're adding features that will make development way more streamlined than Unity or Godot! One of these features is "favorite fields", so you have a place to put all your most important data so the display doesn't get all clogged up!

Echidna Engine

Published by Jady on 1/30/24, 12:59 PM

If you've been hanging around the server lately, you might've noticed a new SBEPIS channel: Echidna Engine. Echidna is going to be our in-house engine that SBEPIS will be moved to, off of Unity. I've been struggling a lot with how Unity's systems operate, between its limited layer and tag systems, its inaccessibility for planetary geometry, and just how dang slow it is, especially with their physics system. So over the past couple weeks I've been writing my own game engine from scratch in C# using OpenGL and BepuPhysics, and we're calling it Echidna after the Denizen of Space.

The primary immediate improvement over Unity is its speed. Unity only runs the majority of its code on one thread at a time, because it uses Component architecture, which means that entities contains components that do things. The only place Unity can use multiple threads at once is through its job system, which has Entity Component System (or ECS) architecture, where entities have components that don't do anything, but the world contains systems that can run on many components at once. Echidna fully uses ECS architecture to take full advantage of multithreading, and this can be applied to any system that needs it. The entire engine code only uses 4 files, World, Entity, Component, and System. Everything else is just sticking components on entities adding systems to the world.

If you're interested in poking through an ECS game engine, all the code is Free and Open Source on my GitHub.