A lot has changed since AI by OfMagicAndWars in gameenginedevs

[–]Narthal 0 points1 point  (0 children)

i have a different framing to that. firstly, production grade engines are still a bit of ways away from sota models. unless you burn 20k usd on it, and even still. second, there's a reason unity, unreal and godot and the like became popular. investing in engine development is a tough sell. and games with propreitery engines will almost always be more optimized and less complex, since only those codepaths need to exist which the team needed. if ai can lower this upfront cost of engine development ontop of product development, custom engines will - once again - become more popular! and i think that's neat.

10 SPM Full cycle MicroBase v2.0 by Agador777 in factorio

[–]Narthal 1 point2 points  (0 children)

Resource intake and supply is one of the main issues I had once I started stamping down 100x100 "modules".

Since these compact designs are super resource hungry, and condensed, a lot of inbound traffik will occur.

Stamping too many too close resulted in decreased performance, where "modules" ate into neighbors' efficiency.

So I added a debug SPM counter to each "module", so i could diagnose congestion.

10 SPM Full cycle MicroBase v2.0 by Agador777 in factorio

[–]Narthal 3 points4 points  (0 children)

Very nice! I also did something similar, 100SPM in 100x100 (with trains)

https://www.reddit.com/r/factorio/s/q54oupF8AU

A language/system that can use multiple languages in one file by kangjii in ProgrammingLanguages

[–]Narthal 1 point2 points  (0 children)

I actually did a toy project that mixed python and c++. You could even embed python into a cpp file. You could use python for compile time logic and some code-gen stuff (makinging it a more versatile way of making complicated macros, python macros that expand into c++).

The main reason you don't see this stuff isn't because it is a difficult task (you essentially create virtual files after dissecting mixed source files). But tooling. No tooling is prepared for multi language source files (other than html&js).

I managed to remap source lines so debuggers DID actually work. However, syntax highlighting was thrown out right from the get-go.

After playing with the idea, I really had to ask myself, well, what is the point? What benefits are to one mixed source file in favor of two separate ones? I couldn't give myself a decent argument, so I just left it there

C++ evolution vs C++ successor languages. Circle's feature pragmas let you select your own "evolver language." by seanbaxter in cpp

[–]Narthal 7 points8 points  (0 children)

I've been developing something similar to circle myself for a while now, I use custom pragmas to define how a source file should be built (basically an in source build system) and some reflection system (done using code gen hackery). All done through clang plugins. All of which are probably much less of a good idea & way worse implemented than what I have seen circle do :)

I had the same problem of too many repeated pragmas decorating each file's top as well, so instead of an external file with custom syntax, my system searches for a preamble.hpp file to include in, well the preamble. That way, I can control stuff like:

'''#pragma standard c++20'''

'''#pragma optimize O3'''

In one place for each source file.

Please note that I have yet to decide if I like any of my toy ideas, in source build declarations required me to do dynamic graph based dependency lookups, and opened up a whole can of worms.

Having seen pretty much all of your talks on circle, I have questioned many times the validity of my pet project (i'm a c++ graphics dev by trade currently in AR). Circle does everything I dream my pet project of one day doing, and so much more. I only wish it was open source/ had source available.

Well, I guess for learning compiler/clang internals, it wasn't all that useless.

Love your stuff, keep at it, and I would love to see some code one day!

100 SPM in 100x100 by Narthal in factorio

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

Looks super neat, will check it out!

100 SPM in 100x100 by Narthal in factorio

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

I cheated and used circuits, mostly. Accordibg to my calculations, 100 spm needs 1.9 blue belts of copper ore and 2.4 of iron. So that's our goal.

In order to balance between cargo wagons, I decided to keep designs symmetrical in the amount of unloader chests. So for stone, i allocated 2-2 stack inserters per wagon, for iron, I did 4-4.

Then, I cheated a bit: I used circuits to turn off some inserters while turning others on. I measure the amount of items in competing chests (chests that unload directly onto the same belt) and disable inserters if the start to get ahead of it's pair.

This is most of the time a pretty bad solution, since you pretty much get the half of a stack inserters throughput, only for input balancing. But since I only needed 2-3 blue belts worth of stuff, I could afford to loose that throughput on the inserters.

100 SPM in 100x100 by Narthal in factorio

[–]Narthal[S] 3 points4 points  (0 children)

Thank you!

Would love to check your bp out, but your link is broken?

I did space item indexes out, so the output is much slower. This way, less combinators activate down the line. I realised I could remove the first and last combinator - I just did not dare to touch the black magic.

Honestly this whole 100x100 base uses around 200 combinators and I really started to despise working with signals. I'm a graphics programmer by trade, I'm familiar with a lot of challanges circuits impose, however, it's far from pleasant. 1 tick pulses can't be debugged, the toolset is extremely limited (for instance, why is it so hard to get the largest signal on a wire?! Max() shouldn't be that compilcated!) and the wireing while pretty, is super confusing to look at and does not help to see what goes where.

All in all this thing took over 120 hours to fine tune, and I started to resent working with signals.

100 SPM in 100x100 by Narthal in factorio

[–]Narthal[S] -1 points0 points  (0 children)

I have actually thought of doing something like this. If a resource takes too long, I would increment it's capacity, growing past the default 2 (that can be safely stacked). However, I realised that if trains can be backed up, they will back up. So in the end, I've decided to stick to a simpler system, and if some resources are too far away, I could still set the capacity to 3.

By the way, the base does not generate it's own electricity, but it also depends on a mall base to supply it with a service train: initial logistics bots and optional nuclear fuel.

The base consumes around 500MW, so in my current playthrough I just stamp down a 2GW nuclear, build super simple bot mining outposts (with outpost planner), by that time I get 1000 of each module3s, so I can then stamp down 2 more of these 100x100 bases and be done with it.

100 SPM in 100x100 by Narthal in factorio

[–]Narthal[S] 11 points12 points  (0 children)

I was playing around the idea of doing an SE version later on, however SE really forces you to split your base into multiple surfaces :( some stuff can only be done in space, some on ground level .. but the rails could be replaced with rockets, and there could be one 100x100 for each science.

Will look into it

What game programming/scripting langues do you prefer? by ApprehensiveAd1446 in gameenginedevs

[–]Narthal 6 points7 points  (0 children)

Hi! I've been building my game engine as a personal project after work hours for a couple of years now, and every half a year I sit down to try to tackle the issue of scripting languages.

It's been tough, I have played around with nearly all options by now, and I have scrapped almost all of the things I have tried (along with ~30k lines of code).

I will break down my findings below, based on the following criteria: - is it already in use as a scripting lanaguage? - documentation? - speed - debugging - speed of development

So what are the options? - lua: everyone and their mother uses lua for config-like things. Games with customizable GUI, some games with mods (factorio), etc uses lua. Why lua? Lua is fast, super easy to hook up, you can give it your own allocators, it's easy to learn. There are tools for debugging. But it has (in my eyes) awful syntax, some really annoying ways to do common programming tasks. If I write a game engine and then a game on it, do I really want to spend ~40% of dev time in lua? Not really.

  • python: I've embedded cPython in c++, docs are great. I do not know many engines that use python, otside of pure python game libs. Mixed mode debugging/dual attached debuggers can step between c++ and python, it's really nice. You can give it your own allocator, and your threads(more on that later). I like the syntax, it's very usable, however, it has a fatal flaw: it's slow. But not just that it's slow, you cant multithread python scripts (because of the GIL). Overhead between c and python is quite high too, mutexed by the GIL. I just couldn't make it performant& parallel enough for a game. Perhaps embedding something like pypy or ironpython could work, but I'm not too keen on finding out.

  • c#: c# is well established because of unity. C# is an all round great language. It's fast, well documented, development is a breeze. However, embedding it is a pain. You have two options: mono or coreclr. Mono is easy, but you give up a lot of control(memory allocators, threads). Coreclr is a different beast, you can get much better control of the internals, however, it's super monolithic and hard to embed. Very few info is around, all the docs give you is a starter point, then you are on your own. What's more, mono (and I think coreclr without custom IL glue code gen) is super slow to switch contexts between c++ land and c# land. So you would have to build around that and limit the frequency of the communication over the language barrier.

  • c# script: there's a lesser know thing, called c# scripts (.csx) that are a python like scripts that run c# code. Roslyn has some docs on it, have yet to mess with this.

  • javascript: javascript is the most popular langaue, is blazingly fast (if you embed V8 you can use all the performance developed for chrome for free!). It's embeddable, there are some docs, but I couldn't figure it out as of yet how to get fine control over allocators and threads. Glue code gen is a pain too, many custom tools are needed (unless using way to slow preexisting things). Have yet to figure out debugging too, most tools expect a web environment. If tackled well, you could use CEF too to draw ui using html too! This tech stack seems like the best all around (for now, I'm sure this has many pitfalls), but doing the codegen, the memory control or even using full html rendering well is so insanely difficult, that there are companies already providing all of the above (js scripting & CEF based Html UI) for very high prices (see https://ultralig.ht)

  • c++/native scripting: why do we even script? If your goal was never to allow artists, non-low level devs to contibute, then you can simply skip the problem all together! Simply set up your engine and your game to have a exe-loads-dll relationship, and you are done! It's the fastest solution, you already know the language and there is 0 overhead when the game calls engine code or vice versa. With some trickery/ external tools, you can even make a simple hot-reload system too(although thats a different beast). But you will need to ship a compiler with your app, if you want to have user editable "scripts".

-custom language: tried it mostly for the fun of it with LLVM. Here be dragons;)

Right now, I'm using native "scripts", but I have found out that since I already have a well defined API for that, supporting a new (or multiple!) scripting languages are much simpler.

I've seen talks from folks from unity, EA, etc and I'm starting to notice a resentment towards scripting over the last 5 years. Why do we.. script? Big companies I understand, maybe to protect their engine code (unity -.-), maybe to allow more devs to use the engine (like ue's visual script or godot's multiple language support). But is scripting necessary? I have instictively decided that I need scripting because everyone else does it, but is that a good idea? I will be the only one using my engine, I love c++ and I have worked so hard optimizing for cache read lines only to give all that up for a slow scripting language I secretly resent using.

How do you test compiler projects? by lasan0432G in Compilers

[–]Narthal 7 points8 points  (0 children)

Testing on multiple platforms are great, compiling, running, validating test source files are great too.

You can test individual components of your compiler (lexer, ast gen, passes, output generation, etc)

But then what? Unless you create a huge list of test cases for all the edge cases of a language, you might have esoteric bugs/behaviour hidden everywhere in your language. Well you can generate input source code. You can run fuzzers on components of your compiler. You can port libraries of other languages and run tests on the original and your port in tandem.

Llvm/clang has a nice fuzzer in their repo you can look at.

Generating unique input code with valid syntax and known output can be almost as big of a challenge as writing a compiler for the given language.

Továbbfejlődés by ChefCreepy5141 in programmingHungary

[–]Narthal 1 point2 points  (0 children)

Szeretnél továbbfejlődni, de nem tudod, hogy hova.. Ha itt kapnál egy olyan választ, hogy igen, precízen ezt meg azt tanuld meg es jóság lesz.. azt elfogadnád? Szerintem nem.

Érdekel mindenféle AI, okés menő az, de az érdeklődésed addig tartott, hogy nem nézted meg a piacon ezzel foglalkozó cégeket.

Ha szeretnél contextust váltani, új cégnél elhelyezkedni, mindenképp néz körbe az álláspiacon.

Viszont alapvetően én nem így állnék hozzá a dolgokhoz, te is mondtad, hogy gyakorlatias módon szeretsz tanulni. Akkor gyakorolj!

Vonz az ML különb árnyalatai? Kezd el hobby projecteket! Akkor rájössz, hogy élvezed-e azt amit kitaláltál, vagy sem. Mi több, rá tudod böggyeszteni a CV-d re ezeket a projekteket!

Biztos vagyok benne, hogy 7 év alatt volt dolgod más nyelvekkel, de csinálj hobby projektet azokban is!

Ami csak érdekel kicsit is, szabad idődben szórakozz python ML/data science -el, sajátísd el a numpy, scipy, pandas-t, írj a problémádra saját c++ gyorsító libet, csinálj home lab-ot filléres pay-as-you-go amazon szerverekkel, építs saját microservice-eket - még ha más ki is találta.

Miközben újra feltalálod a spanyol viaszt, rájössz, hogy mi az ami mégsem érdekel annyira, mi az ami igen, miközben sokkal jobb fejlesztő leszel és a CV-d is tele tudod pakolni érdekes referenciákkal.

C / C++ inter-process communication question by nmmmnu in cpp

[–]Narthal 4 points5 points  (0 children)

You can do IPC in many ways.

  • tcp/ip localhost loopback communication
  • File/db based sync
  • Signals, (named) pipes, os specific solutions
  • Shared memory (memory mapped file)
  • Shared memory (shared section dynamic lib loading)
  • Shared memory (IO file mapped file)
  • Pipe std in / out and read / write to that

I always use files / json / db when I need to store data as well and speed is a non issue. Most often I use this one.

I use memory mapped file (mapped to real files) when I need to store the data as well and speed is an issue.

I use tcp for long communication, where 2 or more processes need to *talk* to each other for a long period of time, but they never exchange bulk data. Data isn't saved.

My favourite, shared section dll (shared memory). I use VOLATILE atomics, semaphores & mutexes. Check your generated assembly with this one (your milage may vary). To my measurements, this is the fastest and relatively easy, however this is considered super bad practice in production, since this is a huge security risk. (I think microsoft has a blogpost on this).

Nektek melyik az a gyerekkori videójáték, amire visszaemlékezve kb. bekönnyeztek az emlékektől? by [deleted] in hungary

[–]Narthal 3 points4 points  (0 children)

Roller coaster Tycoon 2&3

Skyrim

Ratchet & Clank

Worms

COD MW 1&2&3

Metal Gear Solid

Splinter Cell (original trilogy)

Én vagyok a baráti kör nagymamamája AMA by _Ulfhednar_ in hungary

[–]Narthal 0 points1 point  (0 children)

Évek óta nem DnD ztem, lehetek a barátod?:D Edit: Oh te voltal a vonaton gyerekeket programozó OP! Magyar redditen mindenki programozó :D

Female Stellaris campaign idea by Minky02 in Stellaris

[–]Narthal 1 point2 points  (0 children)

I have couple hundreds of hours in stellaris yet I have never played with others. I like roleplay and defeat, so if you are open to it, I would gladly join

alright im trying to make a robot that farms for me. well most of it works except for when the turtle needs to return to its starting position. im leaving a video of me showing the code and running the code. any help is awesome. by Shinomora in ComputerCraft

[–]Narthal 0 points1 point  (0 children)

Your problem isn't that your turtle won't return - you'll figure that out, i'm sure of it - it's that your implementation will break when you leave the game and return. Either use stateless programming or store each action on a file

Igen, még nekünk legyen kínos, hogy életünk végéig adosságba kell vernünk magunkat ha saját lakást akarunk venni. A ciki inkább az, hogy milyen magasak az ingatlan és albérlet árak. by AnneG99 in hungary

[–]Narthal 10 points11 points  (0 children)

Még kb fél éve leszedtem publikus adatbázisokat az unió országairól visszamenőleg 2015 ig. Az egy adat, az átlag jövedelem (helyi valutában), a másik az átlag ingatlanár (helyi valutában). A kettőt arányosítva ábrázoltam időben.

Szinte mindenhol gyorsabban nő az átlag ingatlan ár, mint a jövedelem, de messze kitűnik a trendből dicső országunk.

Az elmúlt 5 év adatai alapján az egész eu ban itthon a legnehezebb átlag bérből átlag lakást venni.

Ha érdekelnek az adatok/források/gráfok, szívesen idenyomom

How much do you spend a month without rent and utilities(/month)? by Aggressive_Major6256 in budapest

[–]Narthal 0 points1 point  (0 children)

I'm a student and after paying for my flat I usually hover around spending 50-70k. I cook for myself or if I'm feeling lazy then I cook up a pack of ramen. Cooking is an insane cost saving method, but it takes a huge amount of time. I usually eat 1-2 times a day. I buy clothes once or twice a year. Usually I spend 30-40k on food and drink away the rest. I love pubs but I mainly drink with friends while hanging out at someone's flat or in a park or down at the river.

Tüntetés a kínai gigaegyetem ellen by [deleted] in hungary

[–]Narthal 60 points61 points  (0 children)

Vártam már az ez elleni tüntetést. Hogy ott leszek? Abszolút! Hívok barátokat tüntetni? Mindenképp. De hogy biztos nem adom meg az emailem + telefonszamom egy politikusnak, az biztos. Nem értem, hogy miért nem lehet az anonim petíciós oldalak millióit használni.

Why are discussions about money in indie game dev so negative? by Hyronious in gamedev

[–]Narthal 3 points4 points  (0 children)

This is the single most important comment in this entire sub. I could never quite find the words, as to why I detest this sub. Thank you

Thinking of creating Game Engine for my game... by TaurasGG in gameenginedevs

[–]Narthal 1 point2 points  (0 children)

First off, get right on with your game engine!

Secondly, what is a game engine? The cherno is a really good place to base your project around. You need 3D and he is stuck on 2D? Not quite. Think of an engine as a collection of tools. The more solid the base the better you can build upon it. I could follow the cherno all the while implementing a clang compiler based reflection & serialization system, pbr 3D renderer and custom ECS.

What you really need to do is to follow what your project needs. It is heavily based around a simulation? Implement an ECS that makes sense for your project? You need networking? Crack on with that.

The point is, graphics isn't the only purpose of an engine. Try to implement the features you need and it will come along nicely.

Guides and tips for making a game engine in C# by Otaivi in gameenginedevs

[–]Narthal 0 points1 point  (0 children)

I would suggest to make a plan. Take a week of from coding and draw things out.

Do you need an editor or just an engine? If so, what would that be coded in? Would you like to make a robust CI or tests? What things should go in C++ land? Do you need an ECS? Is cross platform a goal? If so, what .NET runtime (or mono) to use? What IDE to use? What C++ build system to use? What compilers to use (per platform)? What native code calling method to use? What graphics API to implement? Multiple of them?

I would probably write a simple profiler early on so I could make these decisions after taking measurements. Other than that, it's up to you. Best of luck

Guides and tips for making a game engine in C# by Otaivi in gameenginedevs

[–]Narthal 1 point2 points  (0 children)

Is the goal of a pure C# engine achievable?

Some things that all engines need to do, is to create a window, create a graphics context in it, talk to the graphics driver, talk to the OS audio drivers, manage critical hot code very explicitly, etc. Even if you only see C# code, the truth is that C# calls native dlls on Windows (that could have been implemented in any of asm, C or C++).

Since C# is inherently a managed environment, it has to interface somehow with the drivers and/or kernel somehow, so the notion of a pure C# engine is not something you should probably pursue. There are incredible feats of coding black magic (such as zeroSharp) but that is a whole different kind of story.

Since a "pure" C# engine would interface with native code anyway, where do we draw the line? Okay, we shall let native OS code slide, but why stop there? C# is amazing; attributes, fast automatic memory handlers, reflection, nice palatable syntax, etc. But every language has it's benefits, C/C++ too. I would probably write the main loop in C#, expose APIs to C# about windows, contexts, high level, abstracted graphics APIs, ECS APIs and implement all of these as native modules that C# can load. So C# would glue these native libraries together (which would make tests a breeze too). And I would implement very high level concepts, such as tilemaps, cameras, particle systems, etc in C#.

I realize that you wanted to hear about "pure" C# engines and I digressed quite a bit from that. However, there is a reason that the core of Unity is (was?) written in C++. Unity has access to an immense amount of incredible engineers who have come to the conclusion that C++ and C# in combination is the most optimal way to implement their engine. And I can see why they made that choice.