[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

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 1711471824639941.jpg (193 KB, 1024x1024)
193 KB
193 KB JPG
/gedg/ Wiki: wiki.installgentoo.com/wiki/Gedg
IRC: irc.rizon.net #/g/gedg
Progress Day: rentry.org/gedg-jams
/gedg/ Compendium: rentry.org/gedg
/agdg/: >>>/vg/agdg
Render bugs: renderdoc

Requesting Help
-Problem Description: Clearly explain the issue you're facing, 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

Previous: >>101792815
>>
Adding meta-programming to my programming language (for games)
Worked out a unified system for macros, templates, compile-time expressions and branching, looking neater than C++
>>
>>101875297
>he will release his language before Blow
it's so jover
>>
>>101875627
I'm 1.5 years in, I hope I will have a fully featured release in 2
>>
>>101875650
your language in 2, or a game in 2?
>>
>>101875712
The language
>>
>>101875729
oh you are the languagedev guy. I always ragged on you but what you do is impressive. I did a sort of scheme interpreter in the past and it was fun to do but I stopped before doing garbage collection and tailcall optimisation. You seem way past that so big prop to you.
>>
>>101875877
I don't recall being ragged on
>>
>>101852983
>https://floooh.github.io/2018/06/17/handles-vs-pointers.html
this guy is traumatized by the fact address sanitizer only got introduced to msvc in around 2019 (that's also when I moved to linux because I got so mad after learning it wasn't supported on windows 7 and I was sick of mingw, but I went back to windows 11 because I upgraded from 4gb of ram to 16gb).
MSVC has the debug CRT has an api for memory leaks (existed since forever), as well as Dr Memory, but the problem is that almost all high performance code have custom data structures, so these tools don't help (unless I am wrong?), but address sanitizer allows you to poison and un-poison regions of memory arbitrarily with minimal overhead and it essentially nullifies fancy tricks needed to check for memory issues (unless you want to do these checks on release, but at that point you should just use rust if security is so critical).
I do think there are use cases where you want to have an ID instead of a pointer when smart pointers don't fit (like for serialization for a save file, like you want to store a ID to a reference to an entity?). But I feel like the benefit of malloc is that you don't need to do manual poison/unpoison, and you could technically use custom allocators for smart pointers if you wanted to, and it's not hard to store a unique ID for serialization and I don't know if smart pointers are a significant source of performance loss after using proper allocators or recycling and the added complexity of essentially doing the same job of smart pointers is not great, I would do benchmarking first before making assumptions.
This is an example I found from an abandoned game:
https://github.com/griefly/griefly/blob/master/sources/core/Idptr.h
>>
>>101874382
Fuck game engines.
Learn good level design instead.
I escaped the spiral of doom.
>>
File: low calcium.png (52 KB, 1084x154)
52 KB
52 KB PNG
I've set dread pirates to return when you defeat them, somewhere else, and statistically stronger on average. Is this fraught?
>>
>>101876745
sometimes when I've had enough programming I make Doom levels
>>
>>101875297
Adding a visual meta-programming language to my game for total customization of AI, etc would be as simple as making a general function to stand-in for each element of the language and a general function to structure and call them in, right? I'm barely a programmer but I want to toy with this idea.
>>
>>101877871
Yeah you can just make some sort of GUI node tree that compiles down to source code, pretty easy
>>
What's the difference between a third party game engine and a mod support/sdk like the one that Doom Eternal has:
https://store.steampowered.com/app/2545650/DOOM_Eternal_idStudio/
>>
File: image.png (178 KB, 629x497)
178 KB
178 KB PNG
>>101874382
best vulkan tutorials? already done vulkan-tutorial.com and not sure how to proceed afterwards in my engine dev journey.
>>
>>101877995
Extending this to the annoying question of "are there any good Vulkan books [spoiler]using C?[/spoiler]"
>>
>>101877995
>>101878145
https://vkguide.dev/
it covers more, uses the latest vkengine features (gpu pointer, dynamic rendering...).
but it's buggy.
The goal is to load a gltf file with vulkan.
>>
File: returned.png (157 KB, 840x469)
157 KB
157 KB PNG
>>101877106
it works apparently
>>
>>101874382
Question about Unity 6: is it just straight up ass?
I feel like I spend 50% of my time just waiting for all the scripts to... recompile? when I delete one or make a change.
Are other engines like this?
I've only really used javascript for games in the past, I'm used to being able to iterate quickly.
>>
Total noob here, Godot seems pretty okay from my first day of using it for a 2d project. Anything I need to know that's gonna end up fucking me in the ass down the line?
>>
File: main_ttSyasnPgM_3.webm (3.45 MB, 1280x720)
3.45 MB
3.45 MB WEBM
Making a toy particle system using Odin. Trying to learn OpenGL along the way.
>>
>>101878200
thanks.
>>
>>101879378
I haven't played around with Unity 6 yet, but unity compile times aren't generally that bad when there aren't a lot of scripts in the project. No idea if they've made it worse or not.

I can recommend https://hotreload.net/ for hot reloading of C# scripts.
(It's "paid" but it has a perpetual free trial that just limits your time using it per day. I haven't had to pay for it.)
>>
Today I learnt operator overloading.

Instead of creating a new type make the overloads for the existing types.

Why are there thousands of types but you can't do basic comparisons and cout some very basic ones?

No. More. Types.

Yes to overloads.
>>
>>101877987
the engine with the mod/sdk might be made for a specific type of game and work less well for incompatible ones, general purpose engines try to support any type of game
>>
>>101879472
nah general consensus is godot is pretty good for 2d
>>
god damn /agdg/ is abhorrent
I'll take this general's data representation banter any time, love you autists
>>
File: 1651852971246.jpg (155 KB, 1440x810)
155 KB
155 KB JPG
>>101883369
love you too anon
>>
If I learn Unity, is it then easy to switch to Unreal or they are like completely different?
I just want to get used to a 3rd party engine to then apply to job offers.
I found an amazing tutorial covering a lot of topics (catlikecoding) on unity but I can't find anything similar for Unreal (so far).
>>
>>101879378
>I feel like I spend 50% of my time just waiting for all the scripts to... recompile? when I delete one or make a change.
Literally the reason I dropped Unity.
>>
>>101880230
noice!!
>>
will a batch renderer generally be able to render anything? what's the catch?
>>
>>101887217
It's more complicated to batch things than it is to just render them individually
>>
the hubris of these people thinking they fan do engine dev without havibg a math major.
>>
What's the proper way of working with LÖVE2D/Lua? Using classes SUCKS, and it seems like you're supposed to do everything in tables instead. Also is it expected for every relevant class to encapsulate its drawing, input handling and logic? Seems backwards from an MVC perspective.
>>
>>101887355
Disencouragement shill kys it's not hard
>>
>>101887355
The only math you need for engine dev can be easily copy pasted
>>
>>101887839
says in gdg #193 with no game
>>
>>101887477
Lua is choose-your-own-architecture
You can emulate classes and OOP using metatables
>>
I am worried. Companies shifted to support Vulkan but I can only do opengl at best and I don't understand Vulkan.
>>
>>101887217
its more complicated with things that are the same between vertices, but different per object, like materials. my plan is to add another framebuffer attachment and render the material ID in there so the deferred lighting pass can use that to pick the correct material to apply from an array of materials stored in the uniform
>>
>>101887477
>Everything in Lua is a table?
>Always has been
>>
>>101888054
I mean opengl and vulkan use the same shader language so I wouldnt worry them dropping it anytime soon
>>
>>101874382
with this OP pic, will somebody finally show me some /gedg/ 32 bit float wizardry?
>>
>>101888242
Most modern games use HDR lighting, stop asking
>>
>>101887873
But is there a better way? Seems tables make OOP kind of redundant as you spend more time making objects to do the same thing you could do with tables.
>>
>>101888057
do you draw everything as triangles?
>>
>>101888307
>Graphics processor company Nvidia summarizes the motivation for HDR in three points: bright things can be really bright, dark things can be really dark, and details can be seen in both
>These two papers laid the framework for creating HDR light probes of a location, and then using this probe to light a rendered scene.
nah brub there's more to it thatn using one of those spherical maps that has overbrights, etc. It's also about Star Wars light sabers and stuff like that.
>stop asking
why gatekeep? I keep my questions to 1 per thread, stop getting bothered by it, I just wanna see some nerd implement 32 bits float lighting in his game, that's not the end of the world.
>>
>>101888376
There is no better or worse, choose whatever architecture makes you feel comfortable
>>
>>101888428
HDR = high dynamic range lighting, uses 32 bits to represent light intensity
That's what you're asking for, and it's in every modern AAA game
>>
>>101888459
ok, that's fine and all, now I wanna see it in some of you nerds game
>>
>>101888382
>>101888057
i should've worded this better. i meant do you only use triangles as the primitive type for the batches? and if so how do you draw lines and points?
>>
Whenever the alien aboard the mother ship is tired of watching me debug and issue, they just nuke the file that id the culprit without any warning. I am onto your and you will be stopped.

I will rid the world of your kind alien scum.
>>
How many of you are over 25 and still doing this lmao
>>
>>101889955
What's age got to do with it?
>>
>>101889955
>lmao grown ass men have HOBBIES?
Yeah. The fuck do you think art is?
>>
>>101889955
I'm over 30
Gamedev is why I got into programming and there's no way I do more boring programming outside of work.
>>
>>101889955
not me
>>
>>101889955
go back to webshitting jeet
>>
>>101890581
literally me
>>
File: palette_window.png (169 KB, 1014x804)
169 KB
169 KB PNG
The palette picker is 'ready', but murders performance, so I'll be doing some optimizing.
>>
>>101876745
What's the secret to good level design?
>>
>>101889955
I'm 25 and I wish to do this until my 60s at least.
>>
File: 1693353238047512.gif (1.42 MB, 256x320)
1.42 MB
1.42 MB GIF
>>101891765
>>
>>101887477
don't use classes, OOP in lua is retarded when the language is dynamic, it's just tables, use them as such.
>>
>>101889955
What hobbies are you allowed to pursue past 25 then?
>>
>>101892069
gardening
sports betting
civil war miniatures
>>
>>101892069
drinking beer
watching sport ball
bitching about wife
>>
>>101892069
watching football
stocks
beating the wife
>>
>>101889955
I've been doing this since I was 15. going on 24
>>
>>101888880
>do you only use triangles as the primitive type for the batches?
yes, but my stuff is very bare-bones still, I havent though about line/point support yet.
>>
Since everyone is talking about batching itt.
How do you even do objects batching if not via instancing?
Do you just build one big vertex buffer with all your objects vertices and have a texture array for the textures?
My world is already divided in chunks and I don't think that the quantity of similar objects inside a chunk is big enough to justify instancing. And stuffing everything in a vertex buffer sound like alot of hassle with having to update a bunch of vertices when an object is moving or is destroyed etc etc, but I can't see a better way to go about it.
>>
>>101893936
There's a million ways to do it
I do compile-time batching for static meshes, I take the level mesh and merge all objects that share the same material in a certain radius into the same mesh
It turns 500 rock meshes into one mesh
I don't bother batching dynamic objects
>>
Sometimes I just forget how much of a beast the modern CPU is, I just finished watching someone's who's making a simulation where thousands of entities are interacting with each other, every variable access and check goes through a pointer dereference and a table index access, it's a beautiful spaghetti that somehow runs at hundreds fps while streaming.

Generally speaking, what's stopping every game from running at a stable 60 fps? if you separate rendering from game logic and throw each of them in its own separate thread, what's the real bottleneck then? you're telling me a new game still stutters doing a fraction of what older games did on older and limited machines?
>>
>>101894131
>what's the real bottleneck then?
memory transfer
>>
File: 1723651671045628.png (41 KB, 221x151)
41 KB
41 KB PNG
>>101894131
>what's stopping every game from running at a stable 60 fps?
You can go right now and code up a naive collision detection algorithm O(n^2). Start with n=100, then n=1000, and so on. Watch your fps plummet.
Bad code is the first thing.

Second is the OS. Back in the day games ran on metal, literally burnt into ROM chips connected via pins right into the console, memory mapped ASICs. No bullshit abstractions, no memory allocations or syscalls or schedulers. The entire hardware was 100% dedicated to running your game.

Thirdly is the massive bloat of assets. Games these days are hundreds of gigabytes with textures at 2k, 4k, even 8k resolutions. You have to stream so much shit that cache locality, branch misprediction and vram are now huuuge issues.

Im short, you can summarize all of these things as : because of bloat.
>>
>>101894131
>Generally speaking, what's stopping every game from running at a stable 60 fps?
AAA games: Graphics
Indie games: Poor programmers
There are some strategy and simulation games that bottleneck on the CPU, the peformance bottleneck for these is O(n^2) operations like pathfinding
>>
>>101894456
>Indie games: Poor programmers
Not everything can be multithreaded though. Even if you multithreaded pathfinding in dwarf fortress it would still kill your CPU soon enough. The guy's code isn't bad, maybe a bit naive, but it's just soo fucking bloated.
>>
>>101894553
DF is the third category, a simulation game, which is something that bottlenecks on the CPU
Unless you've actually seen the code you can't really make claims about it like calling it bloated or bad or naive
>>
>>101894070
I guess another idea is to have a mesh for static objects like the furnitures and one for the dynamic objects like characters, cars etc.
Anyway I should get bogged down in such premature optimization.
>>
>>101894616
Batching dynamic objects into a single mesh is a pessimization not an optimization
Unless they're something very simple like points or quads
>>
>>101894600
I havent but he has hired outside help a few times and they have commented upon it in the forums.
>>
>>101894637
They will be complex geometry.
>>
>>101878145
Idk about C but 2 popular Vulkan books are “Modern Vulkan Cookbook” and “Mastering Graphics Programming with Vulkan”
>>
>>101894665
Then you're copying entire vertex buffers every time they change, which is very slow
>>
>>101894660
Given the development process where they just keep building and building and don't have a particular end in mind it's probably not well optimized
If you start with a set of constraints you can optimize your program around them
>>
>>101894726
To be expected. Kind of why I'm not getting too deep into this. I will revisit it if one day doing one draw call per object ever get an issue.
>>
>>101894131
gamedevs not understanding GPUs (especially modern ones) and more broadly highly parallel asynchronous environments at all
easy to access artist tooling turning them into graphics programmers, not even exposing implementation details, and the tools being designed by people who don't understand GPUs
graphics drivers have had to do things like implement implicit batching for raytracing because gamedevs can't be trusted to do it themselves
or most implementations of material based shading for example are extremely retarded
ignoring the shader stutter introduced by improper on the fly compilation to a GPU's native ISA which has numerous solutions that seem to go unused as well, they're literally spawning thousands to tends of thousands of tiny 10 line programs on hardware that's very expensive to init and deinit
it's not like you can just trivially juggle between that many
and in the reverse they treat runtime branching within those programs like a taboo so they wind up small with a lot of them

meanwhile actually well designed shit like doom eternal rendered most of its stuff with a few fuckhuge shaders
https://simoncoenen.com/blog/programming/graphics/DoomEternalStudy
>>
>>101894711
Drive?
>>
>>101894863
Game devs understand GPUs more than pretty much anyone else and games are not highly parallel asynchronous environments
>>
>>101894808
well the game is like 20 years old
but like with the oracle codebase, clear constraints (i.e.. make le hecking sql go brrr withour dataloss) doesnt mean it ever finishes optimizing
>>
>>101894553
>>101894600
DF suffers from the same issue as Rimworld, any game where the longer it went the slower it gets means that it's keeping track of way too many things and never forgets. Even in real life the brain forgets, events get forgotten. You just have to accept the fact that you cant simulate a whole history for years and hold every single details about it.
So as a solution you straight up forget/delete things, or you go the database approach. Databases by design can store gigs of history while still keeping the lookup fast enough.
Which leads to me to the next thing, Level of detail is a common technique for graphics, how is it not common for logic? you can run logic at various LoDs depending on how important or if it's observable by the player. Events/memories don't have the same level of importance, same how a distance model can be faked.
>>
>>101894918
>well the game is like 20 years old
Doesn't matter, the way you optimize games hasn't changed since then, short of using compute shaders
>>
>>101895017
>Level of detail is a common technique for graphics, how is it not common for logic?
Games don't typically do heavy simulation, those that do often use LoD for logic
I use it for my simulation heavy game
>>
>>101894456
>the performance bottleneck for these is O(n^2) operations like pathfinding
nothing that can't be solved by the good ol' spacial partitioning, also flow fields by design make pathfinding trivial. AoE 2 had decent pathfinding and simulated hundreds of units and projectiles while keeping multiple machines in sync in Lockstep nonetheless. Starcraft had to get clever by disabling collision on units from the same team. I think the main issue of pathfinding is handling multiple unit sizes. I reckon that flow field pathfinding is fairly easy to implement in compute shaders.

>https://www.youtube.com/watch?v=Y-6DzI-krUQ
look at this shit, a game 26 years ago had a full on AI with neural networks. releasing this exact same game today would make it popular enough to overshadow any indie game. it's wild.
>>
>>101895198
You're oversimplifying a complex problem. There's lots of optimizations you can make, but pathfinding is still expensive. You create flow fields by running the standard (serial) pathfinding algorithm except you output a map instead of a path. You can't do it on a compute shader

And Creatures fucking sucked
>>
File: file.png (1.09 MB, 1723x1209)
1.09 MB
1.09 MB PNG
>>101895017
>Level of detail is a common technique for graphics
>Cities Skylines renders the teeth of NPCs on the ground level of a city builder game
lol, lmao even
>>
>>101895166
i am too dumb for compute shaders
>>
>>101895323
takes me back to the alyx fully modeled vagina meme
kek
>>
>>101894912
GPUs are, as is GPU-Host iteraction
>Game devs understand GPUs
the artists using shader graph tools definitely fucking don't and that's not their fault, but no, I don't believe the rest do either, aside from small teams of engine developers at companies that still work on their own engines and aren't also completely retarded
they're more than likely mostly retards like john blow just minus the ego
i highly fucking doubt most gamedevs have actually even disassembled a pipeline before, or seen GPU assembly, even with stuff like radeon gpu analyzer being trivially accessible and having pretty good diagnostics on pinch points
NVIDIA doesn't actually publicly offer tools for this, and their internal ones offered to people who ask them for support are apparently DX12 only and not widely available with full API coverage despite NVIDIA's near total market dominance which makes it pretty clear no one's really clamoring for them

and for that matter why would anyone with a skill set in extreme demand in industries with insanely higher pay that also aren't notorious for treating their employees like shit stay in the games industry long term?
they'd just shift to VFX or HPC or the implementation side of AI or do what carmack did and get a tech company to hire him to work on something he was personally interested in probably using connections
>>
>>101886577
thanks anon!
>>
>>101895536
now that's something worth not taking away with LoD
>>
>>101895889
"Most gamedevs" are indie game developers who do not know anything about GPUs, but obviously they don't need to
AAA studios absolutely have GPU experts working there
>and for that matter why would anyone with a skill set in extreme demand in industries with insanely higher pay that also aren't notorious for treating their employees like shit stay in the games industry long term?
Because they like working on games, and valuable employees get paid and treated well
>>
File: state-manager.png (9 KB, 550x203)
9 KB
9 KB PNG
>>101874382
Is there any good alternative to this spaguetto niggerlicious way to do FSM in Godot?
>>
>>101874382
what is everyone using push constants for?
two 4x4 matrices consume the entire minimum buffer (128 bytes) so I'm thinking of just shoving those in a SSBO, but now I'm not sure what to use the constants for
I'm aiming for full bindless GPU-driven autism though
>>
>>101896226
you can just write a FSM in code. What are you trying to achieve? There's no requirement that states be nodes.
>>
>>101891916
This is what I mean there doesn't seem to be a point in using OOP. I still get bugs over typos, and now I spent 15 minutes doing something I could've made in 5.
>>
>>101897168
What do you think the point of OOP is? It's no different in Lua than any other language
>>
>>101897202
Polymorphism. Static languages don't generally allow you to treat types/objects as other types/objects for the purposes of calling functions or passing them around as arguments. But in a dynamic language like Lua those restrictions just aren't there.
>>
>>101897239
Polymorphism is not a way around restrictions, it's a feature
You can call an object's member function and it will dynamically dispatch based on the object
You can do this in Lua with metatables
>>
>OOP
more like
POO
gottem!
>>
>>101894070
how do you handle static meshes? do you apply the model matrix directly to the vertices?
>>
>>101897320
Yes
>>
>>101894070
how does the static mesh merging deal with texturing? since each individual model have textures mapped onto it in its own UV space? is the merged mesh able to access all the textures at once?
>>
>>101897357
Same material means same textures, so only meshes that use the same textures are batched together
>>
>>101897408
gotcha, so the modelfile UV coordinates persist for each sub-mesh but the overall mesh has varying vertex coordinates for the sub-meshes
>>
>>101897431
Yes, all you need to do is transform the position and normal of the vertices
You could make something that generates composite materials aswell to batch even more things together but it's not really neccessary for my workflow
>>
>>101880439
It's actually a pretty fresh project, 5-10 scripts averaging 150 lines of code.
That link you posted looks very nice, I'm just not sure if I'm sold on Unity right now because of these compile times mostly.
>>101885177
Glad to hear I'm not crazy.
>>
File: 1562944525673.png (941 KB, 1920x1080)
941 KB
941 KB PNG
>>101877995
Reading the spec. Well there is also that big repo of samples by Sascha Willems.
>>
So how do you go about making hit boxes for skinned meshes with animations? The unity way is to break up meshes/transforms of the model and pair them with hitbox colliders, so they just track the transforms of the model.

I imagine most of us are using blender for animating, so at runtime data about the animation/model/bones is pulled in. Would you track the bone transforms and just pair collision meshes to them in code (usually simple stuff like cylinders, spheres, etc)? How about pairing shit like weapons to a character's hand? Keep track of the hand bone and offset it from there?

I find it hard to believe people would go for the Unity/Godot approach in custom engines
>>
>>101897938
>Would you track the bone transforms and just pair collision meshes to them in code (usually simple stuff like cylinders, spheres, etc)?
this is how everyone does it, I've never seen another approach
>>
>>101897971
this makes me wonder if games with really tight hotboxes have extra bones so they can get more complex arrangements of spheres to cover the model
>>
File: csgo.jpg (99 KB, 512x440)
99 KB
99 KB JPG
>>101898044
they all look like this
never heard of games having "tight hitboxes"
>>
>>101898116
like here the torso looks like it has a lot of horizontal hitboxes, I wouldn't normally think of adding horizontal bones there to animate with
>>
>>101898116
Is there a reason, other than performance, that we don't use mesh colliders instead?
>>
>>101898165
Meshes are animated on the GPU
It would have to be sent back from the GPU to the CPU to create a collision mesh
>>
>>101898165
its a double whammy for performance, first there's way more triangles to intersect-test with
and second you'd have to do the skinned transformations of vertices on CPU, or do them on the GPU and feed them back to the CPU, which is expensive
>>
>>101897971
>>101898116
Frankly, I was considering decoupling collision data from animations. You would still have hitbox collision checks on the server-side but could use a simpler collider on the client for cloth physics and such.
>>101898165
Trimesh collision is also ridiculously expensive and inapproprate for most simulations.
>>
>>101898535
>Frankly, I was considering decoupling collision data from animations
Why? You'd just end up with something that didn't match what you were actually seeing
Triangle mesh collisions are okay if they're static, the issue is if they're animated, you have to get the animation data on the CPU which is slow and you have to recalculate the spatial partition for the triangle mesh
It's completely fine to use fixed triangle meshes for the background
>>
>>101898775
>Why? You'd just end up with something that didn't match what you were actually seeing
Mostly for gameplay reasons. Since gamefeel is important I believe that certain animations would be improved with a smaller/larger, longer/shorter hitboxes, faster/shorter timings etc.
Yes I was aware of how common static trimesh collision is, I had misunderstood post thoroughly; I thought he was asking why they weren't used frequently in general.
>>
Who is the John Carmark of today's video game industry?
>>
>>101899201
Someone you've never heard of. But the truth is that the real geniuses don't work in games because games don't pay well. Any other SW field pays at least 2x and with much better work-life balance.
>>
>>101889955
I literally have gray hair.
The inner workings of games are fun.
>>
>>101899240
clearly you dont know anything about geniuses
>>
>>101899351
The ones that are financial retards are a minority of all geniuses.
>>
>>101899379
Geniuses don't care about money, and they esepcially don't care about "work-life balance"
>>
>>101899434
You will when you hit your 30s.
t. genius
Even my intern who just hit 30 and is working at openai is focusing more on family
>>
>>101899448
I'm over 30 and you aren't a genius
Also
>intern who just hit 30
lmao
>>
>>101899456
he was my intern when he was in his early 20s, we still meet up for dinner sometimes
>>
>>101887355
Good thing we only need high school math then retard
>>
>>101889955
Idk anon there's probably a whole lot more older anons that have the know how to make a game/engine rather than you younglings.
>>
File: 1698083577024.jpg (8 KB, 460x215)
8 KB
8 KB JPG
Why is hardcoding every string in the game into a gigantic switch statement bad if Undertale does it and it's just fine and one of the best selling games ever?
>>
>>101900980
>Why is hardcoding every string in the game into a gigantic switch statement bad
its not
>>
>>101900980
It's probably hard to maintain but if you are ok with that...
>>
Day 4 of learning video game development. I'm gonna try to figure out how to program smooth character movement for a 3D platformer type of game today. If any of you guys have good resources on the physics / mathematics behind it please share (I will be eternally grateful)
>>
I am creating a game for the NES. It's an interesting challenge, but also frustrating what with all the odd limitations.

The one thing it was supposed to be good at, for the time, is actually fucked. Scrolling is a bitch
>>
File: CGJB_cFUoAI5vki.jpg (8 KB, 414x300)
8 KB
8 KB JPG
>chatGPT can't even create a simple game of chess
It's Over
>>
>>101901352
Should be straightforward in UE 4
You make the class, mesh, material, throw some code at it, throw some code at the actor and it's done
What gives?
>>
>>101889955
27 here
>>
File: le_rooster.png (245 KB, 1014x807)
245 KB
245 KB PNG
>>101889955
44 here
>>
>>101900980
>>101901053
Its unironically not. You could maybe use a BST to improve lookup times and a wrapper class to allow-language switching, but I don't think its a big deal.
>>
Seamless chunks working on my surface net voxel terrain.

making 3D Dwarf Fortress
>>
>>101902309
It’s literally in a switch, there is no lookup time (it compiles to a jump table). If you wanted multiple languages, you’d just write a separate massive switch statement for each.

>>101900980
It isn’t, for a basic game, but at some point it does make sense to split things up by character or scenario.
However, at the end of the day what the switch is doing is mapping a number to a certain line of text (and possibly some event it causes), which is exactly what a good dialogue system would do if it were loading from a file.
>>
>>101898535
Do you mean using a cylinder around the player, characters, etc. that is used in some situations? That is also common, for physics on entities, or for triggers.
>>
>>101900980
I'm more interested how the fuck that monstrosity got a localisation into multiple languages. Hardcoding strings is fine until its time to switch to different languages. I guess the stupid way is to duplicate that gigantic switch case.
>>
File: 1723655286152030.png (303 KB, 518x767)
303 KB
303 KB PNG
>>101902772
>>101903753
It's bad because you are relying on the interpreter / compiler to optimize code that looks retarded. It's terrible because now the only way to access those strings is through that switch statement where they are defined. Be explicit and think through your code.

Lay out a compile time table of pointers to read-only strings that you index into with an enum and then enforce contiguity of those strings by putting them in an array with uniform.compile time length filled with blanks in unneeded space, sorted from most commonly used to least used, and aligned to page boundaries.
>>
>>101902717
>3D dwarf fortress
May God bless your autism, anon.
Good work
>>
>>101902717
Just mod minecraft you idiot
>>
>>101904125
It doesn't matter, it's made in GML scripting, it's not a static language, the whole thing would be no different than an array of data with jumping using indexes. Regardless of the fact that GML happens to be one of the fastest scripting languages that can withstand a lot of amateur abuse, a gigantic switch case that only happen when you call the dialogue tree is negligible, it can slow the game multiple frames to get the initial text and it wouldn't have changed a thing.

The game ran fine even on literal potato computers (another win for gamemaker) and it sold well, in the end it literally didn't matter. It's more of a proof that you can compromise on code that isn't critical by design.

In fact, the Left4dead franchise dialogue and chatter system used a somewhat worse tool, it was literally an excel sheet with thousands of lines, an audio link, and a bunch of conditional variables and weights to test if a line should be played or not. Running lines in succession wasn't even appended to a table, it literally had a variable to check of the previous line was said for every line. The game had to validate every single line on the whole file to actually pick a line. In the end? worked fine.

Throwing optimisation shenanigans without context is peak midwit response. Devs that get shit done, and win game awards mind you, focus on critical code, non critical code just has to werks(tm) even if it's an ugly hack.
>>
Is there a repo for pseudocode for rendering algorithms. I'm a complete n00b and just want to get a feel for graphics programming. As far as libraries, is SDL2 good for this?
>>
>>101904918
>I'm a complete n00b
learnopengl
>>
Are there any special rules with sending a time uniform to a GLSL shader that I should be aware of? I made something in Shadertoy and now I'm using it in Vulkan, but the time scale seems slower. I'm using
 (float)(clock() - startTime) / CLOCKS_PER_SEC

for the time updates. I just memcpy that value into mapped memory.
>>
>>101904209
King Jesus Christ bless you as well.
>>
>>101904359
>it can slow the game multiple frames to get the initial text and it wouldn't have changed a thing.
there will always be some tard complaining about fps drops
>Throwing optimisation shenanigans
a table of pointers, reusability, and avoiding memory allocation is a "shenanigan" to you?
>without context is peak midwit response.
we have context, in this very thread, we have a giant switch statement, anon asked *why* is it *bad*
>Devs that get shit done, and win game awards mind you, focus on critical code,
Who is this engineer who won a game award you are talking about? Companies win game awards. Also who the fuck actually cares about game awards except companies, /v/ kids, and clammy hand investors?
>non critical code just has to werks(tm) even if it's an ugly hack.
this is obviously a given, and the peak midwit example btw is the fast inverse squareroot
>>
>>101905642
CLOCKS_PER_SEC is meaningless
>>
>>101905819
I don't understand. I need time in seconds. In POSIX for example it's fixed at 1000.
>>
File: 1704227863747547.jpg (80 KB, 480x480)
80 KB
80 KB JPG
I wrote a batch renderer where I batch the meshs' vertices and indices into two buffers and then use them to make a draw call. I tested it to draw 5000 dynamic objects and the performance gain is about 7 frames. Not sure if it's even worth it to continue working on it.
>>
>>101905642
>I just memcpy that value into mapped memory
since you are using vulkan, consider using push constants for this.
https://docs.vulkan.org/guide/latest/push_constants.html
>>
File: kek.jpg (97 KB, 469x385)
97 KB
97 KB JPG
>>101905917
>and the performance gain is about 7 frames
>>
>>101905913
clock() doesn't give wall time it gives processor time which depends on your OS scheduler etc, it's basically useless, and CLOCKS_PER_SEC is even more useless because it's just an arbitrary constant they picked. Why don't you use an actual time function?
>>
>>101905917
I wraned you about batching dynamic meshes
>>
>>101905917
I did this too, in Vulkan.
>>
>>101905922
Will that solve my problem?
I know I should do it anyway since I'm not sending much data.

>>101905974
I knew clock() wasn't high precision but is it that bad? How inaccurate can it be? I'm seeing (roughly going by eye) a 1.5x speed difference in my code
>>
>>101906021
>I knew clock() wasn't high precision but is it that bad? How inaccurate can it be? I'm seeing (roughly going by eye) a 1.5x speed difference in my code
It's not imprecise, it's useless. It's just spitting out random numbers basically.
>>
>>101906054
So I should always use clock_gettime() on Linux and whatever Windows uses? What do you normally do?
>>
>>101906054
>>101906126
Sorry my post got cut off. I meant to also ask if you find glfw high-res timer sufficient? I'm more used to doing things in C++ where I'd use the built-in high resolution clock, but I'm practicing my C currently.
>>
>>101905917
mad lad
by dynamic are you saying that they change every frame?
>>101905991
no you warned me not him.
>>
>>101906236
>by dynamic are you saying that they change every frame?
I apply their model matrices to their vertices each frame yeah.
>>
glfw fixed the time problem. I'll also change it to use push constants instead of uniform buffer. Thanks for all the help frens.
>>
>>101905917
so you increased the frame-rate from 1 to 8? Wow!
>>
>>101906271
I'm still impressed that sending a new vertex buffer every frame is still faster then doing 5k drawcalls.

Have you tried to have 2 vertex buffers? One for objects that haven't move since last frame, and one for moved objects. And you move objects between those two buffers?
>>
>>101906400
>I'm still impressed that sending a new vertex buffer every frame is still faster then doing 5k drawcalls.
they must be tiny meshes
>>
File: file.png (519 KB, 401x597)
519 KB
519 KB PNG
This book was written in 1995 where they used C. Is there modern equivalents of this book except using C++? I know with all the engines today, you dont really need to use low level programming anymore except for little optimizations, so I dont mind how high level it is.
>>
>>101906984
>Is there modern equivalents of this book
no, modern 3D rendering is essentially too complicated
>>
>>101907011
It doesnt have to be anymore complicated than assigning vertices to triangle or other shapes in a buffer. But you're right, when you use Unity or Unreal and do "low level rendering", you dont have to worry much about anything except how to manipulate the polygons.

Btw, I also want it to be a "game programming" book, not just on 3D stuff;
>>
>>101906984
>using C++

gross ...
Putting that aside, I really love that book cover.
>>
>>101907055
They just don't make books like that for modern gamedev, you have to learn it yourself
I suppose there is Handmade Hero but I wouldn't recommend following that
>>
>>101907117
I have all the old books but every modern book so far has been very...I dont know the word. Preachy? Lacking of real in depth content. If stuff like Gems of Programming really are only things of the past, I guess thats what I have to stick with. Even though there's a lot of wisdom and knowledge in the old books, you can tell half of it is outdated due to the tech we use now.

And if I want to look into low level stuff, I'd just go study something like embedded programming with C or high frequency trading.
>>
>>101907180
That's half because people don't gamedev from scratch anymore and half because the internet now exists which makes books obselete
There are good online tutotirals like learnopengl, you should be following things like that, don't look for books
>>
>>101907218
I used opengl. But everytime I go through the boredom of boilerplate, it reminds me of why engines like Unity and Unreal are so popular. No one wants to deal with that shit. However, I praise Unreal more for being open source.
>>
>>101907239
ok you only write that once though.
>>
>>101907218
so I guess we're outliers then.
>>
>>101906984
They don't exist anymore because peopl were smarter back then and people are dumber now. It has very little to do with how complicated rendering is, and more to do with lack of exposure due to abstraction golems enforcing braindeadness.
>>
>>101907939
Ignorant zoomer making up myths about a past he wasn't around for
>>
I've been using Vulkan, and I'll be honest I see Unreal Engine and off the shelf engines as more complex to use.
>>
>>101906021
>Will that solve my problem?
yes but to be more precise, it'll make things more simple. Just create a push constant struct and have the current time as a struct filed and update it with draw commands. I do this and I also include camera's projection matrix and get away with not creating a uniform buffer for camera projection. It just works and it being a simpler implementation is the reason for my suggestion.
>>
>>101905917
frames is a retarded unit of measure, 7 frames in 70 fps is a 10% increase, +7 frames from 1 fps is a 700% increase, tell us the measured time so we can actually judge it.
>>
>>101907965
yeah sure tell to that the python "coders"
>>
File: logo.png (266 KB, 1001x790)
266 KB
266 KB PNG
Now I can place coloured voxels :)
>>
Been bashing my head trying to figure out a nice animation system, then I noticed that lua coroutines would've been great for animations, hell even compiling animations to straight up code would've been good. Animations are basically little virtual machines anyway.
>>
c++ and code architecture is so hard and painful.
lambdas + smart pointers already filter me, so when I see constexpr, inline and other shit like that I'm done.
Jesus fuck I wish I took some C/CUDA/GPU architecture/software dev course instead of FUCKING MATHS AND IMAGE PROCESSING
>>
>>101910134
C is simpler. Just use C.
>>
>>101910134
'Lambda' is an equivalent of a function pointer - essentially 'function by value'. Their syntax is fugly tho.
Smart pointer is just usage of RAII.
RAII is what makes C++ what it is.

Inline is a declaration of "insert code of this function instead of calling it".
constexpr is 'this can be evaluated by a compiler'

I've been doing this language for 20 years. Ask away if you want something clarified.
>>
>>101910311
>I've been doing this language for 20 years
what's the most sane subset of C++? and what's the worst features that newbies should avoid?
>>
>>101910311
Lambda is a "closure", a function that encloses (stores) some state. Only the lambda with empty capture list is equivalent to function pointer.
>>
>>101910363
I don't think any is 'sane'. They are features, and since the language is 40 years old it is an unholy amalgam of 'stuff'. Some of which was good, some, not quite. For example - for years 'iterators' were drilled into people's heads, now I barely use them.

Anyhow.

Learn C - because C is easy as fuck and some of the more fucky features of C++ ( like headers or inlining ) were grandfathered from C. Then accustomise yourself to the concept of RAII. C++ is C with RAII. Essentially.

For example - a smart pointer is doodad that automatically frees memory once it goes out of scope following RAII rules.

Otherwise - learn as you go, don't try to swallow everything whole. There are things in c++ I never used despite being paid for writing code in it. Competence building is always hard.
>>
>>101910551
Yes. Which is a useless set of words that mean nothing to normal programmers.

In practice - lambda is a 'function by value' built on top of 'auto' keyword. In pure c++ code it is used in place of function pointers, static initializers or opaque interfaces. I use them widely in the UI of my game.
>>
>>101910758
If you don't understand his very simple definition of lambdas I don't think you get to call yourself a "normal programmer"
>>
>>101910758
Lambda is not a function in practice, it's an anonymous class with overloaded operator().
>>
>>101910758
wtf
that other anon's explaination was at least right
it's just syntax sugar for a an unnamed class with an operator() with a few extra features, the capture list are the member variables
>>
>>101906984
Maybe I don't understand the question but I'm confused by the answers. There are plenty of books that will teach you to make a simple game engine and primitive renderer
>>
>>101910758
Consider the following
auto l1 = []{};
auto l2 = [a=1]{};
void(*fp)();
fp = l1; // we guchi
//fp = l2; // compile error
>>
>>101906984
Introduction to 3D Game Programming with Direct3D 12.0 is the latest in a long running series of books which i've always heard really good things about despite being directx based
the books by 'Wolfgang Engel' cover a variety of tasks under a variety of graphics topics

learnopengl.com would be where i'd start since it at least has you make a breakout clone at the end of it
vkguide.dev is the only vulkan resource that's actually updated to some of the latest standards and doesn't just do the annoying thing the rest do where they enable a single new feature use it in a really basic example that only uses that feature
vulkan's got actually documentation instead of just a standard though it is still complex
you can read research papers or articles by gpu vendors like amd's at https://gpuopen.com/learn/ and nvidia's somewhere on their site

read people's blogs
https://iquilezles.org/articles/ is probably the best for graphics math, he's a demoscene guy and the dev of shadertoy
with learning some of the advanced aspects of C++ specifically some of the ones linked on isocpp.org
while i don't know how much they'd help with games there's plenty of good ones that cover concepts like concurrency and parallelism or things like coroutines or modern constexpr programming
i quite like https://www.modernescpp.com/


>>101911247
to be fair, graphics and engine design have gotten fairly complicated since then
i don't know how many generic 3D engine design books there really are these days
there's resources for a whole load of specialized stuff which would constitute the components of an engine/game if you put it all together
whereas that looks like it has a few working game examples at the end of it
>>
>>101909995
noice!!
>>
>>101911247
>There are plenty of books that will teach you to make a simple game engine and primitive renderer
where?
>>
File: 1723626281763334.jpg (87 KB, 653x1000)
87 KB
87 KB JPG
>>101911998
>>
File: 51KPHqCUf5L._SL1270_.jpg (64 KB, 1000x1270)
64 KB
64 KB JPG
>>101906984
>>101911998
Here's one from 2018 that should be pretty similar in style to the book you posted
>>
>tfw copied a 2d character movement system from a youtube tutorial
feelin like a real game dev right about now lads
>>
bump
>>
File: 1678190796567031.png (677 KB, 843x637)
677 KB
677 KB PNG
I think I got burned out again...
I just open my editor look at the code and just dread
>>
>>101917737
I have to rotate between hobbies to stop that happening, but long term progress becomes very slow that way.
>>
>>101917737
I've procrastinating on reworking my UI code and shadow mapping code for 2 months now.
ffs I'm porting my engine to Android instead of actually getting work done kek.
>>
>>101917895
this is good advice and true in my experience. what do you juggle?
>>
>>101917928
- Programming
- Old School Runescape (MMOs are such a time waster they deserve their own category from other games)
- Other games
- Anime
- More 4chan than just the few generals I have watched
- Watching live streamers

When I program, I usually get super invested, and it'll be thing I spend most of my free time on, but then it'll just peter out eventually and I probably won't do anything for several weeks.
>>
>>101918012
I don't know how these are interchangable activities
Programming takes effort, the other things don't
>>
>>101918043
agreed
>>101918012
for me its writing, programming, painting and music
>>
>>101910847
> Akshually 2: The Post
>>101910910
No. If you want to be very, very, very accurate it is not. It might be implemented like this, but it does not need to. In principle though, you are right.
>>101910931
You are correct.

All three of you need to calm your tits and learn a valuable skill of unpacking what other people say without seething when you hear something you don't like. I know that in the current day and age falling back to the worst possible interpretation is the norm ( see: youtube and the neverending stream of "the world is ending zomg" videos from just about any angle ).

In this case:

>>101910910
A class with an overloaded () operator is called a 'functor'. Which was an early C++ way to provide a type-safe feature of deferred function calls. Used extensively throughout STL.
A 'functor' from a 'function' differs by implementation, not intent. Pure functions can even have a closure:

int foo = 0; //variable seen from the body of a function _is_a_ closure

int bar( int a, int b )
{
return a + b + foo;
}
// c++ lambda equivalent
auto l = [foo]( int a, int b )
{
return a + b + foo;
}
// a functor
struct bar
{
const int fooClosure;
bar( int foo ) : fooClosure( foo ){};
int operator()( int a, int b ) const
{
return a + b + fooClosure;
}
}


Each of these three has the same functionality and same purpose. Implementationally, they are different and language syntax will preclude usage of one or the other. Since in C, which is the precursor language, this feature was realised by function pointers, it can be said that both lambdas and functors are _equivalent_ concept. Or 'Function Pointers with Extra Steps' if you will.
>>
>>101911460
int foo( std::function< int( bool, char ) > callback )
{
bool a = true;
char b = 'f';
return callback( a, b );
}

foo( []( bool a, char b ){ return 1; }); // fine
foo( [this]( bool a, char b ){ return 2; }); // fine
foo( [this, that]( bool a, char b ){ return 3; }); // fine
foo( [&]( bool a, char b ){ return 4; }); // fine


I think in c++23 you can even pass lambdas by value directly without std::function using

int foo( auto callback );
>>
>>101918490
You said something retarded and wrong and three people corrected you
>>
>>101918600
>three people on 4chin are severely autistic
>autism presents as, among other things, trouble with mind theory

No surprises there.
>>
>>101918687
A lambda's not a function pointer bro
>>
>>101918748
Are we going to argue over semantics? I explained myself - what I mean by 'equivalent of'. I mean, I'm for a little flame war, I have a day off to burn.

Ok, an hour or so - then I'm off to workshop to work on my game.
>>
Fellas fellas. If you want to kill eachother over C++ do it over at /dpt/. In here we kill eachother over ECS and Vulkan or OpenGL
>>
>>101920083
it's funny tho, people arguing about the most stupid reasons, how many people even enginedev in C++ in this thread?
>>
>>101920207
I enginedev in C++
>>
File: 1723188725381473.png (420 KB, 544x680)
420 KB
420 KB PNG
>>101920207
me
>>
>>101920955
>>101920956
my condolence
>>
>>101921069
what memelang do you use?
>>
>>101921166
Zig and C
>>
>>101918571
Do you know what std::function is? Pro tip: it has almost nothing in common with function pointers.
>>
anyone checking out s&box?
>>
>>101910311
>Inline is a declaration of "insert code of this function instead of calling it".
that's not true, the inline keyword has a different meaning than function inlining, for which you need a compiler builtin
>>
>>101904238
>just mod a shit game with no life using a shit modding API written in a shit language that will break on next release
you are the fucking retard here
>>
>>101910134
>I WISH I COULD TAKE, LIKE, REAL CSI CLASSES WITH COPS AND SHIT INSTEAD OF THIS MORPHOPHYSIOLOGY BULLSHIT!!!! I JUST WANTED TO BE A FORENSIC AGENT, NOT A DOCTOR!!!!
this is how braindead you sound
i suggest self-death
>>
Alright I have a question. Is "make a game not an engine" actually good advice? I don't make games much, but I know that making a generic game engine is hard as fuck.
Every time I tried to make a game I got stuck when some fancy generic system I made grew over my head to the point that I wasn't even making the game, but the system.
I assume that is what that advice is trying to stop you from doing, but from the time I started programming it has been drilled into me that "rigid" code is bad and generic is good, what do I do bros?
>>
>>101924086
It depends on what you want to do, man. If you'd rather not use a pre-existing engine, you need to focus your efforts on making the engine first, and whenever that's done, worry about the game. Trying to split your time as a game designer and engine dev isn't intuitive.
>>
>>101924086
I mean if your making something that cant just be defined entirely programmatically like pong your gonna need some kind of system to deliver data to your game



[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.