Войти в систему

Home
    - Создать дневник
    - Написать в дневник
       - Подробный режим

LJ.Rossia.org
    - Новости сайта
    - Общие настройки
    - Sitemap
    - Оплата
    - ljr-fif

Редактировать...
    - Настройки
    - Список друзей
    - Дневник
    - Картинки
    - Пароль
    - Вид дневника

Сообщества

Настроить S2

Помощь
    - Забыли пароль?
    - FAQ
    - Тех. поддержка



Пишет nancygold ([info]nancygold)
@ 2024-07-17 01:28:00


Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Entry tags:computing

Symta Rewrite Progress
Back at rewriting the Symta's runtime to support my flavor of ECS.
Surprisingly it mostly involves removing the stuff.
For example, every heap object has a header.
And I just keep removing the fields from it.

typedef struct { //object's header inside the managed heap
  uint16_t tag_obsolete;  //type tag
  uint16_t age_obsolete;  //heap generation age
  uint32_t size; //size of the object (not counting this header)
  void    *code; //point's to the closure's machine code or entity's id
                 //during gc if age=GC_MOVED,
                 //it points to the object's new location
} __attribute__((packed)) gc_head_t;


The two obsolete fields are already unused.
Yet I still keep them until I merge size and code into a single 8-byte value.
Because the heap and gc code deals only with 8-byte aligned units.

How I got rid of these? Well, originally I used raw pointers inside the heap.
But that was super inefficient, cuz all pointers were going into the heap.
So I replaced the pointers with 30-bit alloc-unit indices.
The 1,073,741,824 objects are more than enough!
Now I have enough space for 30-bit tags, which are mandatory for entities.
The gc_head_t's tag is constant inside a single GC cycle.
So I can move it into the tag space I just freed for entities.

What about age?
Well, due I implement inter-generational references using page table.
Every page can be dirty or clean.
Now since each generation is page aligned.
Therefore I can add a few `age` bits to that table.
Woohoo! No longer need to maintain the per-object age.

What about size? Well, code is a pointer too...
And we can be replaced pointers with indices.
These indices can be stored inside the tag space.
Now I'm left with the size only.
Most arrays and closures are small enough.
So we can push the size into the tag space.
Voila! Now need for gc_head_t or an allocation at all.

What else? Well a CONS pair can be packed too..
inside a single 64-bit array.
When the values are less than or equal to 30bits.


Why I haven't done that initially?
Well, I was a different person, blind to that.
Dumb and poisoned with testosterone.
So I wrote crappy code, wasting 16 bytes to hold 8-byte object.


(Добавить комментарий)


(Анонимно)
2024-07-17 02:10 (ссылка)
brainos:

"Well, due I implement inter-generational references"
"And we can be replaced pointers with indices."
"Why I haven't done that initially? word order

>Dumb and poisoned with testosterone.

But now you are a bona fide tranny autist obsessing about the useless stuff (premature optimization, engine/language sovereignty).

Anyway. Good for you.

(Ответить) (Ветвь дискуссии)


[info]nancygold
2024-07-17 02:34 (ссылка)
Well, with ECS I hit actual performance bottleneck and began using that code field to store tags...
That is horribly inefficient, given that all ECS objects are just ids. and I have millions of them.

(Ответить) (Уровень выше) (Ветвь дискуссии)


(Анонимно)
2024-07-17 17:16 (ссылка)
If you have performance issues with your 90ies level fidelity game on modern CPUs, than it was extremely poorly coded. And yes, "poorly coded" includes the use of unoptimized NIH languages.

>million

These are 90ies numbers. Million is 1000x1000 grid. This should fly with early 2000s Pentium processor, with whatever not completely idiotic architecture pattern.

Meanwhile there are numerous successful games and gamedevs, that didn't even know what ECS is (until it became extremely fashionable in the last 5 years). Unreal Engine 5 doesn't even have proper working ECS.

You've spent months on this shit, with tranny decompilation detours. In a non-degen actual work setting all the bottlenecks you are talking about would have been resolved in a week.

(Ответить) (Уровень выше) (Ветвь дискуссии)


[info]nancygold
2024-07-17 20:46 (ссылка)
I'm using interpreted language for everything.

(Ответить) (Уровень выше) (Ветвь дискуссии)


(Анонимно)
2024-07-17 21:30 (ссылка)
>NIH interpreted language

That's your main performance bottleneck. Everything else you focus on is impersonation of software development / putting lipstick on a pig.

(Ответить) (Уровень выше)


(Анонимно)
2024-07-17 21:42 (ссылка)
Why is it interpreted? I thought you compiled it down to C.

(Ответить) (Уровень выше) (Ветвь дискуссии)


[info]nancygold
2024-07-17 22:10 (ссылка)
I decided that interpreted is fast enough and doesn't require carrying C compiler around for the purposes of eval.

(Ответить) (Уровень выше) (Ветвь дискуссии)


(Анонимно)
2024-07-17 22:21 (ссылка)
You don't need eval in a videogame. And don't argue, you just don't need it. Also, eval could be done separately, leaving non-eval parts fast.

>interpreted is fast enough

Yes, fast enough that you have performance issues, and resort to bit packing structures, ECS, whatever.

Making a videogame in an interpreted language feels sloppy and insulting to me. You lose any right to say word "cache".

(Ответить) (Уровень выше) (Ветвь дискуссии)


[info]nancygold
2024-07-17 23:19 (ссылка)
Every video game needs eval at several places:
1. Running scripts
2. Console, which is helpful in debugging and R&D.
3. Parsing config files (in my case these use the same syntax as the Symta).

In fact, any complex enough project incorporates eval in one form or another.

(Ответить) (Уровень выше) (Ветвь дискуссии)


(Анонимно)
2024-07-18 01:35 (ссылка)
>Running scripts

Yes, non-trannies use jitted engines like luajit, Javascript, Webassembly, or .netclr in case when the engine itself is written in c#.

Using interpretation for everything "because scripting" is definitely tranny-think.

>Console, which is helpful in debugging and R&D.

can be used for debug and R&D only, which are expected to be slow. So any performance issues during development can be disregarded. It's the release performance that is important.

>Parsing config files (in my case these use the same syntax as the Symta).

Nothing good about executable config files. If these aren't executable, you can copy parsing code from the compiler, make it a library, and compile it natively.

...

And again having scripting doesn't mean that the main engine/game code itself should also be interpreted.

>complex enough project incorporates eval in one form or another.

Meh.

(Ответить) (Уровень выше)


[info]nancygold
2024-07-17 23:22 (ссылка)
>Yes, fast enough that you have performance issues, and resort to bit packing structures, ECS, whatever.

That is because I'm targeting Windows 98 and developing the language, not the game.
The was always a unit test for the language.

(Ответить) (Уровень выше) (Ветвь дискуссии)

tranny recreational programmer.
(Анонимно)
2024-07-18 01:54 (ссылка)
>I'm targeting Windows 98

In that case scripting is even less acceptable, since Windows 98 era hardware would just stall if you have performance issues on semi-modern laptops.

And again, "I'm targeting Windows 98", i.e. "I'm not actually developing a useful product" is a cop out, acknowledgment of your defeat, your inability to compete with the real gamedevs who earn money with their labor.

>and developing the language

You know it doesn't have a single real redeeming feature that would make it useful for anyone other than yourself. The language market is oversaturated, and full of extremely smart people with Ph.Ds -- see their latest attempts to make a language for gamedev [1] and even they will probably fail. Having it interpreted, i.e. slower than python, is a non-starter, and I don't see the point at all. You first have to have a good idea, then a prototype, and if it panned out, only than a full implementation. And usually this is for people employed by megacorps, or for university professors, both of which can have team of people to actually make it possible. No-idea NIH solo-reimplementations, and idiosyncratic ones at that, are entirely doomed.

>unit test

Unit tests for languages actually try to exercise corner cases.

[1] The Verse Calculus: a Core Calculus for Functional Logic Programming

(Ответить) (Уровень выше) (Ветвь дискуссии)

Re: tranny recreational programmer.
(Анонимно)
2024-07-18 02:11 (ссылка)
Recent semi-successful new languages:

Lean -- created by Leo de Moura, who is the creator of the famous Z3 SMT solver, and was employed by Microsoft research at its inception. Language is mostly uninnovative, reusing other's ideas, and blew up because it was more accommodating (than the coq people) to the oxford professor Kevin Buzzard, who had been butthurt by colleagues refusing to acknowledge their mistakes, and was searching for a way to formalize math. He created mathlib in lean, which now became the largest formalized math library. In 2023 De Moura created Lean-FRO using money from the Simons and the MacArthur foundations. It's now a language with its own non-profit, and a financing stream for several years.

Zig -- хуй с горы какой-то сделал, но у него была идея, которой не было у других -- comptime. Я вообще не фанат, но многим нравится. Тоже обзавелись фоундейшеном.

(Ответить) (Уровень выше)

Re: tranny recreational programmer.
[info]nancygold
2024-07-18 15:17 (ссылка)
I remember reverse engineer one game, called Lords of Magic.
All the game and UI logic in it was done using scripting.
That game ran under Windows 95 and 98.
Same with Baldur's Gate

Even performance critical DOS games, like Strife and Quake, used scripting

(Ответить) (Уровень выше) (Ветвь дискуссии)

Re: tranny recreational programmer.
(Анонимно)
2024-07-18 17:09 (ссылка)
I'm not denying scripting usefulness where it's useful. I'm denying it's usefulness for the main game loop, for the hot engine parts. "It's entirely scripted/interpreted" is nothing good. It's sloppy and lazy.

>All the game and UI logic in it was done using scripting.

Nothing good.

>Same with Baldur's Gate

It was laggy on the period hardware. Characters moved in a stuttery manner, constantly getting confused path wise. Heavy fighting scenes with lots of characters and effects slowed things down further. Not a shining example of performance conscious gamedev.

>used scripting

I know. Client code complied to VM. But the engine was fast, in C.

(Ответить) (Уровень выше)

Re: tranny recreational programmer.
(Анонимно)
2024-07-18 17:18 (ссылка)
And imho the best way to do "scripting", if you really want to do "scripting" that much, is to just code it for either jvm, or .net, (or equivalently fast jitted VM). That way you'd have engine code in say c#, with maybe certain performance sensitive parts in C++, like in unity, but not necessarily, and the "scripting" part in a dynamic language, but without any kind of issues with cross language memory management, need for reflection passes for C++ etc.

(Ответить) (Уровень выше)

Re: tranny recreational programmer.
[info]nancygold
2024-07-18 15:21 (ссылка)
Even more, a few 8bit games, like Habitat for C64, used scripting.

(Ответить) (Уровень выше)


(Анонимно)
2024-07-17 08:31 (ссылка)
Apparently, the Netherlands is providing your living well.
So you can devote yourself your time to your time-wasting thing of yours of wasting time.
Cheers Dutch cuckolds!

(Ответить)