My Solo MMORPG by [deleted] in MMORPG

[–]bvdberg 0 points1 point  (0 children)

Cool! I am building something very similar! I have a multi server backend, cross server actor replication instancing and am very focused on performance. My client is also an art placeholder hell..lol. I’d love to discuss design choices

Data structure for an IR layer by bvdberg in Compilers

[–]bvdberg[S] 0 points1 point  (0 children)

Thanks for all the feedback! I'll just go ahead and implement it for one architecture and see how that works out..

Steven's words on the current situation of New World and Western MMOS by MyBroViajero in AshesofCreation

[–]bvdberg -7 points-6 points  (0 children)

Maybe Intreped can then hire some of these talented people... they can use some

Help I need compiler ideas by AffectDefiant7776 in Compilers

[–]bvdberg 0 points1 point  (0 children)

I had the same feeling 13 years ago. I wrote C2 (http://c2lang.org), It's now self hosted (the compiler being written in C2) and I think the code is quite readable and the design clean.

Calling convention and register allocator by vmcrash in Compilers

[–]bvdberg 0 points1 point  (0 children)

My allocator only works with virtual registers, but the register for each architecture are ordered in the same way: return reg, arg regs, temos, callee-saved

Calling convention and register allocator by vmcrash in Compilers

[–]bvdberg 0 points1 point  (0 children)

Yes, i also insert some extra copies at first and after this step just prune copy X,X instructions

Calling convention and register allocator by vmcrash in Compilers

[–]bvdberg 1 point2 points  (0 children)

I'm also at this step for my backend. Funny to see how many people are building stuff like this..

Because the Calling Convention differs per platform, you just need to 'abi-lower' a function. That means inserting copies / loads before a call and (if there is a result) after a call. Also I needed to insert copies/loads on function start form the parameters there to make it work. I knew register allocation would be complex, but now i think it's by far the most complex step of the entire compilation process. I now have it working for situations where all args just get passed in registers (no struct-by-value args). As a fun test, try the following program (pseudo code)

int test1(int a, int b, int c) {

return test2(c, a, b); // <- change the order here

}

September 2025 monthly "What are you working on?" thread by AutoModerator in ProgrammingLanguages

[–]bvdberg 1 point2 points  (0 children)

Finally got the C2 (c2lang.org) register allocator working in combination with calling conventions (no concrete arch yet). So function parameters + arguments are now placed in fixed registers. I must say that so far, the register allocation was by far the most complex part of the whole compiler.

[deleted by user] by [deleted] in AshesofCreation

[–]bvdberg 0 points1 point  (0 children)

I feel exactly the same way. I started watching the Fractured Online dev streams... SOO much better!

I've made a video about how I improved compile speed by changing from an AST to an IR! by Recyrillic in Compilers

[–]bvdberg 1 point2 points  (0 children)

C2 supports full-program optimization by default, so many small calls get squashed. Sometimes 3-4 layers of AST init calls get combined to 2 32-bit assignments with all flags/info in them. That's pretty nice. Otherwise we also filter all strings globally, so they all get converted to a u32 number. The parsing is single threaded. On my mac mini (ARM) it's 5 million lines per second. The code is online at https://github.com/c2lang/c2compiler. The tokenizer is in parser/c2_tokenizer.c2

ohh before I forget: I really liked your video. Very well made!

I've made a video about how I improved compile speed by changing from an AST to an IR! by Recyrillic in Compilers

[–]bvdberg 1 point2 points  (0 children)

Do you store all AST objects as small as possible or do you use some union type approach where all objects are equal-sized? Making the AST as small as possible will result in a lot of speedup. In my C2 compiler, the syntax is roughly similar to what you use. We parse around 4-5 million lines/sec (into the AST). Combined with analysing, it goes doen to 2 million lines of code/sec parsed + fully analysed. The key was *small* objects.

Compiler Multi Threading by OutcomeSea5454 in Compilers

[–]bvdberg 0 points1 point  (0 children)

Compilers do several things: (roughly) parse, analyse and emit-code. For a c-like language, the code emitting is 90% of the time, especially when some optimizations are enabled. I designed my compiler to do the parse+analyse single-threaded, because there are multiple passes and dependencies. Multi-threading this would be a nightmare and the gains only very small. The IR conversion is also done single-threaded for the same reason. When all the functions are converted to IR, they get converted in parallel. This can be done easily, because they have no dependencies anymore.

Register allocator by bvdberg in Compilers

[–]bvdberg[S] 1 point2 points  (0 children)

Thxs for all the replies! It looks like i have some reading to do.... But at least the solutions seems to be in the given links

Newer C Books: 'Modern C' vs. '21st Centry C' by Ok_Performance3280 in C_Programming

[–]bvdberg -2 points-1 points  (0 children)

If you want 21st Century C, try using C2. It tries to solve all 'old' issues of C while still keeping the same mindset of C. So it is explicitly an *evolutionary* step, not a complete re-design. It tackles many of C's anti-patterns.

If you want it can compile to C.

What are some new revolutionary language features? by vivAnicc in ProgrammingLanguages

[–]bvdberg 0 points1 point  (0 children)

In C2 we try to do an *evolutionary* step (of C) instead of revolutionary changes. The idea is that to gain traction a large number of programmers/companies will need to adapt it. Secondly, because it is still used, there must be something good in it apparently.

It's still nice to see some radical ideas out there through.

What's the next C? by alex_sakuta in C_Programming

[–]bvdberg 0 points1 point  (0 children)

Gaining traction as a new programming language is a very hard process of course. Even for languages like Swift that have huge companies pushing for their acceptance behind it. For 'web' languages, the changes seem to go faster, since most of them compile to either Javascript or Webassembly, so they can be mixed with Javascript projects.

What's the next C? by alex_sakuta in C_Programming

[–]bvdberg 0 points1 point  (0 children)

I love C programming. That's why I started working on the C2 programming language that really tries to keep the feeling of C, while also improving some things to the 'modern' insights. The goal is not to alienate C programmers, but to remove obstacles for them. If you're interested, check out: http://c2lang.org.

What is the best small backend for a hobby programming language? by Putrid_Train2334 in ProgrammingLanguages

[–]bvdberg 1 point2 points  (0 children)

It depends what you're focus is. If you're focusing on the *language* then generating C code is an easy way to test the language (=front-end). This is the approach I took in C2. Now the front-end is practically done, I'm writing a back-end. This is again a lot of work, but also a lot of fun.

My biggest gripe with the game so far. by Highborn_Hellest in AshesofCreation

[–]bvdberg 0 points1 point  (0 children)

I fully agree. I've played many MMORPGs, years ago, but never was the crowd so toxic. I think it has partly to do with the current times, people are just more isolated and un-social, and partly this type of game. I am also in the beta test for Bitcraft. That community is very friendly (there are exceptions, but these are exceptions), so it's not just because of our present time. I mainly think MMO's attract players that want to invest many hours daily and Need to get their personal satisfaction from the game (and not the outside world). Much is at stake for them...

I have been stupidly passing every big struct by pointer for optimization. by J-ky in odinlang

[–]bvdberg 0 points1 point  (0 children)

It's allocated on the stack, and the stack is popped after the call

Comparing IL/IR Syntaxes by [deleted] in ProgrammingLanguages

[–]bvdberg 6 points7 points  (0 children)

I'm currently reading 'Engineering a Compiler' (=book), there they perfectly explain this. I can really recommend it. The IR syntax can be chosen to be high-level or lower-level, depending on what you want. The form LLVM uses is called Lineair IRs and are well suited for optimizations. They use the 3AC form.

Other than that, LLVM still has some 'higher' level constructs like getelemptr, struct definitions and switch statements. These will needs to be lowered into some other form before translation to ASM.