22 ms·
Making a 3D modeler in C in a week
- dhooper 2y agoThanks for the share!
- netule 2y agoI agree entirely with the author on the limitations of Raylib. I'm currently working on a tower-defense style game that I started in Raylib, but I'm running into many of the same limitations (and more). Things such as toggling fullscreen not working consistently across platforms, not being able to enumerate screen modes, toggling rendering features at runtime, saving compiled shaders etc., etc. Having said that, I appreciate Ray's work on this library and will continue to sponsor him. Raylib is great for quickly banging out a prototype, but not much beyond that unless you're okay with living with severe limitations. Lesson learned, for sure, but I'm too far into the development to swap all of the Raylib stuff out for SDL (or something else) now.
- rwbt 2y agoRaylib is easy to get started but once the project gets a little complex it bites back. SDL on the other hand takes more time to setup everything but scales extremely well as the project gets bigger and bigger. Also, SDL is exceptionally well written code.
- visil 2y agoAnd an exceptionally well written documentation, too! One of the first big-ish projects of mine was a raytracer I wrote in C with SDL.
- throwaway2046 2y agoGot a link to that raytracer?
- z3phyr 2y agoIt would be like a regular raytracer, but instead of writing pixels to a file, you write them to your buffer/texture.
- sgt 2y agoThis made me want to look at raylib. It comes with some cute examples that run using WebAssembly: https://www.raylib.com/examples.html https://www.raylib.com/examples.html One thing that's always bothered me about Wasm and browser 3d/2d graphics is that I often find minor issues such as scrolling. Look at the example called "Background scrolling & parallax" here: https://www.raylib.com/examples.html https://www.raylib.com/examples.html I've tested on several devices and it's definitely not smooth scrolling, unless there's something wrong with my eyes. How can 2D smooth scrolling not be a solved problem in 2024?
- dekhn 2y agothe answer to your last question is "inner platform effect" and "second system effect".
- modeless 2y agoIn that sample the foreground scrolls perfectly smoothly for me, but the background looks jittery. This indicates to me that it's not a platform issue at all. That sample is just doing something weird with the background.
- sgt 2y agoYes, the background is odd but the foreground is definitely not smooth. I see small little jitters occasionally. At one point I had to wait 15 seconds for it to jitter, though.
- jay_kyburz 2y agoYes the back and foreground is quite jittery for me on Firefox, and I'm almost certain its the browsers own requestAnimationFrame that's the problem. Update: Although, having a closer look at the scene, I see its pixel art, so I bet the author is snapping floating point positions to a pixel point to prevent sub pixel blurring. Another small update: I was sure requestAnimationFrame was locked to 60fps, but I noticed on Chrome the other day it was 144hz, the full speed of my monitor.
- oersted 2y agoQuick appreciation for the detail that Raylib is named after the creator's name Ray and not ray-tracing, fun. Things Unexpectedly Named After People: https://notes.rolandcrosby.com/posts/unexpectedly-eponymous/ https://notes.rolandcrosby.com/posts/unexpectedly-eponymous/
- airstrike 2y agoSuch a good list.. worth a submission of its own IMHO
- WJW 2y agoI wish they'd add French drains.
- oersted 2y agoIt got good traction a couple times before, many more fun examples in the comments. https://news.ycombinator.com/item?id=39462516 https://news.ycombinator.com/item?id=39462516 https://news.ycombinator.com/item?id=23888725 https://news.ycombinator.com/item?id=23888725
- TrainedMonkey 2y agoHow do you know Ray was not named after ray-tracing?
- dymk 2y agoThe author's name is the first hint, and the lack of ray tracing the second
- pests 2y agoIIRC it defines some common words too like all the color names and uses a lot of names that should be prefixed. Good otherwise.
- diath 2y agoAt least they're all-caps, but as somebody that writes C++ and uses Raylib, I just wrapped it in a namespace in my project that I include, like so (note that cstdio must be included before raylib if you're using it from C++): #pragma once #include <cstdio> namespace raylib { #include <raylib.h> }
- vsuperpower2020 2y agoRaylib has a lot of issues that are never going to be fixed, but I wouldn't blame fullscreen on it. Fullscreen is just absolutely unusably FUBARed on windows and has been for decades. It's probably the same for other platforms. The modern strategy is to just do borderless windowed and pretend true fullscreen doesn't exist.
- netule 2y agoTrue, it’s just one of the many issues that came to mind while writing this. My solution to the issue is also full screen borderless combined with resolution scaling.
- spacechild1 2y ago> just do borderless windowed and pretend true fullscreen doesn't exist. Hah, good to know I am not the only one.
- keyle 2y agoI do the same, I do wonder however, if there are performance issue at the OS level, from running (on a 4K screen) 4K borderless vs. 4K fullscreen. Like, the whole giving the application maximum priority would work the same?
- Just_Harry 2y agoWhether there's a performance detriment from borderless-fullscreen vs exclusive-fullscreen depends on how a program presents its frames (and on the OS, of course). On Windows, under ideal circumstances borderless-fullscreen performs identically to exclusive-fullscreen as Windows will let the program skip the compositor and present its frames more-or-less directly to the display. (Under really ideal circumstances the same applies to bordered non-fullscreen windows.) If the compositor can't be skipped, borderless-fullscreen can be a bit brutal on performance: on a 4K 160Hz screen I've experienced an additional 40-milliseconds+ of frame-latency purely from borderless-fullscreen being used. The Special K wiki has some pages that go into more detail about the situation on Windows: https://wiki.special-k.info/SwapChain https://wiki.special-k.info/SwapChain, https://wiki.special-k.info/Presentation_Model https://wiki.special-k.info/Presentation_Model
- diath 2y agoKind of share the same feeling, started a project about 2 months ago and chose to use Raylib, and while the basic stuff is really simple to get going, the more you use it, the more random minor inconveniences you run into, but at this point I've invested too much into this project to back out of using Raylib. My biggest issue with it right now is the font handling and text rendering, I think I'll have to switch from TTF fonts to pre-baked bitmap fonts for it (which will suck for localization later). The biggest two features I'm missing after switching from Love2D is being able to render multi-color text (with Raylib, you have to manually split up the text into chunks based on color markup, then apply width offset, then call the draw function for each chunk, while also taking into account things like linebreaks and such), not to mention that it seems to tank the FPS a lot when you try to draw a lot of text on the screen (perhaps the draw call batching is broken for text?) and being able to easily chop up textures and make them wrap or tile, Raylib used to have tiled texture draw function in the past but for some reason they removed it.
- abnercoimbre 2y agoI'm the organizer for the conference [0] mentioned in TFA. We had a professional UI/UX designer react to ShapeUp [1], and one of the things she commented on was the font being hard to visually parse. I laughed a little when the author yelled "raylib!" to make sure blame was assigned appropriately XD. I'm currently the top GitHub sponsor for raylib, so there's no hate, but I wish he changed some of his defaults. [0] https://handmadecities.com/seattle https://handmadecities.com/seattle [1] https://vimeo.com/887532756/2972a82e55#t=49m58s https://vimeo.com/887532756/2972a82e55#t=49m58s (timestamped)
- edflsafoiewq 2y agoWhy did you switch from Love2D?
- diath 2y agoI need multithreading, async TCP, and have to implement systems that benefit from type safety. Though, I do still use Lua (using sol2), for interface modules, but I miss the features that Love2D provided on the framework level.
- nextaccountic 2y ago> I agree entirely with the author on the limitations of Raylib. Wow this is kind of insane. About this > Raylib doesn’t do basic parameter validation, by design. This function segfaults when dataSize is null: (...) The developer answered this > For most of the raylib functions is up to the user to validate the inputs, if raylib should consider all possible bad-use scenarios it would require reviewing most of the library functions and it will increase source-code complexity.
- kragen 2y agoin c and c++ this is not just normal but almost unavoidable. if your function takes a t* and someone casts a random int to a t* and pass it in, it is gonna segfault. no possible way to validate it, though in theory you could open /proc/self/maps and iterate through it to catch the segfault cases, or install a segfault handler
- lelanthran 2y ago> if your function takes a t* and someone casts a random int to a t* and pass it in, it is gonna segfault. True, that is not something a function ought to defend against. However, the complaint was not about that, though, it was about not checking if the dataSize parameter is NULL. I don't really have a problem with functions that segfault when given NULL pointer parameters as long as this is clearly documented! Sometime, however, you just need to be familiar with enough projects in C that common-sense gets built. In the specified example: unsigned char *LoadFileData(const char *fileName, int *dataSize); I expected that a function that returns an array needs to tell the caller how large that array is. This specific function is not one I would complain about. These things are usually documented in the headers. In this case it says: // Load file data as byte array (read) So, yeah, it's pretty clear to me that the number of bytes has to be returned somewhere, and there's only one parameter called `dataSize`, so this isn't something I consider to be a valid complaint. [EDIT: Escaped pointers, and added last paragraph]
- defrost 2y ago> unsigned char WARNING unpaired | unescaped *'s !! :-) grrr, markup
- deleted 2y ago[deleted]
- jakubtomsu 2y agoI switched from raylib to Sokol some time ago and it's the best. Super simple and single header C code, no dependencies, cross platform code and shaders, etc etc. I've shipped a steam game and I plan to continue using Sokol in the future.
- user432678 2y agoDo you mind sharing a link or game name? Despite all the advice out there picking up a game engine, I too am pursuing a goal of making a game from scratch using simple parts of C++ and SFML for now, but was also looking at SDL and Sokol. What was your experience? Are you a solo dev? Was it worth it?
- wilberton 2y agoNot the parent, but I also use sokol as the base for my engine. I've shipped 3 3d web games with it, and honestly it was the best technical decision I ever made! There's just so much to be said for owning all your dependencies (as far as possible, sokol is still a dependency but it's way more manageable than a 3rd party game engine)
- user432678 2y agoDo you mind to share your games details? No judging, I promise :) I just need examples from people like me and not AAA studios for motivation sake. I literally was called an idiot for not choosing Unity or Unreal, and was turned down for collaboration with non-tech people just for that. Game dev landscape is crazy these days.
- wilberton 2y agoIt totally depends on the type of game you want to make, whether using an existing engine or rolling your own is the best option. This is one of the games I've made with my engine: https://poki.com/en/g/super-tunnel-rush https://poki.com/en/g/super-tunnel-rush My one tip is only make enough of the engine to support the game you're writing, and write the game at the same time as the engine (don't think you need to finish the engine before you can start writing the game, that route doesn't work out well :)
- parasti 2y agoThere's something really powerful about taking the tools that you know very well and just making something cool with them. Really enjoyed this writeup, thanks.
- xixixao 2y agoSuper impresssive for getting this done in a week. Being able to make pretty demo models definitely helps too! :)
- sandwichukulele 2y agois the source code available? I looked through the blog post and linked videos but could not find a github repo or anything similar
- TruthWillHurt 2y agoOr just being able to save/load creations would be nice :)
- dhooper 2y agoyeah I never implemented saving/loading for the web. Thats one example of how raylib doesn't totally abstract the underlying platform for you.
- dhooper 2y agoI just made it public: https://github.com/danielchasehooper/ShapeUp-public https://github.com/danielchasehooper/ShapeUp-public
- SoKamil 2y ago> The Shapes are kept in a statically allocated array [...] Can’t fail to allocate, can’t be leaked, no fluff. Lovely. The 100 shape limit wasn’t limiting in practice. With very little time to optimize the renderer, the framerate would drop before you even got to 100 shapes. That's the best example of avoiding premature optimization I've seen in a while.
- Narishma 2y agoI think this is the opposite. It's avoiding premature abstraction/generalization.
- bruce343434 2y agoBut finding abstractions and generalizations optimizes scratching that itch inside our heads
- HumblyTossed 2y agoBest example of those who do vs. those who sit around bickering over HOW to do.
- ffitch 2y ago> The project is 2024 lines of C got to appreciate the effort to make the irony possible : )
- poopicus 2y agoAs someone who has difficulty in detecting irony, could you explain the irony in this statement?
- booleandilemma 2y ago2024 is the current year and it's the same as the number of lines of code. I don't think describing it as ironic is correct though.
- vsuperpower2020 2y agoThat certainly is gregarious!
- ngcc_hk 2y agoNever get that. Bad in literature. Thanks.
- roland35 2y agoIt's about ironic as rain on your wedding day.
- lelanthran 2y ago> It's about ironic as rain on your wedding day. Ah!!! It's the Alanis Morrisette meaning of irony, not the dictionary one!
- enumjorge 2y agoThe other response is correct that this is not ironic. Roughly speaking, irony is when something happens that is the opposite of what you'd expect. A firefighter's home burning down is ironic. Sometimes irony is related to unfortunate or funny coincidences/timing, and it's easy to confuse the two. Alanis's song Ironic famously has a lot of examples of this. Rain on your wedding day--is that ironic? Maybe? You certainly hope there is no rain on your wedding day, but I don't think there's an expectation that there won't be rain. Now if your parents decided to get a divorce on your wedding day, I think that's ironic. But the parent commenter dilutes the definition further. A project with 2024 lines of code in 2024 is just an amusing coincidence. There's no reason why you'd expect a project in 2024 to not have 2024 lines of code.
- runevault 2y agoSuper interesting post, and appreciate him talking about the various decisions like his handling of memory (and the issues he ran into with raylib). As someone who's finally diving into part 2 of crafting interpreters (and using it to refresh myself on C) being reminded of what C does well is great.
- fallingsquirrel 2y agoI really love the live demonstrations in the video. Forget building the app, I couldn't even produce that video in a week if I tried.
- dhooper 2y agoThe video took me longer to make than the app! I don't know how youtubers do it so regularly.
- an_aparallel 2y agoThey have a team :)
- movedx 2y agoNot all of us do. If you can get to an average of 300k+ view per video then you can hire an editor and maybe someone else on a contract basis to assist. Must of don't have a team though.
- djmips 2y agoYeah sometimes they eventually hire an editor but I think channels like Cutting Edge Engineering it's a fulltime job for one of the two people to do the filming and editing.
- emmanueloga_ 2y agoWhat is a stablished 3d modeler that uses the same kind of modeling as this one?
- deleted 2y ago[deleted]
- Lichtso 2y agoMany 3D content creation tools such as Blender [0] have SDF [1] (e.g. metaballs in Blender) and CSG [2] (e.g. boolean modifier in Blender) features. But these are rarely used as they can only define volumes, not surfaces. And we are usually interested in surfaces for assigning textures and materials. Thus, polygons / meshes and curves / splines dominate the industry. [0]: https://www.blender.org/ https://www.blender.org/ [1]: https://en.wikipedia.org/wiki/Signed_distance_function https://en.wikipedia.org/wiki/Signed_distance_function [2]: https://en.wikipedia.org/wiki/Constructive_solid_geometry https://en.wikipedia.org/wiki/Constructive_solid_geometry
- antirez 2y agoTinkerCAD.
- starmole 2y agoAdobe/Substance3D Modeler
- dantondwa 2y agoThe two best SDF modelers in existence are MagicaCSG[1] and Adobe Substance Modeler[2]. There are also a few others, like Womp, but those two are the most feature-complete. Blender is also adding them as part of geometry nodes, and there is also an add-on that is working on adding SDF for hard-surface. [1] https://ephtracy.github.io/index.html?page=magicacsg https://ephtracy.github.io/index.html?page=magicacsg & https://www.patreon.com/magicavoxel https://www.patreon.com/magicavoxel [2] https://www.adobe.com/products/substance3d/apps/modeler.html https://www.adobe.com/products/substance3d/apps/modeler.html
- joeld42 2y agoBlender Geometry nodes supports SDF modelling. It's just not a widely known or used technique. But it's super powerful.
- swiftcoder 2y agoThat's some impressive development speed. Really enjoyed the explainer video too!
- RamiAwar 2y agoAmazing write up, thanks! Really enjoyed it, miss working on C/C++ apps from scratch and having full control
- jasonjmcghee 2y agoThis looks like such a fun jam - wish I'd have known about it! When's the next one?
- bvisness 2y agoThe next Wheel Reinvention Jam will be in September! We're just finalizing our plans for that jam and our smaller Visibility Jam in July. If you're interested in participating, then join the Handmade Network Discord server (link on our home page at https://handmade.network/ https://handmade.network/).
- antirez 2y agoI hope somebody will continue this project. It's a few months away to be a serious alternative to Blender / FreeCAD for certain use cases, with a much softer learning curve.
- turtledragonfly 2y agoEDIT aha, the program already supports exporting to a mesh via marching cubes; see the youtube video on the site. I hadn't realized that (: ---- Be aware that since it fundamentally works with SDFs, it is a somewhat different modeling experience (and stores different data) than traditional meshes with triangles, verts, etc. Transforming it from SDFs into meshes could be done with marching cubes or similar, but you'd likely need to "clean up" such data afterwards in a Blender-style app anyway. SDFs are great though, if your renderer is SDF-based, too (most are not). [sorry if you knew this already, wasn't sure]
- antirez 2y agoYep the export is already done! I used TinkerCAD a ton for things ways more complex than it should be used to, so even when I use more advanced CADs at this point I tend to think in SDF terms. For many things it's faster and more natural than extruding, rotating, ... But the fact is, the engine behind TinkerCAD is quite good, but there is little interest for AutoDesk to compete with its own Fusion360, so TinkerCAD is left forever as a children / beginners tool, without the more advanced stuff that could implement.
- johnnyanmac 2y ago>SDFs are great though, if your renderer is SDF-based, too (most are not). Thanks for reminding me that one of the best SDF renderers in the industry is stuck behind Sony, deemed a failure because Sony didn't want to publish it to PC (where all the dev scene is).
- adastra22 2y agoBlender maybe, but not CAD work unfortunately.
- rationalfaith 2y agoGood stuff! As a c/c++ coder maintaining his game engine (for commercial and hobby purposes), this is always good to see!
- freecodyx 2y agoI sometimes think, that c is all we need
- yazzku 2y agoI write C all day and enjoy every second of it. I assume there are many like myself. There's just nothing new to make noise about, and that's a good thing, other than small quality-of-life improvements in the standard.
- lionkor 2y agoyou dont need that comma fyi While I fully support liking one language, it wouldnt feel right for me to not mention the benefits other languages bring, such as GC for large dev teams of lower skilled devs, languages with builtin unit tests, languages with templating or less bad macros, etc.
- ngcc_hk 2y agoReally agreed with his assertion of c. More to his “ Its syntax doesn’t hide complex operations. It’s simple enough that I don’t have to constantly look things up”, and further if you need to look up something about c, it is very easy and very informative. Simple and old lang has its benefits.
- syphiant 2y agoImpossible! Wow! This is absolutely mind blowing.
- ederamen 2y agoJust started using Raylib, bummed to hear about the limitations! As a novice C programmer, the simplicity and immediacy of results opened my eyes to how C can feel as productive as higher level languages with robust standard libs.
- lelanthran 2y ago> As a novice C programmer, the simplicity and immediacy of results opened my eyes to how C can feel as productive as higher level languages with robust standard libs. TBH, once you have halfway-good libraries for dealing with `char *` strings as-is, dynamic arrays and hashmaps, you are not going to be much slowed-down using C than using a higher-level language. You even get much stronger isolation guarantees than most other high-level languages, while getting much more compatibility[1] with any other language you may wish to interface to: https://www.lelanthran.com/chap9/content.html https://www.lelanthran.com/chap9/content.html [1] I did a little Go project, and it annoyed me slightly when I wanted to do performant FFI. For Go, I think the situation has improved since I last checked, though.
- neonsunset 2y agoYou can trivially replace Go with C# in order to get almost zero-cost FFI (you can make it fully zero-cost with additional effort but even the baseline is better than the alternatives, hell you can statically link other .lib/.a's into AOT compiled .NET binaries).
- naasking 2y ago> TBH, once you have halfway-good libraries for dealing with `char *` strings as-is, dynamic arrays and hashmaps, you are not going to be much slowed-down using C than using a higher-level language. That can't possibly be true. Not having to even think about object lifecycles and ownership because all memory is GC'd saves a lot of time all by itself, not even getting into debugging issues when you get it wrong.
- jesse__ 2y agoIt's definitely true. Memory allocation takes a very small percentage of my time. I'd guess < 1%. Debugging memory issues used to take me more time, but these days it's basically inconsequential, too. Having written interpreted languages previously to jumping to C & C++ (>10y programming exp), there's a massive cost to using interpreted and/or GCd languages that comments like this one never seem to acknowledge. Random package bit-rot, high-difficulty memory leaks, high-difficulty AND high consequence manual memory management (to avoid the GC), poor performance tooling, nearly completely opaque performance characteristics, inability to optimize performance past a surface level... etc. If you're building anything more complex than simple web apps, this shit all adds up to a lot. I've worked at a couple shops that these issues hit like a ton of bricks.
- jimmychu 2y ago[flagged]
- Jach 2y agoReally cool and the video was great too. Indie devs should probably consider doing this sort of thing more often, building these simple tools in service of a game rather than just using the industry standard tool. It can be a great way to add artistic character as well as rigorously enforce some limitations if that's what you're after.
- koushik 2y agoThis looks cool, after 3 years in financial technology industry working on c/c++ projects I’m in process of revisiting textbooks and relearning computer science fundamentals! Added raylib to my ‘explore’ list I love this idea of reinventing wheel with such explicit goal (even if it sounds counterintuitive to some), we can rethink initial assumptions, best case scenario we come out with better implementations and paradigms than existing standards, worst case scenario you learn internals of tools and techniques you use daily!
- gorkermann 2y agoTo get a look at SDF rendering in a game, check out the blue clouds on the ground in Solar Ash: https://youtu.be/HqQpYSQDIZQ?si=vMKplmGJIGvUn_LT https://youtu.be/HqQpYSQDIZQ?si=vMKplmGJIGvUn_LT
- drtgh 2y agoOff-Topic: Glad to see for the first time a WebAssembly interface where the text does not look blurry. I repeat, it is the first time. Extending this to programs and some operating systems (such as Windows), in the past few years, there has been a pervasive issue with the text rasterization methods that have become a common trend and default setting. Unfortunately, users often do not have the option of turning off anti-aliasing to get sharp text, and in the rare cases where this option is available, the interface (menus, etc.) still uses anti-aliasing.
- themerone 2y agoThe crisp text is unimpressive. The typeface has no curves and there is no smoothing. That text will be crisp and blocky at any resolution.
- drtgh 2y agoThe crisp text maybe it is unimpressive in the sense that is being used an graphic library targeted to games, so is using an homologous to pixel fonts. But it is not the norm. I'm simply increasing awareness among the development community about the problems with text rasterization in applications and OS interfaces. I'm glad not to see blurry text.
- flohofwoe 2y ago> The crisp text is unimpressive. Not if you actually tried to achieve that in practice across all browsers and display configurations ;) For instance Safari had for the longest time a hardwired (e.g. not fixable via CSS) linear filter applied when a WebGL canvas had to be upscaled. It's only been fixed last year or so. Also unfiltered upscaling done breaks down when fractional scaling outside the browser happens, the result will generally look horrible and there is no good way to fix it. The only workaround is to make hide the scaling artifacts behind a filter, which then makes everything look blurry. Browsers running on top of Wayland most likely still have all those issues.
- TachyonicBytes 2y agoWhy is there a link between WebAssembly and rasterization? Genuinely curious, it seems interesting
- kewp 2y agoI wish he had tried instead to do the faster subset of typescript, that is a pet peeve of mine and I've love to see how it would be done!
- cnity 2y agoAssemblyScript?
- rkagerer 2y agoYou could certainly make it harder on yourself by malloc-ing each Shape individually and storing those pointers in a dynamic array. Using a language like C# ... would force that allocation structure. What's stopping you from using a fixed array of structs in C#, just as the author has done in C?
- kronovecta 2y agoNothing. In C# it's not unusual to use struct arrays in this way.
- OskarS 2y agoProbably confusing it with Java, where the only value types are the basic ones (unless you store each individual coord in a different array).
- icoder 2y agoStill you could in Java avoid the (under the hood) memory allocation and garbage collection by reusing the same objects. If you wanted to, of course, it probably takes a bit more effort / caution at the developer's side but may provide some improvements in performance in very specific cases/situations.
- OskarS 2y agoThe primary concern with this isn't necessarily the extra allocation and GC (though that plays a part too), it's the fact that you're chasing a pointer for every object. That's murder for the cache. MUCH faster to just have the data in-line in hot loops like this.
- pjmlp 2y agoIf Valhala ever lands, you will be able to do as in C#, D,... Until then, the best way currently, is to make use of Panama to create a C struct like memory layout, and have accessor methods for the low level details.
- neonsunset 2y ago"Using a language like C#, Javascript, or Python would force that allocation structure." No. C# structs are C structs. Shape[], Span<Shape> or Shape* would not be an array of pointers. Any of the following would work: var fromHeap = new Shape[100]; var fromStack = (stackalloc Shape[100]); var fromPool = ArrayPool<Shape>.Shared.Rent(100); var fromMalloc = (Shape*)NativeMemory.Alloc(sizeof(Shape) * 100);
- npigrounet 2y ago[dead]
- kuon 2y agoI really like this kind of projects. I still like the low level of C. Now I work with rust a lot and elixir/erlang but I often miss the simplicity and explicitness of C. For this, I use zig a lot too. It is a very nice improvement over C while keeping a lot of its philosophy.
- nesarkvechnep 2y agoErlang is a pretty simple language too.
- anthk 2y agoCan I compile it with GNUStep?
- naasking 2y agoNice, I was considering a project like this myself. Signed distance fields are awesome. Everyone into modelling should check out ImplicitCAD based on SDFs.
- JabavuAdams 2y agoThis is really great! Nice work, and thanks for sharing.
- _ddbw 2y agogetting tired of the underhanded shilling for c and procedural style programming. the people doing this still pretend they are the underdogs but their point of view is over saturated.
- TacticalCoder 2y agoI don't know why you got that feeling, TFA says this: > Some view C as a language so simple and raw that you’ll spend all your time working around the language’s lack of built in data structures, and fixing pointer bugs. The truth is that C’s simplicity is a strength. It compiles quickly. Its syntax doesn’t hide complex operations. It’s simple enough that I don’t have to constantly look things up. And I can easily compile it to both native and web assembly. While C has its share of quirks, I avoid them by habits developed over 22 years of use. Which is nothing unreasonable. I code mostly in a Lisp dialect but I don't take offense at, say, the Linux kernel being mostly C.
- gromneer 2y agoi am not assessing the truthfulness, the reasonableness, the correctness, or the veracity of the claims made in the article in any way. i simply do not care because the claims are purely subjective, untestable, unmeasurable. it is an opinion piece and one that is dulled out ad nauseam in the programming world today. enough to be annoying now. one opinion for another.
- deleted 2y ago[deleted]
- layer8 2y agoI’m getting tired of people not using the Shift key.
- CamperBob2 2y agoOther sites beckon.
- ttul 2y agoLong ago, I worked on the operating system for a desk phone. With only 64K of RAM, there was no dynamic memory management whatsoever. We made heavy use of static variables and let the compiler figure out how to allocate everything at compile time. It’s easy to forget that many applications probably don’t need dynamic memory management at all. You can often get away with allocating a few fixed size buffers and just handling the edge cases nicely when those buffers are full. And in such a context, C is indeed a whole lot safer. No memory leaks. Your only concern is buffer overflows, which can be managed through careful use of sizeof when all of your variables are statically allocated. I’m not saying Rust and Go aren’t great options these days, but humble old C still works and doesn’t have to be nightmarishly complex.