[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1728179851816178.webm (1.62 MB, 1008x728)
1.62 MB
1.62 MB WEBM
Michaelsoft Binbows™ 2000 edition

/gedg/ Wiki: https://igwiki.lyci.de/wiki//gedg/_-_Game_and_Engine_Dev_General
IRC: irc.rizon.net #/g/gedg
Progress Day: https://rentry.org/gedg-jams
/gedg/ Compendium: https://rentry.org/gedg
/agdg/: >>>/vg/agdg
Render bugs: https://renderdoc.org/
Previous: >>102669668

Requesting Help
-Problem Description: Clearly explain your issue, providing context and relevant background information.
-Relevant Code or Content: If applicable, include relevant code, configuration, or content related to your question. Use code tags.
>>
The correct wiki link is now in the OP.
>>
>>102704929
The screen tilt is sickening. Don’t do that.
>>
>>102704929
>/agdg/: >>>/vg/agdg
>mentioning /agdg/ again
can't expect anything right out of a retarded tripfag
>>
>>102705035
he started this thread bro
>>
>>102705035
Why does this upset you?
>>
>>102704929
goys is it a feasible thing to make a parallel software scanline rasterizer?
>>
>>102705090
yes
>>
>>102705097
i've not found many implementations of it even though i know it's been done for sure by the nintendo ds hardware (maybe not in parallel)
>>
Reposting from last thread.
I am once again asking:
legacy opengl, modern opengl, or vulkan?
I've noticed some pros and cons for each api.
Vulkan:
>pros: versatile, performant, you can do even more with shaders than gl3
>cons: PITA to set up, even drawing a simple triangle takes ~1000 lines of boilerplate or so, you have to compile shaders offline
Modern OpenGL:
>pros: opengl with shaders instead of the legacy immediate mode api
>cons: it's opengl with shaders instead of the legacy immediate mode api
Legacy OpenGL:
>pros: easy as pie to set up, and also easy to draw shit
>cons: it's rather limiting and there are no shaders; plus, some graphics techniques such as shadows are rather hard to do in legacy opengl
>>
>>102705328
>you have to compile shaders offline
Not true. You can compile at runtime. But the point is that you have to compile.
>>
Queen of /gedg/
https://www.youtube.com/watch?v=xOaztlVzoMs
>>
>>102705328
How do you expect anyone to answer your question if you won't say what you want to do?
>>
>>102705427
awww how cute she's LARPing as your ciborgfu, it's like chatgpt but you can put it in her pussy
>>
>>102705457
I want to make a 3D game at 320x180 resolution with NDS-tier graphics, but with lots of objects rendering at once per frame (like say, ~30 characters alone, and that's just characters), and maybe with some effects that I can get away with at a low resolution (such as raytracing for shadows/lighting instead of relying on shadow maps or shadow projection).
So with the "advanced effects" thing, I might have to use modern opengl or vulkan, but I'm not sure
>>
>>102705476
30 characters is not a lot of characters
If you want to do raytracing at that low of a resolution you might aswell just write a software renderer
>>
>>102705328
>>102705343
I have some further points. I don't see why you would even consider legacy.

> no shaders

Shaders are cool, no shaders should be a dealbreaker in most cases. If you really need to avoid boilerplate, and it's not like modern opengl has much boilerplate, then just use a framework like sokol or raylib.

It's not just a lack of shaders, there are performance benefits as well.

>>102705476
> that resolution
Modern opengl should be fine bro. Do you have experience with Vulkan or OpenGL at all? If you have zero Vulkan or OpenGL experience I think it's a good idea to practice with OpenGL.
>>
File: file.png (113 KB, 1281x712)
113 KB
113 KB PNG
>50 000 shaders
what the actual fuck? why is this even a thing? I knew about the Uber shader problem but this is even more retarded
>>
>>102706076
https://en.wikipedia.org/wiki/Combinatorial_explosion
>>
>>102706076
>I knew about the Uber shader problem but this is even more retarded
the uber shader problem of branching doesn't meaningfully exist anymore except on ancient gpus
use uber shaders
the only reason not to is because your shader artists are generating them via shader graphs and it becomes a mess to set them up as part of an uber shader
>>
>>102705343
I mean technically opengl shaders are compiled as well, just not as slow
>>
File: file.png (688 KB, 1898x905)
688 KB
688 KB PNG
>>102706717
>https://youtu.be/oG-H-IfXUqI?t=639
the shader situation is completely retarded
my question is "why?" to begin with, just why and how do you end up with thousands of shaders in the first place? and how do you avoid it?
>>
>>102705328
alright anon, I'll pick for you.
do vulkan, legacy opengl is retarded and from your post you seem to dislike modern opengl
>>
>>102705470
>she
>pussy
>>
>>102707112
I would bet on both yes, prove me wrong
>>
>>102707027
think of the unreal material graph. this not only exposes arbitrary shader authoring to artists; it's the primary interface, even for something as simple as binding a single texture. this means that the easiest, most straightforward way to author an asset involves creating a unique shader, just for that asset.

now imagine a AAA game. imagine hundreds, if not thousands of new assets getting checked in *every week* during full production, each with one or more unique materials (and thus unique shaders), each with potentially multiple permutations. now imagine how huge and entrenched unreal 3/4 were, and how many engines copied its workflow -- why wouldn't you want to give your artists the full power of a programmable GPU?

a few exponentail increases in scale later, and you have your answer.
>>
>>102707214
I'm just going to say it.
Shader graphs are evil ...
>>
>>102707164
he literally has that tranny line on his face
>>
>>102707214
>>102707027
follow-up post: for godot specifically, the engine *can only* ingest shader source code as the representation of a user-space material. its standard material, which it expects you to use for the majority of your work, will generate unique shader permutations for almost every possible configuration of settings. there's a quick and dirty cache in place -- as part of the standard material implementation, which is insane, but that's another story -- but this is still going to lead to an explosion of permutations for anything but the smallest toy game.

note that godot's *shader cache* and *pipeline cache* are two separate things. the pipeline cache integrates with vulkan's support for a PSO cache, and can at least be saved to disk once built. the shader cache is entirely an implementation detail of the standard material, and is rebuilt anew every single time the game runs. god help you if you're also making heavy use of custom shaders.
>>
>>102707266
proof: not found
>>
>>102707027
>how do you avoid it
materials have a material ID
your shader uses that ID to decide what to do
that's it
that's your uber shader when it comes to any material-dependent passes
an indie game shipping with more than like 10 shaders (including compute, mesh, vert, frag, depth prepass, shadowmapping etc across several passes) is wild
go uber
go bindless
>>
Just tried UE5:
>Z is for up and down
>Have to close the editor every time you want to use C++ and reopen after compiled
AHAHAHAHAHAHAHA
What a piece of shit, no wonder why every game sucks nowdays.
>>
>>102707399
>this man is singlehandedly leading the revolution of DIY game engines by torching his own
>>
Just showcasing two roofs intersecting with each other.
Instead of going will tiles like I shown previously, I decided to go with each roof being a mesh and allowing them to be intersect each other. This will allow multiple type of roof and with different gradation to go with each other to form more complex roof geometry.
Also the tool to place roofs is simply going to be click & drag. It should be nice.
>>
>>102707391
>materials have a material ID
I'm a bit new so forget me if I'm misunderstanding but, isn't this already the case with texture binding? You just reuse the same program/pipeline already cached and just change the textures depending on the mesh you are drawing?
>>
>>102705427
mommy
>>
>>102707214
>>102707314
It finally makes sense so thanks, but what the fuck? I guess this is what you get when you give artists a visual graph editor for every material.
>>102707391
So this is why they do a multi pass stage rendering every group of materials into their own texture.
I figured that's the most sane way to handle materials is by grouping them and using parameters to change their look (grouping metals, leather/skin like.... etc).
And those are separate to lighting and post processing passes.
That leaves compute shaders, at which point do they get to run then?
>>
>>102707613
you can also bind a texture atlas/mega texture or texture array and index into that with a texture ID
point being you don't have to "bind" a resource ahead of a drawcall, you can just bind everything and use indices at drawtime to dynamical access the texture and choose what operations you want your shader to run
>>
>>102707648
>That leaves compute shaders, at which point do they get to run then?
whenever you need them to
like if you're culling in compute you'd want to do that before your other passes and use the appropriate resource barriers to synchronize them in your command buffer
>>
>>102705427
tscoding sister? Is she single?
>>
>>102707662
And then how do you modify this indices in real time? With a uniform or a push constant?
But again, I feel like what you described was a none issue since descriptors were already doing that.
The problem with shaders is that everytime an artist makes a material, it's a different vert/frag shader which needs its own pipeline/shader to be compiled and then executed.
>>
>>102707795
>The problem with shaders is that everytime an artist makes a material, it's a different vert/frag shader which needs its own pipeline/shader to be compiled and then executed.
yeah you just have a minimal number of pipelines (one per pass really)
you write the indices with a ssbo filled with draw data
look into indirect draw
>>
>>102707795
>The problem with shaders is that everytime an artist makes a material, it's a different vert/frag shader which needs its own pipeline/shader to be compiled and then executed.

this isn't necessarily the case. "uniforms" are designed specifically to prevent this from happening; the idea has been there since the beginning.

if you don't want artists authoring custom shaders arbitrarily, don't allow artist to author custom shaders arbitrarily. this is what games used to do before unreal 3: provide a small set of flexible materials that artists can provide with textures, UV scales, and other kinds of unform data; and if they want something fancier, ask a nearby engine programmer to carefully author one (1) new shader to capture exotic cases.
>>
It's got nothing to do with artists you idiots
it's shader permutations vs ubershaders
use an ubershader and its not a problem
>>
>>102706076
This is a cost of using generalized solutions for specific tasks without having a tech supervision. By 'tech' I mean someone who develops their engine. It is one of the reasons why I'm making my own and why id could make Eternal with 100 or so shaders, while studios overrun with artists 'need' xir to have a different shader on every pube in a sex scene.

That, and when you want to do something out of the ordinary in a generalized engine, you're fucked. It's like writing performant code in python. Technically possible. Technically.
>>
>>102708281
>t's like writing performant code in python. Technically possible.
its not
>>
>wanted to try out Godot
>the great banwave happened
So... Should I use Monogame/LibGDX/Raylib or somethin?
>>
>>102708291
It is possible you just have to write it in another language and call it from Python kek
>>
>>102707391
This post, while true, exposes how messed up GPU programming is. What is, essentially, calling a program on a buffer of vertices turned into a dark art for the twisted and depraved.
>>
>>102708291
Well. Language does not decide whether a program in it is or isn't performant. It is the underlying implementation that does so. So _technically_ you could write an optimizing compiler into the LLVM bytecode and produce native from it, which should be quite fast.

But that is, as we say, reaching into the right pocket with a left hand over your back. You can, but shouldn't.
>>
>>102705328
>no shaders
That’s a dealbreaker
>>
>>102708367
it doesn't matter. pick something and make your game with it. whatever you pick, you'll hate it, so get over it and make your game

if you can't get over it, you don't want to make a game, you want to make an engine. now you have a different set of problems
>>
>>102708451
>https://registry.khronos.org/OpenGL/extensions/ARB/ARB_fragment_shader.txt
>https://registry.khronos.org/OpenGL/extensions/ARB/ARB_vertex_shader.txt
>OpenGL 1.0 is required.
technically you can abuse ARB extensions on legacy OpenGL, you'd be both insane and a genius for pulling it off. I managed to do something similar on OpenGL 1.4 but I wouldn't say I enjoyed it, some features are missing and there are little to no learning resources for it.
It's a good challenge tho.
>>
>>102705328
>Vulkan:
>>pros: versatile, performant, you can do even more with shaders than gl3
>>cons: PITA to set up, even drawing a simple triangle takes ~1000 lines of boilerplate or so, you have to compile shaders offline

Vulkan has been designed ( for better or worse ) to be an API for implementing an API. You can consider it a tool to reimplement OpenGL or, with regards to this thread, to write abstractions custom to whatever engine you want to create. Shaders can be compiled at any time. Parts of the Vulkan I use ( like pipelines or viewports ) machinery are being created lazily in my engine.

However, if you just want to fuck around 3d graphics, opengl is probably a pill easier to swallow.
>>
File: 1672829417474899.jpg (168 KB, 1080x1232)
168 KB
168 KB JPG
What are you working on /gedg/?
>>
>>102708626
Still on 3D clone of OpenTTD.
>>
>>102707795
whatever you want
i would suggest a buffer device address in a push constant (i.e. vulkan's version of a pointer in a shader) which points to a GPU-side parameter structure instead of an SSBO
use buffer device addresses for regular numerical data
>since descriptors were already doing that.
descriptors in unextended vulkan are fucking terrible
you have all this nonsense abstraction over what are in the hardware pointers (buffers), fat pointers with configuration data (textures), and config structs (samplers)
and you have to jump through like 9000 hoops to allocate what is just GPU-side memory, not to mention weird overly aggressive rules about uniformity that have no reason to exist

for things that need descriptors, if you can, use descriptor buffers ( https://www.khronos.org/blog/vk-ext-descriptor-buffer ), or at least the bindless extensions that laid the groundwork for them so at least your shaders can be free of some of the nonsense
they are much cleaner and actually closer to the implementation, the only reason descriptors are as complicated as they are is because of shitty obscure mobile GPUs and maybe older integrated graphics
>>
>>102708626
Some features for the game cameras and on the way the cache loads animation definitions
>>
>>102708626
so you can steal my idea? NEVER
>>
>>102708442
>>102708601
what is the point in making these hypothetical posts
>>
>>102708210
most anons here probably write their own shaders but in almost all the games people complain about artists are the ones writing shaders, in node graph editors, you dingus
there's nothing wrong with them in theory but whoever made the tools either has no idea how modern GPUs work or is too stupid to write a code generator that can produce an ubershader
as far as i've heard existing editors are terrible and can only do extreme shader permutation

might be part of the reason behind the semi-recent opening up of device driven dispatch to graphics APIs, in theory you could just get away with the base nodes being the only shaders necessary, all the tools would need to do is spit out an execution graph
>>
File: 1723031716057347.jpg (87 KB, 1234x694)
87 KB
87 KB JPG
Finally managed to draw something with wgpu and c#
>>
>>102708860
Artists using visual shader creators is not the issue at all, complete red herring
The issue is if you have shaders which are generated via permutations you end up with a combinatorial explosion
This used to be how you wrote shaders because branching was expensive, now branching isn't so expensive so you can write one big shader with branching
>>
File: 1472583698242.jpg (80 KB, 806x720)
80 KB
80 KB JPG
>added another 500 static_casts to the code
>finally no more warnings
i love c++
>>
File: 1728245988928.png (69 KB, 1499x856)
69 KB
69 KB PNG
>>102708626
I have added template events to my rpg maker, which will in theory allow for the user to store events that are very common but not exactly the same, for example enemies. though at this point I only have support for two different types of widget types. But it should be easy to add more later on
>>
>>102708981
Damn, my post has a very shitty grammar. I must be tired
>>
>>102708626
roofing
>>
File: file.png (49 KB, 1199x333)
49 KB
49 KB PNG
>>102708601
to put it into perspective, I had the Q31 chipset for the longest time, I always avoided OpenGL, people forget how shitty OpenGL drivers were back in the days, for some goddamn odd reason, intel driver supported OpenGL 2.0 on linux but only 1.4 on windows.
I think the weirdest thing is that emulators worked fine, NDS games with fancy shaders? worked fine, PSP games? Danganronpa and Persona games worked fine. Even league of legends was playable on 25 FPS before they broke compatibility.
iirc most games did fancy vertex effects by simply dividing the mesh and animating the vertices on the CPU, it worked for underwater wavey effects (Aquaria game).
I never had a problem with Gamemaker games because they used DirectX backed, I could even tweak and disable some flags if something crashed. XNA was the biggest CHAD framework because all XNA games worked, shaders and all, while OpenGL 1.4 didn't even support fucking textures rendering targets.

>just stop being poor bro
I'm just pointing to the absolute state of programming, we're evolving backwards, you're telling me I can play every japanese visual novel under the sun, and emulate games, but can't even start native games? we had amazing effects with Flash in the browser ffs.
not to mention that integrated GPUs sucks hard on every mass production desktop. I think you can triple the playerbase just by targeting DirectX9 (including for linux lmao), and at least provide a way to disable expensive shaders, maybe the game won't look the same, but playing the game at all is always a great thing.
>>
File: template events test.webm (956 KB, 739x589)
956 KB
956 KB WEBM
>>102708981
here it is in action
>>
Why aren't you programming in lisp?

https://github.com/Shirakumo/trial
>>
>>102708925
>The issue is if you have shaders which are generated via permutations
which is what most current visual shader creators generate
https://dev.epicgames.com/community/learning/knowledge-base/6PxP/unreal-engine-understanding-shader-permutations
although apparently it's worse than i thought and apparently unreal just generates additional permutations at the drop of a hat
>>
ubershaders are slow
>>
>>102709081
Because I only know C++.
>>
>>102709107
>So for a simplified example, if the project allows static lighting, and supports atmospheric fog, we need to compile the Statically-lit, Atmospheric Fogged version of the material, the Dynamically-lit and Atmospheric Fogged version of the material, as well as Statically- and Dynamically-lit versions of the material that aren’t affected by Atmospheric Fog.
lol, lmao even
>>
What's the current industry standard for indie game dev? I thought it was Godot but now I'm super lost. I just want to make my bloody game.
>>
>>102709853
raylib
>>
>>102709853
C + raylib
>>
>>102709341
myth perpectuated by gamedevs
take a look at some CUDA (or AMD's equivalent, HIP) code, guess what: it branches
if it's okay for high performance compute code to branch at runtime it's okay for a game to
modern GPUs have all sorts of ways to handle conditionals in smart ways like universal hardware acceleration for branchless vectorized conditionals, complex relative indexing instructions, quick branching instructions for local branches, vectorized instructions for things shaders assume aren't and more
vulkan extensions only expose a small subset of what they're capable of
and even if you do trigger a real branch, and it's a non-local branch, if you do it at the right granularity you're only ever going to affect 1 warp, 32 threads, out of thousands or even tens of thousands and the hardware has plenty of ways to hide that latency to boot like scheduling another invocation on that core or executing other instructions until it hits an execution barrier blocking on that operation

meanwhile swapping between tons of different shaders rapidly can trigger a GPU context flush which is actually expensive
>>
>>102709060
I had a shitty atom/GMA 3150 netbook as a kid and it radicalized me to optimization, but ironically now I think that those are such irredeemable pieces of shit its not even worth it, they get mogged by computers 8 years older. Literal ewaste even if its kind of fun to fuck around with one.
>>102697451
>the sd card to ide adapter in this computer committed suicide hours after i posted this
It's so fucking over
>>
i should really finish doing those gl/vulkan tutorials.
i dont even comprehend how you get a bajillion shaders
>>
>>102709853
Spending 6 months learning how to render a triangle in Vulkan, deciding that "3d is too hard" then going back to 2D
>>
File: engine 2024.jpg (285 KB, 597x903)
285 KB
285 KB JPG
>>102709853
>I thought it was Godot
Never, ever has been, no matter how loudly its cultists shrieked. The industry standard for indie games remains either Unity or Unreal depending on whether you prefer C++ or C#.
>>
>>102709998
What about rendering a triangle in OpenGL, is that easier?
>>
>>102710097
yes
>>
>>102709341
they haven't been for a decade
>>
>>102709903
also even if the branch cost was significant, you're still probably going to batch your draws by material so that most threads are actually operating in sync on the same type of material (same branch)
>>
>>102709919
>they get mogged by computers 8 years older
they got mogged by a chink phone too
there's still value in it because the CPU is powerful, having at least 3 GHz, 4 threads, and SIMD support, can lead to a lot of creative ways that you'll never even consider normally.
but yeah I agree that celerons and shitty laptops can be sad to work with regardless of the GPU, but then again, the demo scene manage to pull off some insane shit regardless, so it's really a matter of persistence and problem solving.
programming is ironically way easier and fun when you're working within a set of strict limits, look at all those fantasy consoles and constrained game jams, most of them mogg most modern games. some people still rediscover how cool color palette swapping/cycling.
>>
Is go lang fine for 2d games?
>>
>>102710389
almost anything is fine for the vast majority of 2d games as long as you don't completely fuck up
go probably has bindings for libraries like SDL or raylib
>>
Explain to me why UE4/5 games stutter due to shader compilation done on the fly:
Isn't it possible to precompile every shader before the game starts?
Is it because of the way the engine is designed (like somehow it's dynamically writing shaders or there's branching everywhere and it can't tell which branch will be used until the game runs and it's physically impossible to precompile with every branch possible)?
>>
>>102710523
there's a gazillion shaders
they'd rather just fuck you over by compiling shaders as needed than upfront
idk why
actually its probably a setting to compile them upfront
if you're in Linux, Valve does this upfront for you with fossilize kek
Valve always dunking on Timmy
>>
File: file.png (889 KB, 1920x1080)
889 KB
889 KB PNG
My wife already made an engine in vulkan while niggers still asking if they should use openGl or vulkan lmao
>>
>>102710523
the last of us had you waiting for 2 hours for shaders to compile
>>
File: file.png (61 KB, 512x512)
61 KB
61 KB PNG
>>102704929
>pixelated abstract look
>realistic head-bobbing and acceleration/deceleration physics
>>
>>102710797
spotted the zoomer
>>
>>102710523
some unreal games do do it, like the newer borderlandses
you can always tell when a game does it since it causes really long load times whenever your driver's IR-to-GPU binary compiler changes
i've seen a lot of anons, both devs and players really hate it though

also, they tend to use DX12 and i am not sure how much DX12 has actually done to provide ways to mitigate the issue compared to vulkan
khronos kind of bent over backwards for a while providing easier and easier ways to avoid shader stutter (iirc last i properly went over the related extensions/features it was something like 5 or 6 and they can work together) like extensions for helping build an asynchronous shader compiler or pipeline libraries
eventually they went further and further to the point they said fuck it and let you use unoptimized unlinked shaders objects instead of pipelines

i am also not sure how many developers using DX12 actually understand that it needs different usage patterns
vulkan puts off a lot of devs because of how alien it is but i think that might work in its advantage
>>
>>102710805
spotted the tasteless hipster
>>
>>102710714
>wife
>>
mustache house.
>>
>>102711006
did i stutter?
>>
>>102711006
What's your proof it's not an XX woman?
>>
File: file.png (27 KB, 326x112)
27 KB
27 KB PNG
>>102711037
hey bro, im the guy who suggested the background color change for the UI.
I noticed in your screenshot there you made the background darker like I suggested, but then you also made the buttons the same exact color.

The point of my suggestion was to make the background different from the buttons, with the buttons being lighter.
If you make it darker but then make the buttons exactly the same, then it kinda defeats the purpose
>>
>>102711175
idk lol
>>
>>102711237
My bad, sorry.
>>
>>102710797
visible pixel != pixelated. Everything is clear and clean.
>>
Is there an alternative to shadow mapping that can work in opengl?
I'm looking at shadow volumes but apparently they're pretty costly performance wise
>>
File: shadow_issue_zoom.jpg (168 KB, 900x615)
168 KB
168 KB JPG
>>102712032
define "alternative"
do you want static or dynamic shadows? shadow maps are very easy to implement
they get very expensive for dynamic lights, though you can do some tricks for fast moving lights, like they did in quake

you won't get shadows for objects in the scene unless you make it dynamic and high resolution enough, though. and you probably won't
but you can fake it with simple planar lights. they'll clip through walls and slopes and whatever but it may not matter depending on the graphical fidelity you're going for

volume shadows had a heavy performance cost in 2004
it's the year 2024 and unless you're planning on using models with ridiculous polycounts I doubt anything you do will make your cpu break a sweat
plus you can even optimize them with geometry shaders if you really want to commit to the life of never finishing a video game
>>
>>102711175
He's attracted to them so it can't be a woman
>>
>>102704929
Has anyone here actually used Stride Engine before? Is it compared to Unity if I'm willing to take a hit to utility to not have to deal with Unity bullshit? Any unique strength?
>>
>>102712566
i did the tutorial and a really basic project years ago back when it was called xenko and was proprietary
it has, or had, a proper company behind it at one point, not sure if they decided to open source it and fuck off or are still involved
i don't remember it being that bad, certainly not using fucking mono and having access to the real C# ecosystem and feature set seems like a big plus
>>
>>102712032
stencil shadows
>>
>>102712963
Sounds interesting, thanks.
>>
>>102711446
the view bobbing, leaning, and acceleration is still puke-inducing.

For a game like this you want Doom-like reliable on/off movement. Come on dude, what the fuck are you thinking
>>
>>102714446
you sound unreasonably worked up about this
>>
>>102714528
and you sound like you're deflecting, so alright do whatever you want with your project bro, ignore my advice because of your ego
>>
>>102714570
It's not my project
>>
At the end part of my render loop I have a separate UI thread with its own OpenGL context draw what it wants, that way I don't have to worry about saving/restoring any state on the main 3d render thread
Is that an acceptable way of doing things or is there a gotcha somewhere because of two separate threads (not simultaneously) drawing to the same window?
>>
>>102714607
damn..........I got owned.
You win this ego battle, anon-sama!!
>>
>>102714759
My ego is not involved
>>
>>102714762
yes that's why you first brought ego into this, instead of arguing about the subject matter
>>
>>102714702
Using multiple contexts is not conventional, you should be able to do everything with one context
>>
>>102714767
I don't care about the subject matter
>>
>>102714785
ok midwit
>>
>>102714788
simmer down buddy
>>
>>102714772
You don't want multiple threads fucking around with the same context. Having a context per-thread (which are shared) is perfectly fine as is how it's designed to work.

>>102714702
Depends. You may have to get synchronization objects involved.
>>
>>102714789
ok midwit
>>
>>102714791
So use a single thread
sharing stuff between OpenGL contexts is not conventional
>>
>>102714785
So then... he's right in saying you're in it for your ego?
>>
>>102714807
I have zero investment, he was just being unneccessarily rude to whoever posted the game
>>
>>102714799
>sharing stuff between OpenGL contexts is not conventional
It's a completely well-defined thing to do.
If I create two SHARED (that part is important) contexts, and then glCreateBuffers in A, that buffer is also available in B too. But as I mentioned, you may have to get synchronization objects involved for things to actually work as expected.
>>
>>102714816
I'm saying it's not conventional, as in it's not something anyone does really, at least when writing it game
>>
File: 1713770152570571.png (17 KB, 700x933)
17 KB
17 KB PNG
>>102714814
>someone is right
>"uhhh you didnt use proper redditspeech so your entire point is ignored"
I'm sorry.
Status quo is great.
Everything you think and do is great, no need for advice.
You're perfect as you are, no need for improvement.
Oh your project crashed and burned? Must be those incel nazi chuds
>>
>>102714799
>>102714816
But in this situation what would I even want to share? The user interface and actual game rendering should be capable of working independently, they each depend on the game state but not on any specific OpenGL state.
>>
>>102714833
I think the question you should ask is "why do I need two contexts"
>>
>>102714825
Yes, I agree with that. It's a rare thing to do.

>>102714833
The only legitimate usage I can really think of in my head is a texture-upload thread or something like that.
It's not like Vulkan where you could theoretically record a bunch of shit ahead of time across multiple threads.
>>
>>102714842
So I don't have to save and restore state, presumably you would want to change a lot of settings and state between drawing 3D stuff and a 2D interface, but if you isolated each procedure to its own thread and context, it's not an issue anymore
I looked at a few UI frameworks and their OpenGL implementation seems to use save and restore approach, what I'm trying to understand is how is that more advantageous than using multiple contexts?
>>
>>102714965
>presumably you would want to change a lot of settings and state between drawing 3D stuff and a 2D interface
You presume wrong
I change about 3 flags last I checked
>>
>>102714965
You cannot avoid having to track state in OpenGL, even if you make a different context for your UI you still need to change state between draw calls
>>
>>102714968
I was looking at these, it's not an overwhelming amount I suppose
https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_opengl3.cpp#L498
https://github.com/mikke89/RmlUi/blob/master/Backends/RmlUi_Renderer_GL3.cpp#L816
>>
>>102715011
This is generic code that tries to cover all your bases, if you track what you ACTUALLY use you don't even need to do this
>>
>>102714965
What state do you think will be different between 2D and 3D, but won’t ever change at all within a 2D or 3D pass?
>>
Now with eaves.
>>
>>102716207
Very few people are good both in programming and drawing at the same time. Congratulations
>>
>>102716651
Thank you but I'm not deserving of such praise.
I'm nothing but a monkey banging rocks together until I get the desired result.
>>
>>102716207
nice work anon
>>
>>102716207
le brodjegd zomboid :DDDDDD
>>
>>102716207
sovl
>>
What's the proper way to do rendering in a 2D game? Right now I'm just iterating over all my objects and seeing if they're in the camera bounds, but I imagine that will start taking too much time when there's a huge majority of objects off screen.
>>
>>102717046
grid for regular sized objects, quadtree for irregular sized objects
>>
>>102717046
quadtree?
>>
>>102717046
this >>102717060
or put your sprites into chunks
>>
>>102704929
I wrote myself into a corner.
>you need X amount of magistrates to collect taxes
>when you have enough magistrates you can collect taxes
>every time you collect taxes province's happiness is decreased
>when happies reaches 0, the province should revolt

The problem is that because everyone starts with the same happiness they will reach the happiness 0 at the same meaning, all your provinces will revolt at the same time.
>>
>>102717269
sound like you need to initialize the happiness of each province with a little bit of random fudge.
>>
>>102717269
binary mechanics like that in strategy games suck
if you have below X magistrates they should collect partial taxes
>>
>>102717269
add that the more magistrate you have the more corruption you also get. so that you get diminishing return from adding more magistrates.
>>
File: file.png (493 KB, 1891x873)
493 KB
493 KB PNG
>how I made a game video
>here's a bunch of 3d scans I downloaded
>can't model so I downloaded some tunnels
>game runs like shit, auto LoDs everywhere
>here's a shitty spider
>can't model/animate so I downloaded an asset for the spider with IK and all
>didn't like the spider
>downloaded another monster model from sketchfab
>needed animations so off to mixamo I go
>can't animate the tongue correctly lmao, here's some physics spring
>can't into AI, just pathfind to player bro
>this is how "I" ((((((((((((made)))))))))))) a game
lol, lmao even
>>
>>102717421
veredict: someone's rollin' while somene' hatin'
>>
>>102717421
slop devs
>>
>>102716207
are you going to make full on sims 1 like game?
>>
>>102717313
stuff like wrong culture giving more unhappiness?

>>102717341
I want to avoid fractions, because it is going result in messiness

>>102717396
not sure how that would integrate with happinness
>>
>>102717269
You can't adjust the tax rate so it has less impact on happiness?
>>
File: Game_E9dcuIAhnu.webm (3.93 MB, 1280x720)
3.93 MB
3.93 MB WEBM
Alright, set up my basic engine with OpenGL4, time to dev!
>>102717539
NTA but I'm personally going to make a Sims 2/3 like game
I think he's trying to make a shop tycoon
>>
>>102717539
It's going to be a "small store owner simulator"

Some aspect of it, yes. The game will be that you build a store and run it. there will be some "life sim" element like you will control a character and have to take care of your needs.

>>102717561
>stuff like wrong culture giving more unhappiness?
No, simply by not initializing each province with the same "happiness value".

>not sure how that would integrate with happinness
It won't affect happiness but the taxe you can levy from the population.
>>
>>102717565
No because amount collected is equal to the province's population in which 1 reprsents 1000 people.

  public void CollectTaxes(){
int coll = 0; //Amount collected
foreach(Province x in Provinces){
if (x.CanAfford(x.Pop)){
x.AddWealth(-x.Pop);
x.AddHappiness(-1);
coll += x.Pop;
}
}
AddWealth(coll);
}
>>
>>102717653
>No
Shit game. Become a namefag so you can be filtered like you got filtered by design.
>>
>>102717561
>I want to avoid fractions
why?
>>
holy shit
blockbench >>>>>>>>>>>>>>>> blender
>>
>>102717597
can you share the shader?
>>
>>102717696
I've tried both and blockbench has filtered me, I can't model in it but I can feasibly make relatively decent low poly models in blender
>>102717706
Which one, the one used for rendering the object (that quantizes the vertices to give it a PS1 ish look), or the one that renders the framebuffer (that dithers the colors)?
>>
>>102717719
I'm better at modeling in blender too, but that might be because I've had years of experience in Blender while I've only used Blockbench for like two hours so far.

That said, modeling isn't the only thing I need. Rigging, texture-painting, and especially animating are a thousand times more doable in Blockbench. I fucking hate Blender's animation UI with a passion
>>
>>102717696
Can blockbench do models that don't look like they came out of Minecraft? Like with filtered textures?
>>
>>102717750
I don't know but I'm making PS1-like lowpoly models and it's perfect for that.
>>
>>102717719
i like both effects, i learned the basics of opengl 2 years ago, but havent done anything with it yet. would like to look over both to learn how to do it
>>
Trying UE5 for the first time for an assignment. Is blueprint/visual scripting really better than scripting with code for video games?
>>
>>102717057
>>102717060
>>102717225
ok, copilot suggested a quadtree. It also wrote the class for me so I can do some benchmarks with it. I figured it was just hallucinating because quadtree sounds retarded.
>>
>>102717792
>copilot
ngmi
>>
>>102717682
He's a brainlet
>>
>>102717792
>I figured it was just hallucinating because quadtree sounds retarded.

I think you should read some books with a chapter or section spatial partitioning before consulting AI.
>>
>>102717792
>copilot
retard alert
>>
>>102717767
here you go: https://pastebin.com/PSD4nEup
>>
>>102717682
Because I want to maintain an "enclosed economy".
Meaning all money comes and goes somewhere rather than appearing out of nowhere.
For example, if you build a building in a province the money goes the province's treasury, and when you collect taxes the same money returns to you.
It means that if one country hoards wealth it will impact the scarcity of wealth.

Fraction would mean that with all rounding the wealth will diminish or increase overtime.
>>
>>102717823
Let me give you a tip
Say someone has 5 dollars and you want to take half their money
Just round down to 2 and they can keep 3
>>
>>102717831
but you would round up smaller than 1, it would always be 0 or 1
>>
>>102717806
>>102717814
>>102717816
I mean it taught me about this quadtree. I was just using a SQL database and using SELECT * FROM Sprites WHERE X >= Camera.X AND Y >= Camera.Y AND ...
>>
>>102717856
>I was just using a SQL database
are you trolling
>>
>>102717856
>I was just using a SQL database and using SELECT * FROM Sprites WHERE X >= Camera.X AND Y >= Camera.Y AND ...
??????????????????????????????
>>
>>102717839
You don't have to get 1 dollar from 1 person, you can get 0.5 from each person. 2 people = 1 dollar. At the point it becomes <1 you've lost since you have no living population.
>>
>>102717839
so represent your money as 100 instead of 1
>>
>>102717821
NTA, but thanks for sharing.
Looking at your vertex shader and it seems that you are using a quad to draw the texture for post processing. Isn't it better to go with a "big" triangle instead?
>>
>>102717821
The quantized vertex trick is neat. I remember reading or hearing that the PS1 vertices had to be stored as integers, which is why you would get some weird effects. It's interesting to see that little factoid pop up.

>>102717856
I'm not sure what you are talking about here.
>>
File: Capture.png (12 KB, 1472x127)
12 KB
12 KB PNG
>>102717871
>>102717885
Here's the code.

>>102717867
It's very fast with the indexes on the X and Y values.
>>
>>102718029
No using a SQL database is not fast lmao
>>
>>102718029
are you a webshitter?
>>
File: Capture.png (70 KB, 1157x749)
70 KB
70 KB PNG
>>102718085
30 FPS even with 300k sprites in the database, it's very fast.
>>
>>102717776
no
"low code" platforms are always inexpressive with terrible performance and they have been for decades
every so often someone reinvents them to sell to suits as a way to replace developers
i suppose you do avoid writing unreal's really shitty ~20 years out of date borderline enterprise shitware style of C++ but at the end of the day that's still what it is under the hood
>>
>>102718085
>>102718172
Oh never mind it's actually faster to just iterate over the sprite list. I'm sure if I have a lot more sprites the database will be faster though.
>>
>>102718172
>30 FPS even with 300k sprites in the database
thats not fast
>>
>>102718174
>20 years out of date borderline enterprise shitware style of C++
Yea fuck this, and you have to close/reopen the editor everytime you compile your code unlike in Unity.
I just wanted to do some 3d graphics stuff like wave simulation with particles, ray traced shadows, etc. but I need to land a job and such have to know how the new industry standard work.
>>
>>102718172
>>102718200
SQL is always going to be slower than a proper algorithm + data structure because of overhead. Literally all it does is run its own algorithms after fetching from disk. Are you at least using a DB stored in memory? It'll still be slower but less so. If you like storing in SQL to persist data, I'd suggest at least loading the entities once and keeping them in memory in a quadtree or grid in your program.
>>
>>102718174
>~20 years out of date borderline enterprise shitware style of C++
has C++ programming evolved in the last 20 years?
>>
>>102717719
>>102717738
Just to mention one thing: rigging a model by groups of meshes, instead of with bones and weight-painting, is absolute GENIUS and super easy
>>
>>102718307
rly?
>>
>>102718407
ye
>>
>>102718200
anon
no
the cheaper alternative to iterating over an array when it gets too expensive isn't to use a fucking relational database query
if you can you partition that array into even smaller arrays and only iterate over the one(s) you need to
which is essentially the idea behind a spatial partitioning tree
except instead of dividing a 1d array (a line) into smaller lines you're dividing a 2d array (a square) into smaller squares
you can also use advanced concepts to accelerate iterating over a spatial partitioning tree because it's simple
they can be vectorized and even GPU accelerated

like if you were talking about a hashmap it might be faster in the right situation but a relational database is an insanely complex beast
>>
Has anyone here ever made use of skylicht engine? It seems like a far more modern irrlicht on basis of all changes, it also isn't forgotten. Going to try making a simple shooter in it.
>>
I think /gedg/ needs to write an article on spatial partitioning because that question has been asked like 30 times already
>>
>>102718421
Do not worry, I met my FPS target and the search time does not increase even when there are 2 million entries in the database.
>>
>>102718297
on the offchance you're not being facetious, yes
there's still some people that claim not for the better but yes
C++11 is considered the hard cutoff for C++ standards worth using due to the issues the specification had prior to that
and the java style OOP unreal is full of fell off hard
more modern C++ is much more multiparadigm and excessive use of runtime heavy shit like virtual function based dispatch is looked down upon and solutions which impact compile time are preferred
>>
>>102718483
It's running at 30 FPS on your computer, but it'll be lower on a worse computer, and it'll be very noticeable then. If you partition the entities into a simple grid, querying will take nanoseconds and your FPS will easily reach thousands, so even if it dips, practically no one will notice.
>>
>>102718652
>and the java style OOP unreal is
is it any different to other game engines like Unity?
>>
File: craft.webm (3.97 MB, 1912x936)
3.97 MB
3.97 MB WEBM
we minecraft now
>>
>>102705328
As someone who used all three.
>Legacy OpenGL
This one is just a waste of time. And not significantly easier to use then modern OpenGL Immediate mode is always a con.
>Vulkan
You don't need this. Yeah, it's not THAT hard, but you should only use it if you're a hobbyist that enjoys learning stuff they will never use for anything.
>Modern OpenGL
This is the best option if you want to make a game quickly.
>>
>>102718829
neat but fuck that webm quality
>>
>>102718829
nice, you even emulated the shit performance of minecraft
>>
>>102719625
kek
>>
>>102718829
Is the rendering all done in colorforth, or...?
>>
>>102719625
The penalty of storing position data in a SQL server I'm afraid.
>>
Is dragonruby worth toying around with?
>>
>>102720224
>meme lang
>"professional grade"
>discord "support"
>closed source
That's like 4 red (get it, because it's fucking ruby) flags right on the main page.
>>
>>102718684
kind yea, in more ways than one
unity uses a very old open source implementation of the windows exclusive version of c# which started out as basically MS java so somewhat
although c# is more OOP-y to begin with so it's still very OOP much like c++ modern c# has really diverged from its roots, much more so in fact in a much shorter amount of time since MS decided to have the open source .NET runtime supplant the proprietary one
they aren't afraid to move fast and break things and chose instead to build automatic migration tools
whereas unity's only ever able to backport a few new features
>>
>>102720332
*kind of the same actually
for some reason i read that as the opposite of what you said
>>
>>102720332
how is C# not OOP
>>
>>102720224
>barebone proprietary engine made in ruby/SDL
might as well just cut the middleman and use SDL directly.
>>
>>102720355
C# is POO (Programmation orientée objet)
>>
>>102720355
???
i just said it was, even more so for the dead version unity's stuck with
but modern versions of C# are just adding a fuckload of features from all sorts of places
>>
It's easier to make a sims game and turn it into a better project zomboid, than start with zomboid and give it sims like NPCs.
Do with that what you will
>>
>>102720735
>it's easier to add brainless zombies than to add "smart" NPCs
water is wet
>>
File: p_correct.png (150 KB, 984x797)
150 KB
150 KB PNG
I continue to work on the sprite generator and in the process I added vertical correction to orthographic projection to get more of the classic aesthetic.
>>
>>102721108
PAY ARTIST CHUD!!! GENERATOR IS STeAL
>>
>>102720101
...why the fuck would you do the exact same cancerous shit Minetest does? There are better ways to store chunks. Hope he won't add lua scripting on top for extra cancer
>>
File: 61DS4uvJfcL._SL1047_.jpg (99 KB, 800x1047)
99 KB
99 KB JPG
Has anyone read this or any of the previous editions? Was is useful at all?
I'm brushing up on my C++ and going to dive into OpenGL after and I was wondering if this book would help.
>>
I have decided to add lua scripting to my minecraft clone
>>
>>102722468
its not a very technical book and quite frankly doesn't really talk about overall architecture
it gives somewhat in-depth walks through various engine subsystems though
I would say its more of an encyclopedia of engine dev - it goes over the main areas and gives some decent information but you need other resources to dive into each topic in detail. And architecture just isn't part of the discussion much at all
>>
>>102722468
>1240 pages
>Has anyone read this or any of the previous editions?
actually yes
>Was is useful at all?
very. it gives good insight into engine architectures and multiple techniques for implementing certain things. It might not tell you how to implement something exactly, but it does discuss data layout and compression, and refers you to other detailed resources.
it's not even that dense, it's full of images and diagrams. you can pick and chose the exact sections you need anyway.
>>
I want to try physic simulation starting with fluid simulation HOWEVER I never done any physic in my life past highschool (and I was bad at it/forgot everything).
BUT I'm okay at maths (bachelor lvl, I know about Fourier, linear algebra, etc.).
Question: Is it important to know about phys before doing phys simulation or the explanations of the algos will suffice (I know how to read maths). I heard that PDE were important.
>>
>>102722468
I've used it like a reference book a couple of times. I don't think you're meant to read things like this cover-to-cover honestly.
>>
Is there a 3D model format that:
>uses per-object/mesh animation instead of skeletal animation (i.e each keyframe modifies an object's transform instead of an individual bone)
>references objects/meshes/"nodes" by name/stringid instead of an index, so that (potentially/hypothetically) the "skeleton" can be extended to have new objects, and will still be compatible with past animations, as they reference the object's *name* when moving it.
I already made a custom format myself that does all of this (and said format also has the luxury of blend shapes), but implementing a blender exporter for it is gonna be a PITA. I'm wondering if there's an existing format I can use that has a proper blender exporter already made.
>>
>>102723747 (me)
Also, I need to easily be able to change an object/node's mesh at runtime.
>>
>>102723747
I never understood the hate zoomers have for skinned meshes. Is it a minecraft thing
>>
>>102723815
It's just difficult to implement
>>
>>102722557
Your game will be forever tainted by 1-indexing
>>
>>102723849
>t. nocoder
>>
File: file.png (3.35 MB, 1920x1080)
3.35 MB
3.35 MB PNG
>>102723167
https://www.youtube.com/watch?v=rSKMYc1CQHE
https://www.youtube.com/watch?v=9IULfQH7E90
https://youtu.be/XgzCNFG4XWE
https://www.youtube.com/watch?v=rGNUHigqUBM
easy to do, hard to optimize.
>>
File: Game_k0YarM97Dl.webm (2.19 MB, 1280x720)
2.19 MB
2.19 MB WEBM
>>102723747 (me)
Update: Decided to just implement a blender exporter for my custom format and used an exported model on my engine (I already implemented a model loader for the format in sepples).
So far, it surprisingly works. Although, I haven't tested parenting, blend shapes, animations, etc... (I haven't made a model that used those features yet)
>>
I managed to beat the physx dependency into submission where it now works like all of the other ones - downloaded automatically with cmake and built in-tree. Gonna do wonders for my CI/CD pipelines
>>
File: 1661448492143197.png (123 KB, 264x360)
123 KB
123 KB PNG
Currently building a retro-style game engine in C++ w SDL, I've got many of the components working but im in a bit of a rut
I'm trying to use similar sound channels to the NES, I can generate the waveforms well enough but I'm trying to figure out how to pitch shift them now, I wanted to use the authentic FM sweeper methodology rather than pre-gen all my notes and play them midi style
it's fucking annoying I can't figure how to make SDL mixer adjust the frequency on the fly, ive found a few people online talk about it but not without an absurd amount of work or another library entirely
I only want to play primitive waveforms, saw, triangle, square, sine, noise, I know how to generate them, so I guess I just need a cross platform way of playing 5-6 sounds at once and be able to modulate them while they play, any advices?
>>
>>102725830
Why not just use vcpkg?
>>
>>102726219
Painful setup process. This requires a user of my engine library to only need cmake and a C++ compiler. It's basically best possible build scenario. "Cargo in C++"
>>
>>102725958
>I can't figure how to make SDL mixer adjust the frequency on the fly
SDL mixer got a major upgrade with SDL3 including functions that seem to do just that
https://wiki.libsdl.org/SDL3/SDL_SetAudioStreamFrequencyRatio
>>
>>102726385
well fuck me in the ass and call me a bitch, that's perfect, thanks brother!
>>
>>102726439
do be careful though it's still only in preview
the ABI is stable so there shouldn't be breakages but there's certainly the potential for bugs
>>
>>102725687
Update: parenting, blendshapes, and animation all work.
>>
>>102726385
That's not SDL_mixer, it's SDL's new audio API. Based on https://wiki.libsdl.org/SDL3_mixer/CategoryAPIFunction it looks like SDL_mixer is not really integrating with this new API.
>>
>>102726695
shit i think i saw mixing mentioned in the new release's documentation and forgot SDL_mixer was its own separate thing
as far as i can tell the new audio API does provide at least a subset of the functionality
not all of it
>>
>>102705328
I just use opengl 1.1, but I make 2d games.
>>
>>102709081
I added lisp as a scripting language.
>>
Alright guys, it is solved.
I can now seam stitch between disparate LOD chunks.

What you see in the picture is the bottom right corner chunk of LOD level 1 being stitched with the other chunks which are all LOD level 2.

This is a huge milestone. We're in the big leagues now.

Praise be to the King Jesus Christ.
>>
>>102727219
*bottom left from that picture's view.
>>
>>102727219
Nice, I knew you'd figure it out.
>>
>>102725830
>downloaded automatically with cmake
is that really preferable over git submodules? how does updating them work
>>
>>102728819
>how does updating them work

Very easy:
CPMAddPackage(
NAME PhysX
GITHUB_REPOSITORY NVIDIA-Omniverse/PhysX
GIT_TAG 106.1-physx-5.4.2
DOWNLOAD_ONLY YES
)


Just update the git tag. Even easier for packages that don't require any special setup:

CPMAddPackage("gh:gabime/spdlog#v1.14.1")
>>
>>102704929
Work in progress screenshot...
Fixing Vulkan CPU-GPU synchronization issue down below.
Khronos should've left that part on the driver, like in OpenGL.
>>
>>102729268
Fuck... Ignore Emacs on 4th workspace...
I don't use Emacs often, installed it yesterday to "rectangle select + align" some code in 'item.h'.
When I write serious, aligned part of the code, I'll uninstall it again. Geany just can't handle it...
Yeah, apart from that, Emacs is good, but I prefer Geany due to simplicity, even tho it's weaker.
>>
>>102725958
If you are generating the waves in real time, then just generate them at the frequency you want.
>>
>>102716755
Still more than typical nodev
>>
any good resource on how to draw game assets? Everything I draw looks like crap.
>>
>>102727219
How are you doing stitching?
I forgot which triple A game did this but they just extended the edges of the terrain to drop bellow so the player will never see the seams, they call it skirt/curtain.
Some other game made different LoDs duck beneath each other according to some height map.
Don't tell me you're doing actual honest stitching?
>>
How do I design game expecting maybe hundred thousand sales/clicks/players, like from features to content, to like art. What do I xpct to produce. Also how do I find alternative solution to directional sprites, rotation projection..
Because this one rejcts my depth sorting somehow. https://vlix.io/video/6e45daf6d7824d7bb228/
>>
>>102707214
You usually have a few master materials and create instances of it with different textures and parameters. In UE you can even inherit materials instances and override just one or two properties. Just a few people have rights to create new materials. Problem is that every material generate a lot of different shaders for different uses.
>>
>>102727219
gratz anon, that's huge
what are you up to now?
>>
>>102707527
I was so confused thinking this was an underground pit.
>>
>>102727219
very cool stuff
God speed, anon
>>
>doing some research on ECS
>decide to study different data structures
>From the blog posts it seems like EnTT just uses sparse sets

The idea is that entities are integers and the component pools are sparse sets. The entity acts as an index in the component pool to access component data.

But then I read about how certain flavors of bitmap mog sparse sets unless you care about a constant clear time (which for an ECS I don't see why you would care about that). Are there any ECS that use optimized bitmaps?

I'm reading about Roaring bitmaps currently
https://vikramoberoi.com/posts/a-primer-on-roaring-bitmaps-what-they-are-and-how-they-work/
https://arxiv.org/pdf/1402.6407
https://arxiv.org/pdf/1603.06549
>>
>>102731897
ECS doesnt use bitmaps
>>
>>102731928
For and ECS, a common choice is sparse sets, correct? And I think its clear how a bitmap can be used in place of a sparse set. But using an ordinary bitmap isn't good with sparse data. I'm saying that there is a particular bitmap, the Roaring bitmap, which is a better choice.
>>
>>102732032
It uses sparse sets of data, not bits
>>
>>102728983
looks nice, might use it in a new project. havent really experienced pain from submodules in existing projects
>>
File: 1727948559110433.jpg (35 KB, 680x667)
35 KB
35 KB JPG
how the fuck do I use an ECS like entt and also use a quadtree for spatial acceleration queries?
>>
>>102732146
You don't
That's why ECS is shit
>>
>>102730865
I'm doing honest stitching. Every 2 voxels in the high res grid converge on 1 voxel in the adjacent low-res grid.

>>102731516
Next up is to make a clipmap of radiating LOD levels which follows the player as chunks load/unload in a 49 chunk window.

>>102731732
Thank you.

God bless.
>>
>>102732049
The idea is to have a third block of memory for the components. The sparse set contains only integers. So you can do a check like so

const bool contained = (element < sparse.size() && sparse[element] < dense.size() && dense[sparse[element]] == element);


to check for components.
See https://skypjack.github.io/2020-08-02-ecs-baf-part-9/

Quoting https://skypjack.github.io/2019-03-07-ecs-baf-part-2/

"The other way around to use sparse sets to implement a component based model is to rely on them as the key data structure for pools of components. This time, the systems aren’t involved and the optimizations find room elsewhere.
Now it should be clear how the sparse sets work, so I’ll give you perhaps less details and go straight to the point where possible. An open source project in C++ from GitHub that uses sparse sets for that is my own library, EnTT.

To use a sparse set as a pool is straightforward, at least if you don’t aim to optimize it. The basic implementation already works fine for that. You can just add a third array ordered as the internal one and add or remove items from it every time you do that with the packed array.
This gives us a very simple way to know if an entity has a certain component or not: just use the entity to index the sparse array and the position thus obtained will also be that of the instance in the packed array of components if a link exists. Moreover, iterating all the instances of one type of component is the fastest thing you can imagine, because all your components are tightly packed in a single array, with no holes in it. If you use entity identifiers as indexes for the sparse array and because of how sparse sets work, the packed array of indices will contain in fact identifiers and therefore also iterating the entities assigned to the given component should be fast as hell."

You can also see this idea here https://www.david-colson.com/2020/02/09/making-a-simple-ecs.html
>>
>>102732331
These people are completely missing the point of ECS which is you have components in contigious arrays which you can iterate over in order without any indirection
If you are using sparse sets with indexes to components in other arrays then well done, you've just reinvented regular objects
It's amazing how an idea can get completely distorted like this
>>
Has anyone experimented with Odin lang for engine creation?
>>
>>102732411
Not an engine but a game.
>>
>>102732428
How was the experience? Less cumbersome than C++?
>>
>>102732411
See https://github.com/Pariatech/odin-urban-tycoons. It was made by a hardworking person on /gedg/. The game uses odin and glfw.

>>102732377
>you've just reinvented regular objects
>It's amazing how an idea can get completely distorted like this
I don't understand what you mean by this. Is your point that instead of component pools as described, we should have plain memory blocks?
>>
>>102732463
>See https://github.com/Pariatech/odin-urban-tycoons.
Thanks, going to check it out.
>>
>>102732463
The proper way to implement ECS is archetypes
Which he talks about here https://skypjack.github.io/2019-03-07-ecs-baf-part-2/
But then goes on to talk about sparse sets and reaches a bunch of incorrect conclusions because he hasn't really studied the problem correctly and wrote this half-baked article
The whole idea behind ECS is to remove the indirection you have with the typical pointer to object model, but if you're using sparse sets then you've just reintroduced pointers, so why is ECS being used at all?
>>
>>102731897
>ECS
run like the it's the plague. ECS is when you swing so hard you overgeneralise everything, it's simplest form can be just a structure of arrays, but most of them are overcomplicated garbage.
I've seen most implementations, they either go the static compile time route, reinventing the type system of the language, and destroying any kind of dynamic composability because you can no longer create new components at runtime.
Or they go the full retard route where even get_component is a search in the hashmap/spare set. Apparently retards think that "amortised" O(1) access is O(1) all the time when clearly its not.
They also tend to hide all the ugliness with macro magic so you never know what's actually happening.
It doesn't help that they tend to solve some of the design issues by introducing yet another level of indirection in 100% of the cases.

Riddle me this tripfag, what happens when you try to have complex interactions? as in entities being parents to other entities, having specific update order, doing specific things, even the simplest form of pathfinding that takes into account other entitites?
GUI isn't even a problem because you can just filter over some group of entities, speaking of groups, do you know how those retards implement groups/flags/tags? Empty components that's how, everything is hashes over hashes.
At that point, if you're aiming for the fastest prototyping cycles, why not use a dynamic language where you can add arbitrary behavior to any entity? or hell, go the lua route and have a dictionary of variants, that's literally how god*t implemented its node system. Then you just refactor your code into simple known structs for actual efficiency.
You want dynamic behavior you say? nothing says you can't have both concrete game objects and dynamic game objects, why does EVERY object need to be a dynamic amalgamation?
ECS fags will also hide that they often use monolithic/god components that basically reinvent oldschool entities.
>>
>>102732514
>>102732562
isn't the idea either way to keep all objects in a contiguous array so that its kept hot in the cache? even with indirection, ideally those objects are still in memory if your access pattern can somehow hit them more or less serially or within cache bounds
maybe I'm missing something here

my first instinct is to not use these ECS frame works but just use POD arrays (maybe transformed to struct of arrays) and indices to replace pointers (which may naturally arise in something like a graph/tree), and that would then at least make the arrays trivially copyable
>>
>>102733000
>ideally those objects are still in memory if your access pattern can somehow hit them more or less serially
they won't be if they're in a sparse array like what is being suggested
>>
>>102732514
>The whole idea behind ECS is to remove the indirection you have with the typical pointer to object model, but if you're using sparse sets then you've just reintroduced pointers, so why is ECS being used at all?

The reason I wanted to use ECS was so that I could generically compose different behaviors without nesting. For example, if I have a spell system, I want to create spells by composing different spell effects. I understand ECS typically achieves this and stores the components contiguously in memory.

>>102732562
>they either go the static compile time route, reinventing the type system of the language, and destroying any kind of dynamic composability because you can no longer create new components at runtime.
>Or they go the full retard route where even get_component is a search in the hashmap/spare set
I dislike the compile time route you described, which is why I'm studying ECS. But unfortunately, it seems very popular. I want to be able to create new components as the game runs. Overall, it would make sense to have a hybrid of run time and compile time.

>Riddle me this tripfag, what happens when you try to have complex interactions? as in entities being parents to other entities, having specific update order, doing specific things, even the simplest form of pathfinding that takes into account other entities?

I don't see why I would have entities parent other entities. The whole reason I want to use ECS is for its composition properties, so I wouldn't mix it with inheritance. If you want a specific update order can't you just sort the dense array? You could also have multiple pools for the same component wrapped in some other data structure that fits the task at hand. For the pathfinding question, is the concern looping over all the game entities without accounting for location? Couldn't you just put your entities into a data structure for spatial partitioning?
>>
>>102733143
>I don't see why I would have entities parent other entities. The whole reason I want to use ECS is for its composition properties, so I wouldn't mix it with inheritance. If you want a specific update order can't you just sort the dense array? You could also have multiple pools for the same component wrapped in some other data structure that fits the task at hand. For the pathfinding question, is the concern looping over all the game entities without accounting for location? Couldn't you just put your entities into a data structure for spatial partitioning?
what about transform hierarchies at the minimum?
>>
>>102733143
Consider a simpler composition pattern than ECS if that's what you want to do
>>
>>102733183
Do you have any recommendations in particular?
>>
>>102732450
I don't have much experience with C++, but I can talk of Odin in reference to C.
Odin keep the simplicity of C while adding some well needed features, like no header file, packages based on file hierachy, hashmap, dynamic arrays, enumerated array, linear algebra and much more.
Also I highly recommend you read the Doc. It's a quick read and it's what sold me the language.
https://odin-lang.org/docs/overview/
Also check out this blog
https://zylinski.se/posts/introduction-to-odin/

>>102732463
>Froggy shilled my repo
Thanks buddy
>>
>>102733217
It really depends on the specifics. ECS is a generic architecture that promises to give you a way to model *everything* in your game. That's why people are drawn to it, and that's why it kind of sucks, because it's overcomplicated and doesn't really model anything that well

For most things in my games I can get by with just enumerating every component option, an entity might have slots for RenderCompoent, CollisionComponent, AnimationComponent, LogicComponent, I don't actually need some complicated system to set this up they're just pointers
>>
How do I implement a retained-mode/widget-based GUI for my game?
What does the code for such a UI usually look like?
Language is C/C++ btw
>>
>>102733319
a tree of OOP objects, each object has a transform and a collision box and member functions for mousehit, mouserelease, mousehover, mousehold, etc. They hook into an event system where they can send and recieve events to implement functionality
>>
>>102731897
I wrote mine using a sparese set and it's pretty comfy
>>
>>102733000
>isn't the idea either way to keep all objects in a contiguous array so that its kept hot in the cache?
That's the hope, the reality is often different.
It doesn't help that most retarded ECS example do shit like the following
>transform component
>velocity component
>gravity component
>render component
What's the point of having this much granularity? it's the wrong abstraction, you either have renderable entities or not, you separate static from moving entities. Can you even render anything without the transform matrix???? it's like people are blindly following retarded case.
Let's say you're introducing a level of indirection, entity to actual index array, to keep the backing array as compact as possible, how do you think the cache would act when you're trying to load 4 arrays minimum with their translation arrays per system??? you end up having components stepping over each other and ejecting each other from the cache.
More often than not, people will end using a physics system, which has a bunch of components, then some AI system, which can also change the position, then some Pathfinding component, which also change the position and other things...
See a pattern here? you have multiple systems that touch the same things in a cyclic matter, one after the others, every single system will eject the cache of the previous system because it's starting from the first element again. You can solve this issue by ping ponging your update direction, so cache is reused across system boundaries.
But here's the real issue:
You want groups, you need teams for AI for example, you need certain entities (not systems), to be updated in a certain way, and what if you end up with cyclic system dependency? systems triggering other systems which loop back... This is the general case of video games. Not all games are pure simulations. The way to solve this is by often employing a bunch of indirections and sorting your arrays. But it's stupid for a lot of reasons.
>>
>>102732146
One solution I could think of is to use events.
>>
>>102732146
Using quadtrees with its cache-raping ways while ECS is putting out fire with gas.
>>
>>102733143
>why I would have entities parent other entities.
>I wouldn't mix it with inheritance.
What does inheritance do with parent entities? what if your player entity can hold an object entity? what if you want that object to animate with the player? what if you want to have an entity group making a single entity, like a complicated boss for example? what if you want to parent a health bar to an entity? what about having a chain of entities? a squad of enemy entities?
This is about pairs of objects, and relationships between them. Complex game behaviors, or hell, animations themselves rely on entities affecting other entities, what if you have a fighting game and you want to sync 2 animations, one for the player and one for the enemy, with position and all? see where I'm going?
>can't you just sort the dense array?
that's one sane way to do it, but what if you have multiple systems that require multiple sorting order? you sort again and again?
>You could also have multiple pools for the same component wrapped in some other data structure that fits the task at hand.
also a great solution for solving the retarded "is_alive" and "is_dirty" mandatory tag. But keep note of what you're doing now.
>Couldn't you just put your entities into a data structure for spatial partitioning?
Ah, fitting spacial partitioning and ECS together? very fun, it also destroys your underlying structure, because spacial ordered entities have nothing to do with continuous arrays anymore, you switched to what's effectively a random access structure that does not care about cache.

But notice what you're doing, for every "normal" problem you try to solve, you introduce wide specialised cases, what was the point of using a generic system again (other than prototyping, I know its uses)? wanna know the issue of your sorting entities for updates? the moment you try multiplayer, or hell, a replay system, you just introduced a way for entities to update in different order, breaking determinism.
>>
>>102733596
>>102733360
>>102732562
this guy is completely right btw
>>
>>102733412
Ah yes, the global messaging system, the destroyer of worlds.
>>102733217
Like that anon said, simple composition, or monolith entities. That's how Quake and Doom (?) did it.
Here's the kicker tho, once you get a clear vision of what you need, you break that monolith entity model. Because (You) the programmer know your game the most, you know the underlying structure, so you account for it. You can also mix the approaches to cover both your static and dynamic realtime entities. Nothing says you can't do both.
I know it's a lame answer, it even introduces back the issue of analysis paralysis. But it's also that simple.
Here's a fun read:
https://loglog.games/blog/leaving-rust-gamedev/#ecs-solves-the-wrong-kind-problem
>>
>>102733182
Tree of entities where you store the concatenation of the transforms and the local transform int the tree. There is probably a better way, but that is what immediately comes to mind.

I've never used an ECS in the rendering engines I've made, so I wouldn't know about how people combine them. I've noticed in examples that people use transform data as components, but I don't think that is a good idea. I want to use it for the composition of different properties. Like a "red table" as opposed to a "blue couch". The ECS system seems rather incompatible with spatial partitioning, but I don't see why you can't use both as long as you don't store spatial information as a component.

>>102733596
>What does inheritance do with parent entities? what if your player entity can hold an object entity? what if you want that object to animate with the player? what if you want to have an entity group making a single entity, like a complicated boss for example? what if you want to parent a health bar to an entity? what about having a chain of entities? a squad of enemy entities?

I thought you meant something else (the misunderstanding is my fault), but I understand the criticism now. For some reason my mind jumped to the parent-child relationship involved with inheritance, but you never said anything like that.

>because spacial ordered entities have nothing to do with continuous arrays anymore

But I'm putting the entities into the data structure, and they're just integers. I don't understand how anything breaks. I would never store the spatial data in an ECS though, seems weird. It makes more sense in my head to have the tree store the transforms (local and global) and the entity id.

>>102733773
I'll give it a read, thanks.
>>
File: firefox_puhwzKFPXF.png (234 KB, 390x834)
234 KB
234 KB PNG
>>
>>102725958
I'm not generating waves in real time, I'm pre-generating them and then sending the finished waveform to SDL_Mixer to play, it takes a noticeable amount of time to generate any of the waveforms, and I wanted an authentic sounding old school, and they used to use sweeping to modulate the frequency on the fly
lucky someone pointed out that SDL3 can pull this off so im looking into that now
>>
Is it possible to make a hybrid of ECS and OOP?
>>
>>102733773
>https://loglog.games/blog/leaving-rust-gamedev/#ecs-solves-the-wrong-kind-problem

I see so the idea is to use something like
struct entity { u32 id; u32 generation; }

Then you can have a normal block of memory with elements of the form (u32 generation void* data) with some stride stored in the array header. You can very easily set this up at compile or runtime depending on the use. Components are stored in arrays. To check if you have a component, simply check if the generation between the entity and the data at index "id" matches.

That is much better than what I was thinking. Because you only access one array to simultaneously check for a component and then grab the component if it exists.

I will say though, that this setup doesn't solve the problem anon mentioned earlier, with transform trees. But maybe a different perspective will be helpful. This just a stream of consciousness post, so maybe my ideas are bad kek.

I think a component pool should generically refer to any data structure that allows you to map entities of the form above using some kind of data structure that follows certain rules

struct ecs_datastruct
{
elements of data structure: (u32 generation, void* data)
u64 stride;
}


So rather than using one data structure that fits every scenario, ideally you should be writing data structures that follow a certain set of guidelines. For example, if you have a hierarchy of transforms, use a tree. The component pools shouldn't be required to have the same underlying data structure. I think that may be the root of the problem with ecs.

I guess you can possibly make a library that allows you to hook in custom function pointers for insertion, removal, allocation, and deallocation, and the relevant data structure.
>>
>>102734846
generational pointers are a way to do memory safety and prevent use-after-free bugs, they're not really linked to composition in any way
>>
>>102734915
The generation can be used to determine whether an entity is present as the article suggests. I'm not sure what your point is. The ecs_datastruct in my post serves as a component pool.

So if you want to compose an entity with the components "Red" and "Ball" you could have color and shape pool. And an entity with both would return a component for each pool.
>>
>>102734981
My point is that memory safety isn't really relevant to your issue of finding a composition architecture
Pools are also a premature optimization when you can probably get by with regular malloc
>>
>>102735025
>Pools are also a premature optimization when you can probably get by with regular malloc
I guess I shouldn't say "pools". I just mean any relevant data structure that holds data following the rules as described in >>102734846. It can be an arena, a tree whatever. I should just say "component container" instead.

The way I understand it, as far as my usage is concerned, the generation is just a way to check for invalid values. If the generation doesn't match between the entity and the element of the data structure, then the component doesn't belong to the entity.
>>
>>102735146
still not sure why your problem can't be solved with just a group of component pointers
>>
>>102735180
Can you show me in code or psuedo-code what you mean?
>>
>>102735180
>>102735682
If you mean just making a struct with pointers to the components that won't work. I'm thinking about a runtime situation, so I can't include compiletime struct definitions.
>>
>>102735715
Simply have a pointer to every possible component type you want to attach
>>
NEW THREAD

>>102735790
>>102735790
>>102735790



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.