Better HN
topnewbestaskshowjobs
Log inSign up

makuto

184 karma · joined Sep 30, 2020 (6y ago) · 39 submissions

Software engineer in the game industry.
Submissions

comment 3y ago · link · parent

That's true. I was mainly trying to indicate there is no boxing or anything like some languages seem to have with their types.

comment 3y ago · link · parent

There is a module in gamelib [0] which will automatically clone, build, and link raylib to your program. There are several other third party libs there as well, including SDL2 and Curl.

[0] https://macoy.me/code/macoy/gamelib

comment 3y ago · link · parent

Memory allocation matches C, i.e. malloc and free are used. If interoperating with C++, you can use new and delete.

4.

Binary Data Version Migration(macoy.me ↗)

1 points · by makuto · 3y ago · discuss

5.

Software Complexity and Potential Solutions(macoy.me ↗)

1 points · by makuto · 3y ago · discuss

6.

An argument for self-modifying applications(macoy.me ↗)

2 points · by makuto · 4y ago · discuss

comment 4y ago · link · parent

Author here! Isconnected is a hypothetical.

8.

What they don't teach you about sockets(macoy.me ↗)

3 points · by makuto · 4y ago · discuss

9.

Writing XML with S-Expressions(macoy.me ↗)

2 points · by makuto · 4y ago · discuss

10.

Interface ergonomics: automation isn't just about time saved(macoy.me ↗)

60 points · by makuto · 5y ago · 21 comments

11.

The Power of Type Introspection(macoy.me ↗)

1 points · by makuto · 5y ago · discuss

comment 5y ago · link · parent

Chat profanity filtering is usually part of Xbox/PlayStation certification requirements, so their hands might be tied on that.

13.

The worrying trend of game technology centralization(macoy.me ↗)

4 points · by makuto · 5y ago · discuss

comment 5y ago · link · parent

I have a Surface Pro 2 running with the linux-surface kernel [0]. It feels like it has some rough edges - you have to decide between having pen support or having touch screen support, and suspend can be unreliable. These issues may be fixed now. Also, I encrypted my Windows partition, and now it requires the key each time to boot up, so I recommend against doing that.

Overall, I do agree that the hardware feels quite nice, and besides those issues I listed, the Linux experience is quite good. I was very happy to not be forced to use Windows.

[0] https://github.com/linux-surface/linux-surface

comment 5y ago · link · parent

I'm not sure why you say it's a "quite safe" assumption that most games are written in C#. Unity's beginner-friendliness gives it a disproportionate presence online, while the vast majority of AAA games are still solidly C++.

If we eliminate all games with less than 1000 sales or something, I think it would be a very low confidence estimate.

comment 5y ago · link · parent

I did something similar with a Raspberry Pi and Waveshare e-ink display: https://github.com/makuto/home-life-display

comment 5y ago · link · parent

Yes, there's nothing in the language which is specific to games.

Once I get pure C output supported, it should be suitable even for embedded C environments.

comment 5y ago · link · parent

That's correct. My goal wasn't to make a CL-compatible Lisp. I imagine the code will start to look less like C as more macros/generators get added.

comment 5y ago · link · parent

Thanks! I have a list of similar projects, I will add these! https://github.com/makuto/cakelisp/blob/master/doc/VsOtherLa...

comment 5y ago · link · parent

Yes, they are compiled just like the final exe, only they become dynamic libraries that I load with libdl. On subsequent builds, they are loaded again, unless the macro changed.

comment 5y ago · link · parent

While I can't speak for any experimental new garbage collectors, I did analyze the SBCL generational GC's implementation. I encourage anyone interested in performance to look over GC code and realize how much work they are doing.

That GC in particular has to stop the world, traverse the entire fresh heap, guesses whether something is even a pointer (and can guess wrong, causing a memory leak!), and does all this at arbitrary times, unless you do non-idiomatic things like manage your own memory in preallocated arrays, or use C/asm-powered memory mapped buffers [0].

Nothing comes for free, and some domains can't pay the price for GC (and choose to spend those resources elsewhere). Games, in my opinion, are largely still in that category.

[0] https://m.youtube.com/watch?v=S7nEZ3TuFpA

comment 5y ago · link · parent

It looks like Cakelisp for Rust! I'll have to look at it in more depth. Thanks for the link!

comment 5y ago · link · parent

The big distinction to me is that there is a final executable that eventually gets created, whereas Lisp programs can continue to generate code and self-modify at runtime.

Cakelisp differs from Zig in that arbitrary code modification is supported, which is a step closer to the modifiable environment of Lisps. Very few languages besides lisp allow you to do things like "iterate over every function defined and change their bodies, and create a new function which calls them". Zig does not support that. It's extremely useful for some tasks (e.g. hot-reloading code modification, mentioned in the article)

Jai isn't out yet, but I was inspired by many of the comptime ideas.

comment 5y ago · link · parent

I agree. Templates make some tasks easy (type specialization and generic containers) but become tangled messes with other tasks (function bindings, serialization).

I used something similar to your technique for compile-time variable destruction. The compiler doesn't know the type, so a macro generates a callback which deletes a casted version. These callbacks are named with the type so they can be lazily added and reused.

comment 5y ago · link · parent

Carp requires writing bindings to call C functions or use types. Additionally, code modification isn't possible in Carp.

When I say seamless, I'm going for as close as possible, I.e. it should feel even easier to use C from Cakelisp than from C itself. The build system especially makes this possible.

comment 5y ago · link · parent

I do wish the C compiler was as fast as e.g. SBCL's compiler in terms of compile time, because multiple rounds of dependent macro compilation eats up a lot of time.

I think Lisps tend to optimize for throughput, but games have very strict latency requirements. Garbage collection pauses could cause frame pacing issues (not that C solves that completely, but it is at least not a built in disadvantage of idiomatic use of the language)

comment 5y ago · link · parent

Yes! You can typedef types and function signatures.

comment 5y ago · link · parent

Thanks! It is a bit different, and does require more typing, but I like how unambiguous it is. It also simplifies code modification by making type parsing and changing easier, because you can recursively unwrap multiple pointers, or pointer-ify things easily.

comment 5y ago · link · parent

See also on /r/gamedev [0].

After years of dealing with points of frustration in C++ land, I've created my own programming language. It emphasizes compile-time code generation, seamless C/C++ interoperability, and easier 3rd-party dependency integration. It's like "C in S-expressions", but offers much more than just that.

I had a hard time trimming this article down because of how excited I am about the language. Feel free to skim and read more in the sections that pique your interest.

I don't expect everyone to love it and adopt it. I do hope that some of the ideas are interesting to fellow programmers. I found it eye-opening to realize how much better my development environment could become once I opened this door.

[0] https://www.reddit.com/r/gamedev/comments/kh1p0a/cakelisp_a_...

30.

Cakelisp: A Programming Language for Games(macoy.me ↗)

178 points · by makuto · 5y ago · 64 comments

12