Posts

Mashi - A compressor for JS/WASM 64k intros

 Sagacity writes at Pouet.net: <<Hi friends, I just released the first version of Mashi, which is a compressor for JS/WASM 64k intros. It is based on the core compression routines of Squishy by Ferris/Logicoma, which I'm sure most of you are familiar with. It is intended as a replacement for Compeko or JsExe or any other kind of tool that relies on the browser's built-in Deflate implementation. I built it primarily for use for compression of WASM (with a tiny amount of JS needed for browser interop) and for that reason it adds a full WASM context model that really improves compression of those kinds of binaries. The decompressor is hand-written in WASM so if you're interested to see what hell looks like, check out "decompress.wat" in the repo linked below. However, intros that are pure JS can also benefit, although in my unscientific testing the results varied. 0b5vr's 0mix intro went from 64k to 48k, but Luminosity by Bypass was almost u...

Thirteen, a C++ library for easy pixel pushing

 <<Thirteen is a header-only C++ library that initializes a DirectX 12 window and gives you a pointer to RGBA uint8 pixels to write to, which are copied to the screen every time you call Render(). It is inspired by the simplicity of the Mode 13h days where you initialized the graphics mode and then started writing pixels directly to the screen. Just include the header, initialize, and start drawing!>> https://github.com/Atrix256/Thirteen

Second Reality - JavaScript, C++ ports

A scener has ported the classic demo Second Reality by Future Crew to JavaScript so that you can  now run it directly in your bowser. He has also released the source code of this port. It can be found at: https://github.com/covalichou/second-reality-js/tree/main Besides, there's a C++ port of the demo:  https://www.jsr-productions.com/secondreality.html

JavaScript: How to serialize maps of maps of maps of ...

Recently I had to serialize a map in JavaScript. On the Internet I found code similar to this: /* json-map.js */ export const replacer = (key, value) => {   if(value instanceof Map) {     return {       dataType: 'Map',       value: Array.from(value.entries()),     };   } else {     return value;   } } export const reviver = (key, value) => {   if(typeof value === 'object' && value !== null) {     if (value.dataType === 'Map') {       return new Map(value.value);     }   }   return value; }   Now I had the problem that this works for maps of arrays, but not for maps of maps. I pondered over it for a while and then came up with a recursive solution that does not only work for maps of maps, but also for maps of maps of maps, maps of maps of maps of maps, and so on: /* json-map.js */ export const replacer = (key, value) => {   if(value inst...

Demos for Dummies

Gargaj wrote a tutorial for newbies who want to code demos. It shows how to make a simple demo in less than 400 lines of C++ code. Link: https://gargaj.github.io/demos-for-dummies/

Diskmag Engine in C# / WPF

The repo https://github.com/adokhugi/diskmagenginewpf contains a simple but good diskmag engine made with C# / WPF.

Volko Hull - An Alternative to Convex Hull

When you have a point cloud and want to obtain the shape, you can use the convex hull or the alpha shape algorithm. In the computational geometry library I am using in my projects, CGAL, these algorithms are built-in, but they have a disadvantage: the points are not output in the correct order. I first tried to solve this problem by implementing a convex hull algorithm myself that outputs the points in the correct order, but this did not always help since it ignored concave corners. Therefore I wrote my own algorithm to replace it. My algorithm divides the rectangular area of the given cluster into four triangles and computes the points belonging to the outer border of each triangle. Thus it also includes concave corners. Imagine this to be the rectangle: -------- |\    /| | \ A/ | | C\/  | |  /\D | | /B \ | |/    \| -------- If it is a square, we can assume that its sides have a length of 2a. The coordinates of the mid point are always (0, 0). Th...