DirectX Game Engine Edition/gedg/ Wiki: https://igwiki.lyci.de/wiki//gedg/_-_Game_and_Engine_Dev_GeneralIRC: irc.rizon.net #/g/gedgProgress Day: https://rentry.org/gedg-jams/gedg/ Compendium: https://rentry.org/gedg/agdg/: >>>/vg/agdgGraphics Debugger: https://renderdoc.org/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.previous: >>109167917
>>109219142I want to make a game engine like Re-Volt's engine
glitchy ragdolls
>>109219142PBR was a mistake. It makes every game look the same and it causes issues with MSAA.Bring back non-physical techniques like Blinn-Phong. Use weird arbitrary non-physical artist-tweakable values in your lighting maths. Author your assets with the target lighting in mind. Bake your environment lighting, but do it with a crude DIY hacky basic raytracer and not with a nice clean physically-correct modern path tracer.
>>109219240>Bake your environment lightingthis. Everything looked so much better back then
>>109219240>PBR>causes issues with MSAA.MSAA was dead long before PBR. You can thank this green motherfucker.
I need a networking solution for custom OpenGL game, Any recommendations?
>>109220239https://github.com/mas-bandwidth/yojimbo
I don't really have strenght to be making video games
>>109220254I think I will go with ENet, thanks though
>>109220239Winsock?
>>109219240This, and deferred rendering too.
Finally got vulkan to draw a texture. The descriptor sets are a mess, gotta learn what that 'bindless' that people are talking about is.
nobody bats an eye at a forced cis heterosexual relationship in a game, but one required homosexual kiss and every chud wants you cancelled
>>109219240PBR if just fine. The real issue is how post processing and HDR is handled. There’s a real why all these games have a foggy look to them.
>>109223856Use the new descriptor heap extension
I’m using c++26. See ya losers later. With the help of my clanker I’m going to make a bleeding edge game engine.
>>109225289Godspeed Anon. I tried the new reflection capable g++ for a day or two. Jolt wouldn't compile because of a compiler bug. clangd wasn't able to parse reflection code. I'm back to C++23 now.
how the FR*CK do you write a game engine with dataflow?
>>109225383Shit I plan on using Jolt. Is it something that can be worked around?
>>109225392whats dataflow?
>>109225410It's fixed in the upcoming gcc release.
>>109225462Thank god. 16.2 is coming next month. I love msvc but it’s crazy how it has like zero c++26 features.
>>109225476What do you use as LSP?
I need to wrtie something in C++, preferably C++26
>>109219142remember how back in 2000s you could shit out anything 3D and it was considered cool and awesome?
>>109219142Bump, haven't been on 4 in quite a while, glad that /gedg/ is still alive, even if less active.
>>109225852what language is that
>>109225880You could convince me that it's C bastardized with macros.
>>109225568My toolchain is opencode + gpt 5.5, gcc 16.1 (obviously), cmake 4.3, and clion 2026.2 EAP (which supports c++26 syntax highlighting). However the clion syntax highlighter doesn’t play nicely with the std module (it tries to read from headers) so even though things compile it shows a bunch of errors when using anything from std. This is a known issue with clion and the workaround is in cmake to manually link the std module (and compat) as a static library and then disable compilation for it. There’s also an issue with gcc where you can’t use std::format and its derivatives like print in two separate modules via import std; otherwise you get a multiple definitions error. So my logger (the only things that’s using format atm) needs a cpp file for function implementations that involve format, which is fine but annoying. I miss MSVC. I had zero issues with modules minus intellisense but I replaced that with the resharper. I also changed a bunch of clion settings so it looks and feels like visual studio.
>>109225880It's C with some GNU extensions, but they're not used in this part of the code, they're used in parser and OpenGL / OpenAL wrapper.>>109225915I avoid macros and entire preprocessor like hell, these are typedefs. I even use 'extern <declaration>;' instead of #include in some cases.When I do use a macro, I either explicitly suffix it with '_macro', unless it's a simple '#define standard_output STDOUT_FILENO'.I'm refactoring this old C project, it's a game engine for HoM&M3-like game. To be honest, got tired of Ada and assembly, want to have fun now.---You can see that I'm a verbosityfag because of Ada... At least I'm not aislopfag.
>>109226115There is a difference between "writing verbose code" and "pointlessly typedefing a whole bunch of shit for no gain, while making your code more aggressive towards other programmers".
>>109226170I suggest you to take a look in RAD Debugger, main developer has some interesting insights into the source code of it, and Casey guy said "he can learn from Fleury", video is on Jewtube, won't post links here.> pointlessly typedefing a whole bunch of shit for no gainTrust me Anon, it's not about gain or loss, if you want your shit to work 6 months, years or decades from now, you simply do that. C is not ideal language for development, but it's better than anything else for my purpose. Needless to say, this point is going way further than I have time to explain here, for example why you'd want to have words like 'generic', 'procedure', 'no_arguments' or 'memory' instead of one word 'void', or how 'static' can mean multiple things depending on where it's used. Ada doesn't have those problems, but it comes at different problems and prices that I am willing to pay for some projects, but not for others.> making your code more aggressive towards other programmersNo one will read my shit anyway, I write it for myself, so that I'm happy and content with my code, people have LLM sl*p nowdays. I dislike LLMs for sure, sometimes they're useful to find synonyms and antonyms for words, instead of fighting with shitty search engines and websites full of ads and cookies. Even so, I bet someone can use chatbots to generate the thing I wrote in like a week or so, no harm in that, the only difference is that I spend 0$ on this, while generator spends a lot. I have a real non-tech job, I write code and do math for fun.
>>109226271Pointless typedefs does absolutely fuck all to improve "safety" of your code.Fundamentally nothing has changed, you just used a different word.
>>109226170I know this look like shit, but trust me, there's a lot of stuff finished beneath that you don't see in the demo yet.I ripped sprites, data and music from some website, since I don't have Windows to poke the PE (NT) executable myself.It's a proof of concept, that every script is parsed correctly, game data, sound and logic work, sprites and animations loaded and working...---Now imagine if someone would make good pixel art of this, or something original, like Bronze Age civilizations at war...
>>109226298Man, don't be a bitch.Be *the* bitch at least.
>>109226298I think it really says a lot. The people who are constantly shilling for these incompetent bottom of the barrel rad cock suckers do nothing but write toy programs and wrappers. I would've thought the 2 decade old meme of C midwits posting objdumps of code and sperging about code generation quality with no understanding of the architecture itself would've died, but no, compiler explorer gave new life to these faggots and casey made an entire career out clicking "view disassembly" in visual studio. Their code is horrendous, they lie about compiler optimization passes all the time, they do not understand the architectures they larp on about, and they do this utter shit in question as a form of parasitism. I guarantee you the only reason they're like this, the redunant macros that compile down to nothing and assembly incoherent sperging, is because they think it makes them special and nonreplacable.
>>109226500You're kinda correct in general, but I do write assemblers and wrote three compilers so far. Don't misunderstand, they're shit, no optimization, compilers are for stack-based language, etc. But shit works, it produces working ELF32 and ELF64 files.Image related is old code made for a group project, I used group style, this is not how I usually write stuff. I do know basic stuff about machine code (not only assembly), but not more complex stuff.Also, you sound like you use new meme languages like Pust, Zig, Nim or Go...
Casey has never made a game
>>109225260No support for this in my driver unfortunately, I'll look into descriptor indexing instead
>>109225734those 3d aquarium screensavers sold a ton of copies
Should I use Visual Studio 2005 or 2008?
>>109226666Do you want to support win xp or smth?
>>109226661I know you type this ironically but they probably did
>>109226698no they honestly did. the most popular one got like 20 million downloads and tens of millions of dollars.
>>109226698>>109226661early 2000s was wild with fish
>>109226715I have that fish at home
>>109226732they used to put it on walls and have it motion activated to scare kids
>>109224285Have you tried being normal?
>>109226614Neither have you.
>>109226715TAKE ME TO THE RIVER
>>109225734Back in the 90s it didn't even have to be 3D people were just excited about cool vibrant multimedia. I miss when computers had cohesive themes including screensavers and soundscapes and ideally you'd have an oil diffuser or scented candle that also matched the theme. Maximum comfy.Also 3D aquarium screensavers and the like are still cool, fight me bitch.
>>109225410you could try box3d. came out recently
>>109228016box3d isn't comparable at all. It's C retardation that's meant to be included in a gay engine like Unreal. If you're a white man like Terry you write your own goddamn engine.
>>109219142IS XNA still viable?
>>109228121MonoGame is the successor of it
Post webms of your games
>>109228365Still working on systems.
https://github.com/carbonengine/trinityeve online open sourced its game engine, for anyone interested in that.
>>109227350t. guy who got his ideas about the 90s from vaporwave videos
>>109219142Can some kind anon with access to the best AIs have it make me a tutorial on how to program an RPG step by step?I want to make one, but I lack any sort of critical and independent thought process. I need monkey see monkey do, but open-source games are too overwhelming so I need step by step.
>>109229461Just have AI do it for you
>>109229461An AI sub is what, 20 a month? Stop being cheap.
How Indian do you have to be to have an AI sub?
>>109229855Dunno about Indian but you have to be employed (and employable) for a start from what I've seen.
>>109229974is that what a programming job is now? AI prompting?
>>109230131I doubt you'll find a single workplace where SWEs don't use AI nowadays.
I'm working on a 3d voxel engine that "bears some similarities" with Minecraft, all from scratch, written in C. What I have so far:Procedural world generated in six stages: height‑mapped terrain with island‑ocean coastlines, ore veins (coal, iron, gold, diamond, lapis lazuli), worm‑like cave carvers, underground chambers with loot chests, forests with oak/birch/acacia/cherry trees, giant mushrooms towering the terrain, and surface decorations (melon/pumpkin patches, sugar cane). Deepslate and voidstone appear at deeper layers. Standard world size is 512x128x512, with a total of 33,554,432 blocks and ~32 MB RAM usage.55+ block types including natural terrain, four wood species with planks and leaves, sandstone, clay, terracotta and dyed variants, polished stone and brick blocks, functional blocks (chest, furnace, iron/gold block, bookcase, barrel), and water.Procedural textures for every block and item, generated at startup using noise and pattern algorithms: no image files required.And a bunch of other sexy stuff. All in an ~158 KB binary.
>>109230353
Anons...Say I wanted to make a Rune Factory 4 clone.Say I really like this game and want to add content to it, but since reverse engineering and decompiling are hard, my best bet is to make a clone with the same assets.How hard would it be?Or is it a pipe dream?Let's say I use AI to help me, do you think it's feasible for a noob?Even if I know C and some OpenGL, I'm lost when it comes to programming game mechanics.Sandniggers can make games, so why can't I?
>>109230415>Let's say I use AI to help me, do you think it's feasible for a noob?no
>bro you should port doomoof>bro you should download quake zip on githuboof>bro you should tinker with opengoal and get a copy of Jak and Daxteroof>hey isn't half life open source?>uhhhh>HEY COME BACK HERE>NO DONT>Xash3D it is then
>>109230523What in the name of Lapislazuli Anriquini are you blabbering about?
>>109230544sounds like he has several voices in his head all giving him bad advice
>>109230547fuck you
>>109230558programming shit like it's the 90s or 2000s is bad advice, sorry
>>109230547Looks like he's reading that shitty beginner trap book. Do we tell him yet, or let him marinate in his misery a bit more?
>>109230523>wants to learn game engine dev>but spits on the most complete open-source commercial gamesHoly Faggot McFag.
>>109230608they're ancient, you're better off looking at Godot
I've completely stopped coding for my engine and moved to claude, it's just too good bros. Added a 2.5D renderer with a map editor over the last week for a quick little fps segment. It's sector based with cascade shadow maps for sky, point lights, a shadow map atlas, clustered forward rendering, reflective shadow maps for GI. Got claude adding monster behavior now.
>>109230626>he thinks studying a game engine is the same thing as studying a game engine running a commercial gameYou aren't gonna make it, sorry anon. Wish for better luck in your future endeavors.
>>109230608>>109230626there's a lesson in both of these postsdeveloping for the gabe cube is top priority honestly but with the knowledge to earn it to appreciate it
>>109230665>developing for the gabe cubeAin't that just a low-spec pc?
>>109230664I've been working on games and game engines since the 90s and I can tell you that studying a game from the 90s is a bad idea
>>109230672yes
>>109230676then you're the museum exhibit of interest, anon
>>109230693what?
>>109230676Ahh right, because it doesn't showcase the latest snake oil scam. What are you scammers peddling now, AI? Raytracing?
>>109230739Do you have any idea what you're talking about
>>109230698There are side scroller shitposts selling for millions of dollars by god tier solo devs doing low ball pricing. We are not all motivated to be the next John Carmack but we should all be educated by John Carmack as a baseline.
>>109230785>we should all be educated by John Carmack as a baseline.You shouldn't because the last time he was relevant to video game programming was the 90s
>>109230793The doctor you saw about that lump in your chest was born in the '70, so he's irrelevant todayim. You should disregard everything he says and eat plants or something. It worked for SJ.
>>109230805imagine comparing video game development to medicinewhat a stupid fucking analogy
>>109230907im not that anon but i would compare it to my math teacher being a hot woman 20 years ago vs "when am i ever gonna use this irl?!"
>>109230961the way you programmed games in the 90s was pretty simplistic, which in some ways is a good thing but in other way it's a bad thing because simple architectures means you're going to have difficulty implementing a lot of features modern games take for granted
>>109230805it's so joever for film, kino bros
>>109230987>miniclip vibe coders playing shareware Kirklife 3 while >AAA consumers are playing Blowathan John's Sokoban Snake Tetris Candy Crush (it was programmed in Jai by hand (AND EXPENSIVE!))
>>109230987like what
>>109231148Modern games like to do stat and skill systems that interact with gameplay mechanics in a complex way, that's going to be a pain to do if your game is structured like QuakeIt's also much harder to iterate on game ideas and create complex gameplay logic in general if you don't have some sort of object composition system
>>109231317>acting like modern games have more complex/skill stat systems than 90s and earlier gamesare you fucking retarded. have you ever played a game from the 90s?
>>109231325>>acting like modern games have more complex/skill stat systems than 90s and earlier gamesthey absolutely do
Elite github knowledge
>>109219142what tutorials/resources/books do you guys recommend for DirectX 9 programming?I was given a Windows XP laptop and want to build something in it>inb4 install linuxthat wouldn't be fun though
>>109231559Too bad kons-9 is dead and never amounted to shit. The idea of an emacs of 3D was cool, wish it had gone somewhere.
>>109230353Are your cave carvers simple 3d noise or do you have something more complex? Given your world size I assume you generate everything upfront. Is there an actual chunk system going on there? Also how do you min max ram usage when doing these Minecraft clones? Could you achieve the same in c++?
>>109231325>if I had more fire resistance, I could kill the fire elemental!
>>109230131pretty much. it all went to shit.
Going to use flutter for my engine ui. Apparently it’s the new hip thing companies are doing to get around the typical paid frameworks.
>>109231847There’s plenty of DirectX 9 stuff online, I don’t have any recommendations but I’ve built a quick DirectX 8 engine using chatgpt, it’s a pretty good tutorial it can explain stuff and whatnot
using Unity while having ambition for your own game engine is total humiliation factory
>engine devs at Id are all laid offWhat happened bros? I thought we were unlayable?
>>109232982>I thought we were unlayable?we aret. jobless
https://www.youtube.com/watch?v=0i4UlhUkn5w
>>109219142I made some progress on my game engine, but I'm stuck. Can anyone guide me from this to a good 3d game engine? I want to make an open-world RPG.
>>109233199Read about the structure of a game engine? main.cpp is a good starting point but you're gonna need more files
>>109233199please stop posting already
>>109233199Start by removing the 'pp' from your file extension.
>>109226543>Ignores pretty much everything I said>Shills a literal who assembler as if anybody cares about a simple parser and bitfield builder>If I don't entirely agree with you. you must use a language i dont likeHave you considered the rope? You seem too mentally unwell to function beyond the rioting oogabooga wigger threshold.
>>109233199you're almost there, anon. keep at it.
>>109233372He's a slav go easy on him
>>109229840You guys are paying for AI?
>>109233655You’re not?
>>109233365More like transitioning to C by removing your pp.
>>109233655"You" who? The company? Yeah we get $2k to spend in tokens in work-related matters.
why Vulkan so difficult?
>>109234044This gets asked so often that every LLM out there must've digested thousands upon thousands of answers to it.
Best encapsulation of the failure of modern graphics APIs is that you'll never find good modular graphics programming related libraries that you can slot into your renderers. I can't just pull a nice implementation of a cascading shadow map off of github and stick it into my project I have to comb through their CPU code and shader code and see what kinda ad hoc bullshit they did and adapt it to my own ad hoc bullshit then maybe get it working after hours of tedium.
>>109234504retvrn
>>109234593no just learn more vim than vim and config your config, goyim
>>109231987The cave carvers are worm-like 3d noise, basically it's a "worm" 10*area_scale (area scale is a world size factor, bigger worms for bigger worlds) carving worm-like tunnels with a mutating radius (8-12 blocks), altitude is clamped between Y14-52 (Y0 is bedrock), Y52 because water level is Y64 and i want a very rare chance for the worm to burst ouside of the ground, creating some amazing looking caverns (and not ridges or just cracks in the surface, full-blown caverns). Each worm takes about 45 steps then stops.After the worm carving phase there is another worldgen phase which generates treasure rooms (small hollow rooms, 5x5x5, with a central loot chest filled from a specific table. Each chamber rolls 4-10 items with weighted random selection.)Those treasure chambers have a big chance to be created adiacent to the caves, which will just expand the cave into the room. A later worldgen phase decorates the cave walls (and the neighboring treasure chambers) with specific blocks, based on the Y coordonates (voidstone at the bottom layer, granite, diorite, andesite, coal, iron, gold, depending on the Y coords.The whole world is generated upfront, a full worldgen of a 1024x128x1024 world takes 45 seconds, but that's half a billion blocks and hald a GB of RAM. Normal worlds (512x128x512) generate in 8-10 seconds.No chunk system involved, i see no point for that, for now.I never did C++, so I can't help you there, but i always try to keep ram usage to a minimum, and the various optimizations are the best part.
>>109233710No, I use all the Chinese ones for free like Deepseek, Qwen and etc, they give you a lot for free. Qwen has never blocked me.
>>109233783>imagine giving money to open gay eye and fagthropic
>>109230676a 30 yo boomer knows this tacitly (you wouldn't think to write this stuff down) but zoomers need a history lesson to know what the ground floor of a game loop is to survive the mess that is the modern distrohopping landscape.
>>109234919The local models have been hit or miss for me on if they’ll actually tool call or just perpetually carrot me. “Okay, I’m making the change right now!”>no you didn’t“You’re right I didn’t I’ll do that right now!”>etc
>>109234882>no chunk system involvedso you just have the entire world loaded and rendered at all times? how are you storing block data and how are you creating meshes?
>>109235156The entire world is loaded in RAM at all time (basically it's an array of uint8 + some special arrays for complex objects, like chests or furnaces (the have their own storage system), but i'm raycasting only the blocks in view, up to a max blockview limit (which is usually 70, a fog effect is applied for anything beyond that so it's not rendered), DDA ray march through world grid until a solid block is hit, then compute texture UV, apply side-based lighting, fog blending, and target outline.It sounds more complex than it really is, but keep in mind that i'm mostly testing this in QEMU, so the current window resolution is 800x600 while the render resolution is usually 400x300, mainly because i want the upscalling for that jagged retro look. On proper hardware the emulation limits vanish but we're still talking about non-accelerated graphics here.
>>109233372> > Ignores pretty much everything I said.Yes.>>109233389Yes. (:
>>109226115>>109226271>>109236825Well, as long as only you will ever work on it knock yourself out, but please do not typedef shit like this if you intend to work with others.
>>109231847DX9 is bad because it has special snowflake texel coordinates, and it has some bullshit related to Device Loss that DX9Ex fixes (windows vista).Install windows 7 on it so that you can do DX11, maybe DX12-on-Win7, if possible (But I think you should ask the AI if windows 7 even has drivers for your specific laptop model). But you need 2gb or more ram.
>>109236876Yeah I work alone and I write for fun. All jokes aside, I do refactor my own stuff.Some parts of the code I wrote semi-drunk.Then later I look at it, and I'm wtfing...---Like 2-3 years ago, I decided to write for myself.Like no one will ever use or modify my code.Which stayed true for this long...Only 2 guy used my stuff, and refactored into normal C.
>>109235132I've never seen that from any local coding setup I've tried. I've used M2.1, M2.5, Qwen3.5, Qwen3.6, and GLM-5.1 in OpenCode and pi. Though I have seen some weird behavior from Gemma 4 with no system prompt when I tell it to use a particular MCP server but I forgot to actually set the thing up.But it sounds like your workflow is quite different from mine. My setup is pretty slow, so I typically just give it a single prompt, let it run in YOLO mode (in a sandboxed VM) for an hour or two, and come back to review the final output.
>>109236915*you might be able to install windows 7, but you probably won't be able to use DX11...
>>109232982Someone on /v/ said they were being dickheads about sharing their tools so this is Microsoft punishing them.
>>109237252It's more that M$ was doing the old "train your replacements" trick, and id weren't falling for it.
>>109232982https://www.eurogamer.net/developers-microsoft-owned-doom-studio-id-software-form-union-with-cwa
Claude has been absolutely cooking the past few days, been adding so many features. it banged out this profiler/flamegraph with cpu/gpu and everything. Also had it bang out a lot of asset imprting stuff like audio compression stuff, had it add a lua debugger finally, lots of lua reflection/binding stuff, made the assetbrowser better looking and super functioal, prefab stuff, lots of animation stuff to be like unreal, pretty much got all the animation blueprint nodes fully implmented in code. note performance is shit cause im in a debug build. If anyone wants to help vibe code with me, ill share the repo>>109230626>even looking at godotNGMI
>>109234504thats not a failure of graphics APIs thats you not understanding how abstraction layers work
Unrelated image, please ignore...
You faggots better keep this thread alive until tomorrow morning.
>>109237569Classic slop.>>109237303Microslop.
>>109237569woah. a worse copy of things that have already existed for 30 years except giving money to [COMPANY] every time you wanna make it a tiny bit less worse? this. changes. everything.
are there atomic bitwise operations?
>>109237923Cope. My agent is banging out an Agent-native UI kit for the engine right now. This is the future.
>>109238047show your code
>>109238047No, the future is ASMR educational content
>>109237923its more annoying that these faggots think its the chatbot doing all the work >>109238047 when in reality its the time and effort put in by the devs that came before us, and they get no credit. these retards think claude is just pulling all of this out of thin air.
>>109238047What is an “Agent-native UI kit”?
>>109238096"slop"
>>109238096It means its very css/html like so AI agents can natively write and undersand it. AI is very good at web interfaces, I want that to translate to my UI kit, so humans wont even be looking or editing the UI by hand, but instead by prompting it.
>>109238123lmaohtml/css is now "agent-native" and "unreadable by humans"
I wish this site made an AI board so AI retards could fuck off there
>>109238137Same, those slop faggots are more annoying than Indians or crypto-scammers.
If this thread dies, all Anons programs will segfault and their projects will be rewritten in ANSI C.
>All functions in Verse run as part of atomic transactions, which can be rolled back and resimulated when needed. These transactional semantics also extend to any C++ code that is called from Verse. For now, to make all this work, Verse runs on a single thread and calls C++ code built via a custom LLVM compiler that automatically transactionalizes the C++ code. In principle we can extend this method to automatically run transactions concurrently on different threads, but we have some work to do to get there on hardware that will scale appropriately.Epic is gonna make C++ great again
>>109238797It’s Jai all over again. Why is it so difficult to make a c++ but without the bloat of centuries past. We just now finally got reflection and it’s only supported by a rinky dinky compiler that’s furthest behind in module support. Nevermind the fact that modules are 6 years overdue.
>>109238797So all they gotta do is take a single threaded transaction system and make it massively parallel at hyper scale? Man why didn't I think of that.
>>109238829Verse is nothing like Jai
Anybody tried zig for shaders?
Gotta say Sol Ultra + the new Unreal MCP is making my life so much easier, I hope they don't nerf Sol too hard.
>>109228121No. It never was.
>>109239782Let's just ignore all the top selling games made with it
Can I VirtualAlloc 4gb at startup with no downside? Is it going to be hogging virtual memory from other processes or does each process have its own virtual memory space
>>109232848not sure if this poor thing can properly handle win7 at some usable degree, or even if it could have dx11 supportto give you an idea, this thing has specs similar to the EePC 1001P (Atom N150, 1GB RAM)
>>109240069meant for >>109236915
>>109239349zig? more like zog, amirite?
>>109239787What is this, an exam question? Well, professor, this is how I remember it (without asking any LLM). The TLB contains the memory mapping and it's per process. When the kernel switches processes, it has to switch the TLB data. The TLB contains the mapping of virtual memory into actual memory. You can configure various memory layouts such as SLAB, SLOB, SLUB, I don't recall all. But basically all of them are based on independent blocks of equal size (i.e. 4 kiB). If you try to access virtual memory which is not mapped in the TLB data, then a segmentation fault exception is raised and the kernel is interrupted. The kernel creates the mapping (IOW you get some extra latency here) and switches back to executing your process. If you're using a retarded operating system such as Winblows then idk. The short answer is that you can do that, there's very little benefit or downsides. In the overwhelming majority of cases it's a smell of bad program design or poor understanding of virtual memory.
>>109240147>there's very little benefitI can use 32bit indices into the memory block instead of 64bit pointers
>>109239787>Can I VirtualAlloc 4gb at startup with no downsideNo, Windows tracks available memory and only allows processes to allocate memory that is actually available. Linux differs in that it basically accepts any request for memory (even more memory than physically exists) but your process will be killed if it tries to use memory that can't be backed.In both cases the system call (VirtualAlloc or mmap) doesn't really allocate (physical) memory, it just creates page table entries and when you try to use the pages, you trigger a page fault and the page fault handler finds physical memory addresses. On Linux this means you can allocate massive amounts of memory and only pay for what you actually use, on Windows it's just an implementation detail because you can still only allocate memory if that memory will be available later.>Is it going to be hogging virtual memory from other processesYou can't affect other processes' virtual memory because every process has their own virtual address space by definition (otherwise they would be threads). >does each process have its own virtual memory space"Process" and "address space" are nearly synonymous.>>109240147>In the overwhelming majority of cases it's a smell of bad program design or poor understanding of virtual memory.It's standard practice on Linux to allocate some gigantic arena/pool so you don't have to deal with malloc/free overhead everywhere. You just mmap it at the beginning of the application, then munmap it at the end (technically optional).>>109240181>I can use 32bit indices into the memory block instead of 64bit pointersIs this for saving memory? Look into V8's pointer compression if so.
>>109240437>It's standard practice on LinuxIt's not.>You just mmapYou have to explicitly tell it to fault. By default it will be virtual.
>>109240437>Windows tracks available memory and only allows processes to allocate memory that is actually available.Are you sure about that?
>>109240437> It's standard practice on Linux...It should be, but it's not sadly. Retarded people write programs that leak memory, including toy libraries like SDL2, Raylib or GLFW, all the way up to MESA drivers, Nouveau drivers, and many many more programs, even compilers leak.Not a big deal in the end, but that leads me to believe that those sloppy programmers will fail to check some string, regexp or input, which leads to CVEs, crashes and bugs. Tip: Don't be lazy to implement a proper arena allocator, or to simply call free, initialize variables, try to use more constants, validate user input and data availability, enable all warnings, use static analysis, check out Valgrind, etc.
>>109242344>all the llms say ppm writebyte, raylib pygame, sandbox os migration I just want to gamecube drawcalls for gods sakes
Anyone can redpill me on cross compilation? I want to setup a pipeline for compiling from linux to windows using black vm magic. Anybody doing this? Will microsoft go for me if I use pirated tiny10 for this purpose?
>>109242636https://github.com/KallistiOS/KallistiOS
>>109242722just use mingw. no need to use windows at all.