\"} ;window.thread_json=[{"no":2672,"resto":0,"com":"I've been writing a largely custom game engine in C, C99 specifically because it's the best supported version of the language that isn't completely archaic. I'm using SDL, mostly because I want the thing to run in environments that aren't just the older version of Windows that I'm on. In doing so, I've realized two things:[br][/br][br][/br]First, I kind of wished I used C++. I still think C is the better overall language, and I don't exactly regret using it, but there's been a lot of situations where C++ features would've removed a lot of busywork on my end. For example, I have multiple circularly-linked lists that hold different structs but are otherwise identical in terms of access and modification, and they'd be a perfect candidate for templates. Right now, I'm handling them with a combination of boilerplate and weird post-hoc macro hacks that I put in to reduce said boilerplate when it became too much for me to manage.[br][/br][br][/br]Second, I've come to realize just how much of a game engine is just [e]bookkeeping[/e]: loading data, saving data, keeping logic running at consistent speed, normalizing coordinates so the scene can be rendered, maintaining the data structures necessary for things like rendering and audio playback, etc. The problem with most of these things is that it's hard to know if they're working individually, because you need to have several of the other features up-and-running first before you get any direct feedback; I need to treat them all as one big thing, at least in the short-term, and that's a style of programming that I am not at all used to.[br][/br][br][/br]There is no point to this thread, by the way, I just wanted to share.","title":"I've been writing a largely custom game engine in C,..","name":"Anonymous","time":1741116247,"last_modified":1768567428,"tn_h":181,"tn_w":255,"h":400,"w":563,"board":"maho","fsize":80130,"filename":"1000000523","ext":"jpg","file_id":"1741116247177","location":"haiji","md5":"399df778715ab577850fd2e9071cf1e3","cites":[{"post":"2693","board":"maho","host":"2672"},{"post":"4492","board":"maho","host":"2672"}],"last_replies":[{"no":2673,"resto":2672,"com":"Well I think it's good you shared because that's pretty cool. Are you going to go on to make your own games on it too, or do you just want to do the engine?[br][/br][br][/br]Also if most of the game engine is bookkeeping, what are the parts of it that you use for optimizing the engine to the type of game you want to make?","title":"1444426678495.png","name":"Anonymous","time":1741119585,"last_modified":1741119585,"tn_h":120,"tn_w":175,"h":275,"w":400,"board":"maho","fsize":59717,"filename":"1444426678495","ext":"png","file_id":"1741119585374","location":"haiji","md5":"e879e15d0ba7bf30a11ecde3861e93e3","cites":[{"post":"2677","board":"maho","host":"2672"}]},{"no":2674,"resto":2672,"com":"you're using a framework to build a game engine huh... I guess that's like using react to make a CMS. But typically when I hear of game engine dev people are doing it from a low level and building their own scripting engines and such","name":"Anonymous","time":1741120373,"last_modified":1741120373,"board":"maho","cites":[{"post":"2677","board":"maho","host":"2672"}]},{"no":2675,"resto":2672,"com":"But I'm just trying to make a fuss. It's a good project either way","name":"Anonymous","time":1741120418,"last_modified":1741120418,"board":"maho"},{"no":2677,"resto":2672,"com":"[c maho|2672|2673]\>\>\>/maho/2673[/c][br][/br][s quote]\>Are you going to go on to make your own games on it[/s][br][/br]Yep! I was going to use GameMaker, but I wanted access to the source code of my game, so I figured the best solution was to make an open source GameMaker-like engine myself.[br][/br][br][/br][s quote]\>Also if most of the game engine is bookkeeping, what are the parts of it that you use for optimizing the engine to the type of game you want to make?[/s][br][/br]I'm still very early in development (I can't even display proper sprites!), so I haven't had had much room to make specific optimizations yet. The biggest one I can think of is that I've inlined certain functions.[br][/br][br][/br]With that said, the engine is being built with 2D games in mind, and every choice I'm making is in service of making 2D games specifically run fast on relatively lowend hardware. [br][/br][br][/br][c maho|2672|2674]\>\>\>/maho/2674[/c][br][/br]SDL is mostly a compatibility layer over platform-specific APIs, and that's the extent of what I'm using it for. I'd considered building something like it myself, but I decided that the time and effort simply wasn't worth it, since anything I made would end up looking like SDL anyway.[br][/br][br][/br]You're right that it saves a lot of work though.","name":"Anonymous","time":1741125317,"last_modified":1741125317,"board":"maho","cites":[{"post":"2679","board":"maho","host":"2672"}]},{"no":2678,"resto":2672,"com":"[s quote]\>GameMaker[/s][br][/br]what about GDevelop?","name":"Anonymous","time":1741135063,"last_modified":1741135063,"board":"maho","cites":[{"post":"2680","board":"maho","host":"2672"}]},{"no":2679,"resto":2672,"com":"[c maho|2672|2677]\>\>\>/maho/2677[/c][br][/br]How does SDL handle 3D systems? When I used it a long time ago it was with a simplistic 2D asset game","name":"Anonymous","time":1741147379,"last_modified":1741147379,"board":"maho","cites":[{"post":"2680","board":"maho","host":"2672"},{"post":"2693","board":"maho","host":"2672"}]},{"no":2680,"resto":2672,"com":"[c maho|2672|2678]\>\>\>/maho/2678[/c][br][/br]I considered it, but it's too heavy for my liking, too much of a runtime, which is unfortunate, because I like a lot about it. I want something that's capable of running quickly on basically any hardware that's capable of running SDL. I grew up with a really crappy computer, so minimizing resource usage is important to me.[br][/br][br][/br]To put it into reference, rather than using a dedicated scripting language, right now the plan is to handle all scripting in C directly, with scripts being called via function pointers.[br][/br][br][/br][c maho|2672|2679]\>\>\>/maho/2679[/c][br][/br]It doesn't. For that kind of thing, you're expected to handle it in something like OpenGL directly.","name":"Anonymous","time":1741203348,"last_modified":1741203348,"board":"maho","cites":[{"post":"2693","board":"maho","host":"2672"}]},{"no":2682,"resto":2672,"com":"This sounds pretty cool, but I don't understand any of it.","title":"[Piyoko] Himitsu no AiPri - 44 [WEB AMZN 1080p h264 AC3 2.0][1B9C454F].mkv_snapshot_14.35_[2025.02.25_01.59.48].jpg","name":"Anonymous","time":1741210355,"last_modified":1741210355,"tn_h":98,"tn_w":175,"h":1080,"w":1920,"board":"maho","fsize":219018,"filename":"[Piyoko] Himitsu no AiPri - 44 [WEB AMZN 1080p h264 AC3 2.0][1B9C454F].mkv_snapshot_14.35_[2025.02.25_01.59.48]","ext":"jpg","file_id":"1741210355182","location":"haiji","md5":"7e5a1bd155d75a8f0591c2394d1cb510","cites":[{"post":"2685","board":"maho","host":"2672"}]},{"no":2685,"resto":2672,"com":"[c maho|2672|2682]\>\>\>/maho/2682[/c][br][/br]Truth be told, I don't fully get it either. This is far and away the most ambitious programming project I've ever undertaken, and it has very much been a learning experience.","name":"Anonymous","time":1741216431,"last_modified":1741216431,"board":"maho"},{"no":2693,"resto":2672,"com":"[c maho|2672|2679]\>\>\>/maho/2679[/c][br][/br][c maho|2672|2680]\>\>\>/maho/2680[/c][br][/br]You can use SDL with OpenGL. I did it once. I wouldn't ever recommend making a 3D engine from scratch though, it's a loooot of work. It can be fun, but you aren't gonna get a finished game engine or finished game out of it.[br][/br][br][/br][c maho|2672|2672]\>\>\>/maho/2672[/c][br][/br]OP, is your goal to learn programming and about game engines, or is it to make a finished game? If it's the latter, I would recommend using an engine like Unity or Godot, or a more comprehensive game framework like Love2D. You'll finish it twice as fast. If it's the former, more power to you, I hope you learn a lot.","name":"Anonymous","time":1741298461,"last_modified":1741298461,"board":"maho","cites":[{"post":"2694","board":"maho","host":"2672"},{"post":"2698","board":"maho","host":"2672"}]},{"no":2694,"resto":2672,"com":"[c maho|2672|2693]\>\>\>/maho/2693[/c][br][/br]raw 3D programming is very challenging because highschools don't provide us with good frameworks towards understanding quaternions","name":"Anonymous","time":1741298594,"last_modified":1741298594,"board":"maho"},{"no":2695,"resto":2672,"com":"thats very cool anon[br][/br]the part that I stalled on was making a 'level loading' system because everytime i try and learn bison/lexx to make a real parser for the level files i give up","opt":"sage","name":"Anonymous","time":1741328053,"last_modified":1741328053,"board":"maho"},{"no":2698,"resto":2672,"com":"[c maho|2672|2693]\>\>\>/maho/2693[/c][br][/br][s quote]\>OP, is your goal to learn programming and about game engines, or is it to make a finished game?[/s][br][/br][br][/br]A bit of both. I do plan to build a finished game (actually multiple!) off of this, but much of the reason I'm making my own engine is indeed so I can become a better programmer.[br][/br][br][/br]With that said, if push comes to shove, I'm more than willing to use libraries if it means getting the engine done in a reasonable amount of time. I'm already using SDL and I'm most certainly going to use a JSON-parsing library for resources like level-layouts and save files, and a UTF-8 library for text.","name":"Anonymous","time":1741363296,"last_modified":1741363296,"board":"maho"},{"no":2716,"resto":2672,"com":"Quick update, a big thing I've learned working on this is the importance of documentation. I'm at the point where my code does too many things that are too complex for a quick read to suffice anymore, so I've taken to writing descriptions of everything using code comments.","opt":"sage","name":"Anonymous","time":1741655409,"last_modified":1741655409,"board":"maho","cites":[{"post":"2720","board":"maho","host":"2672"},{"post":"2721","board":"maho","host":"2672"}]},{"no":2720,"resto":2672,"com":"[c maho|2672|2716]\>\>\>/maho/2716[/c][br][/br]on topic sager","name":"Anonymous","time":1741692396,"last_modified":1741692396,"board":"maho"},{"no":2721,"resto":2672,"com":"[c maho|2672|2716]\>\>\>/maho/2716[/c][br][/br]Might as well take the time to create proper documentation, comments can only take you so far.","name":"Anonymous","time":1741714631,"last_modified":1741714631,"board":"maho"},{"no":4492,"resto":2672,"com":"[c maho|2672|2672]\>\>\>/maho/2672[/c][br][/br]game engine programming is a black art because there's no good way to do it imo. you got your OOP shit on one end and your DoD (data oriented design) shit on the other, and while the DoD paradigm is probably better for performance it's harder on your brain and requires fine-grained tuning.[br][/br][br][/br]i'm using C++ but i've avoided classes entirely excluding structs since theyre technically also considered classes in C++ because they can also. have member functions and constructors/destructors. i've also avoided using any containers with significant overhead like std::string in the initialization code and avoided containers entirely in the actual game loop excluding the stuff glm offers. the hardest part of the whole thing for me was figuring out how to share data without relying on global scope and/or global namespace to do so. at first i used a god struct on the stack holding all the engine state and hauled around a single reference to it. but the struct got 'too big' for my liking so i split it up into multiple smaller structs based on their functionality and namespaced everything accordingly, then defined them in the corresponding header files and declared them as extern. which required rewriting basically everything to be less coupled and really taught me some things about how vulkan works. i basically organized the whole thing according to 'systems' and each system gets its own compilation unit, with its own namespace, and its own extern struct within that namespace. as a matter of convention, i only access the struct via the namespace from within functions defined in the corresponding compilation unit. everywhere else i pass a reference. i had to invent my own little coding standard but i think the system is cleaner and maps onto the structure of the underlying api better.[br][/br][br][/br]the only problem with this approach i've yet to discover is that i can't actually 'free' stuff on the stack when i'm done with it. for example all the 'initialization' stuff that i don't need later on. so maybe i'll put some of those one-and-done structs on the stack so i can free them if i dont need them.","title":"1753477902681718.jpg","name":"Anonymous","time":1753905834,"last_modified":1753905834,"tn_h":175,"tn_w":175,"h":514,"w":514,"board":"maho","fsize":25899,"filename":"1753477902681718","ext":"jpg","file_id":"1753905833872","location":"haiji","md5":"0fbe8ada51875dcea09fe4965afe3e3c","cites":[{"post":"4493","board":"maho","host":"2672"},{"post":"4494","board":"maho","host":"2672"}]},{"no":4493,"resto":2672,"com":"[c maho|2672|4492]\>\>\>/maho/4492[/c][br][/br][s quote]\>maybe i'll put some of those one-and-done structs on the stack[/s][br][/br]meant to say heap","name":"Anonymous","time":1753906067,"last_modified":1753906067,"board":"maho"},{"no":4494,"resto":2672,"com":"[c maho|2672|4492]\>\>\>/maho/4492[/c][br][/br]I hope you and OP continue to do it![br][/br]Through observation as a non-programmer it seems like custom game engines have become a work of passion. So many companies are abandoning their in-house stuff to move to Unreal or even Unity. It seems like it's the death of an art, but something most people can't appreciate.","name":"Anonymous","time":1753915630,"last_modified":1753915630,"board":"maho","cites":[{"post":"4515","board":"maho","host":"2672"}]},{"no":4515,"resto":2672,"com":"[c maho|2672|4494]\>\>\>/maho/4494[/c][br][/br]I'm none of those anons but[br][/br][s quote]\>game engine programming is a black art because there's no good way to do it imo. you got your OOP shit on one end and your DoD (data oriented design) shit on the other, and while the DoD paradigm is probably better for performance it's harder on your brain and requires fine-grained tuning.[/s][br][/br]I still felt like I had to reinvent bicycles around both even when I had to work with Godot.[br][/br][br][/br]My overall impression is that garbage trash solutions that are only ever planned to be easily fixable later are the best solutions.","name":"Anonymous","time":1753950000,"last_modified":1753950000,"board":"maho"}],"similar_threads":[{"no":2876,"com":"Hello /maho/, do you like keyboards? They're your main method of interfacing with your computer and the Internet at large, most of you probably spend the majority of your day behind one, so let's talk about them![br][/br][br][/br]Here is a keyboard I picked up recently, it's a Focus FK-2001 made in the year 1995. This is around the start of the proliferation of cheap personal computers, which obviously necessitated cutting costs. Keyboards are a major area where manufacturers cut costs, and thus, the late 90s and the early 2000s saw a deluge of cheap, nasty rubber dome over membrane keyboards.[br][/br][br][/br]This one is still a mechanical keyboard, however, just not a very good one. It eschews the nice switches made by Alps Electric found in older keyboards in favor of cheap clones which don't feel or sound nearly as good. The case is light and creaky and is held together by clips which snap off easily. The dust cover is pretty cool though, and I do really like the look of the keyboard, particularly the keycaps, the Ctrl, Shift, and Alt legends are red, green, and blue respectively, which was supposed to help users of WordPerfect, I believe.[br][/br][br][/br]All in all, a pretty mediocre old board, I'll just be taking the keycaps and putting them on a custom keyboard build, and that's about it.","title":"Keyboards","tn_h":150,"tn_w":255,"board":"maho","ext":"jpg","file_id":"1744814819284"},{"no":3193,"com":"Reminder not to dox yourself![br][/br][br][/br]I wanted to show off my current working environment for my laptop. Which is mostly for writing so it's free of many of the usual distractions on my six monitor mult-monitor workstation set-up. The DE: LXQt is a lie by the way. The last release of firefox broke its GUI unless you fake having a DE installed through your .profile/.xsession.[br][/br][br][/br]This is probably my most comfy system at the moment. My own custom version of dwm that has terminal swallowing set-up. Driven mostly through keyboard although touchpad, trackpoint and touchscreen is fully working (but rarely used). Running latest OpenBSD snapshot. Most things compiled locally (kernel, packages, emacs). I primarily live in emacs and have a custom dashboard set-up when it first opens. Emacs running as daemon. A few things like weechat, newsboat, neomutt and firefox running on other tags so they don't distract me when working in emacs. A custom script I wrote to access youtube and pipe content into yt-dlp+mpv for viewing locally so I never have to visit the actual website. Following channels I like via RSS feeds and using my browser cookies so I can get content that requires log-in.[br][/br][br][/br]Everything kept really simple. Picom is only set-up for transparency and to prevent screen tearing no other fancy effects set-up. Hyperthreading disabled so no logical CPU cores being used (more secure). I do not miss it everything is as fast with it off as it is with it on. No wine/linux support though so no Steam on this machine which is a bonus for what it's intended for.[br][/br][br][/br]Will be replacing this set-up very soon with my own BSD-based kernel and user space tools I mostly wrote myself or adapted from other people's work. Arcan+Plan9 inspired. Hope to show it off soon. I have a total terminal emulator+shell replacement that solves many long standing issues. It can even embed videos right in the terminal, supports multiple jobs and has a real time clock. Integrates directly with the new window manager as well. I've posted about it before. Started as my own little Linux distro based on Gentoo and then I ported everything to FreeBSD. Now I've ported everything again to OpenBSD and started mixing and matching things from various BSD kernels. Replaced almost everything in userspace over the last few years on my dev machine. [br][/br][br][/br]Although all the usual stuff still works so I haven't lost access to those tools. But I'm replacing them to take advantage of my new GUI one-by-one. It will have full support for the few things I can't get in OpenBSD. Although a lot of the new kernel I'm working on has been imported from OpenBSD because of its amazing features that you can't get anywhere else. For example, my Firefox install can not access any files in my system outside of ~/Downloads and it has very limited access to system resources. If it attempts to do anything its not supposed to the kernel crashes it on purpose. [br][/br][br][/br]I've found a lot of misbehaving software thanks to those features over the years. Tons of stuff I wrote for Linux wouldn't compile and run at all on OpenBSD. So switching has been very helpful since I cleaned up a lot of C and shell scripts so now they're truly portable.[br][/br][br][/br]To the point where 303 installed packages feel 'bloated' but a lot of them are required for Linux-only stuff. Like the usual GNU tools and the GCC compiler. Most of the RAM being used is for Firefox in this screenshot. At boot and with the browser closed I barely consume 100MB of RAM.[br][/br][br][/br]If you haven't tried OpenBSD you really should! It's probably the best OS I've ever used and I've used them all. The only major downside is lack of support for legacy stuff from other platforms. Hence why I'm building my own kernel+user space. Which will have support for PC-98, DOS, Windows, Linux, OS/2 and other legacy software through VMs, emulation and translation layers. Since the entire point of the OS I'm building is multimedia support.[br][/br][br][/br]You can tell a lot about a person by how they've setup their desktop. So show me yours. Don't be ashamed of it. I'll try to come back later and show off some more of mine.","title":"The usual 'post your desktop' thread","tn_h":143,"tn_w":255,"board":"maho","ext":"png","file_id":"1745672386108"},{"no":3665,"com":"Right now AI is a mess of large language models each trying to out-everything the other as the ramp-up in operation costs seems infinite while the profits seem to remain at a net-loss even if revenue is increasing. Is there actually a viable future for any of these companies or will the hype around AI die off as the utopian promises remain unfulfilled and leave a burning pile of expensive rubble where all the data centers used to be? [br][/br][br][/br]The only thing I've seen some actual promise in have been the more singular focused LLMs trained on specific tasks like speeding up diagnosis and assistance in the health field. This along with other AI 'marvels' seem to still require trained human correction/review, but maybe at a smaller scale. Otherwise generative AI on its own doesn't seem to make much greater than acceptable output.[br][/br][br][/br]I guess the idea for companies right now is to take the usual cheap approach of bleeding money for a while until they can assert themselves in some way as a critical part of a workflow/lifestyle and then massively up the cost when people can't are too stuck with them to simply drop them. Otherwise they need to find some way to reduce costs by a lot.","title":"Practical usage of AI","tn_h":150,"tn_w":150,"board":"maho","ext":"gif","file_id":"1746374699149"},{"no":4704,"com":"What kind of controller(s) do the kissu gamers use on PC? I'm thinking I need to replace my Switch Pro controller because it's been very annoying lately. It's not recognized natively by Windows (relies on Steam emulation) so there's some stuff you can't play with it if you can't get the game to launch from Steam and have the controller recognized, which is happening more often lately. A shame, because I find it very comfortable.[br][/br]What controller do [b][e]you[/e][/b] use and are you happy with it? Also, man, these things are pretty expensive. I miss the days of $10 controllers.","title":"PC Game Controllers","tn_h":203,"tn_w":255,"board":"maho","ext":"png","file_id":"1755668704994"}],"reply_count":20}] ;window.page_no=0