5 ms·
This "minimum viable program" stuff is great! Michal Strehovský used the framework currently known as .NET (as opposed to the Framework formerly known as .NET
by password4321 3y ago
This "minimum viable program" stuff is great!
Michal Strehovský used the framework currently known as .NET (as opposed to the Framework formerly known as .NET per OP) to create a snake game in under 8KB with no .NET [nor .NET Framework] runtime dependency. (Medium sucks and Twitter isn't useful right now, but I believe ~"hello world" supported Windows 3.11.)
https://medium.com/@MStrehovsky/building-a-self-contained-game-in-c-under-8-kilobytes-74c3cf60ea04 https://medium.com/@MStrehovsky/building-a-self-contained-ga... [https://web.archive.org/web/20200103110836/https://medium.com/@MStrehovsky/building-a-self-contained-game-in-c-under-8-kilobytes-74c3cf60ea04 https://web.archive.org/web/20200103110836/https://medium.co... | https://archive.ph/b6qXE https://archive.ph/b6qXE]
https://news.ycombinator.com/item?id=22010159 https://news.ycombinator.com/item?id=22010159 (2020)
https://news.ycombinator.com/item?id=22104734 https://news.ycombinator.com/item?id=22104734
You can see the latest work (and sponsorship!) at https://flattened.net https://flattened.net: "bflat - C# as you know it but with Go-inspired tooling".
- andai 3y ago>Can C# apps hit the sizes where users would consider the download times instant? Would it enable C# to be used in places where it isn’t used right now? I wonder if this could be used to make C# webassembly more viable. If I remember, a significant part of the download size is the .NET libraries (themselves written in C#?) On that note, is there any 2D game framework/engine that targets the browser that uses C# and produces small binaries?
- ramesh31 3y ago>I wonder if this could be used to make C# webassembly more viable. If I remember, a significant part of the download size is the .NET libraries (themselves written in C#?) Until WASM ships GC, you're stuck with having to download an entire runtime regardless. >On that note, is there any 2D game framework/engine that targets the browser that uses C# and produces small binaries? Godot supports C# scripting and WASM compilation, probably your best bet.
- andai 3y agoYeah, I was wondering if the techniques described in these articles could reduce the size of the .NET libs in the wasm bundle. (I'm not sure what language the runtime itself is implemented in, I think also mostly C# for (formerly known as) .NET Core?) Thanks for the Godot tip. I haven't checked it out in a while. I found it very counterintuitive (and a 3D engine is definitely overkill for small 2D games... I basically just want Flash... I guess Phaser or Haxe are my best bets).
- sedatesteak 3y agoGodot was originally 2d (only?). At any rate the 2d portion is much more mature than the 3d.
- ComputerGuru 3y ago> I wonder if this could be used to make C# webassembly more viable. You might enjoy reading this GitHub thread [0] where the community contributed a WASM library wrapping the C# regex code so that regex101.com could have a "C# mode". Lots of nerd sniping about reducing the payload size. (There's also another thread [1] discussing the minification of a rust version of that same regex101 wasm library to provide a "rust mode" using @burntsushi's regex crate.) [0]: https://github.com/firasdib/Regex101/issues/156 https://github.com/firasdib/Regex101/issues/156 [1]: https://github.com/firasdib/Regex101/issues/1208 https://github.com/firasdib/Regex101/issues/1208
- Aeolun 3y agoI think godot exports to web, but I’m not sure if you’d consider it small binaries.
- DannyWebbie 3y agoUnity can hit below 3MB[0]. Afaik Godot builds are a bit larger due to limited code stripping and builds not being compressed out of the box. [0] https://github.com/JohannesDeml/UnityWebGL-LoadingTest https://github.com/JohannesDeml/UnityWebGL-LoadingTest
- dgellow 3y agoTo continue on the “Go-inspired” C#, .Net has System.Threading.Channels! https://learn.microsoft.com/en-us/dotnet/core/extensions/channels https://learn.microsoft.com/en-us/dotnet/core/extensions/cha...
- FroshKiller 3y agoI love channels in .NET. I use them in our .NET web services to pass work items from controllers to background services without having to directly couple the controller & background service classes.
- peheje 3y agoHow do you do this? Does the controller then not know what the receiver is or wants in any way? Surely the controller needs to put something on the channel in the correct format?
- pjc50 3y agoThe channels are typed: https://learn.microsoft.com/en-us/dotnet/api/system.threading.channels.channel-2.writer?view=net-7.0 https://learn.microsoft.com/en-us/dotnet/api/system.threadin...
- FroshKiller 3y agoYes, the controller consumes an instance of ChannelWriter<T> where T is a job type, and the service consumes an instance of ChannelReader<T>. With basic dependency injection, this means you have to set up & register different channels with different types if you need to coordinate with multiple services, but I think that's a small price to pay. Having a job class with a type parameter for its encapsulated workload saves you from having to actually write different job classes, at least. It's trivial to write a generic extension method that takes the encapsulated type as a parameter, sets up the channel with your preferred options, and registers the reader & writer for DI. Then you have a one-liner for adding this kind of channel support to your projects.
- WhereIsTheTruth 3y agoMichal and the whole CoreRT team saved C# to me, without NativeAOT today, I'd never ever consider using C#, specially when Go exist