flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > [fasm2] GDI/OGL Creatures (@yuruyurau)

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4592
Location: vpcmpistri
bitRAKE 26 Aug 2026, 01:37
Not sure what else to call them: squid? It's best to look at the original tweet - because the author is so talented and they look best animated. Or just build the small executable below.

The rendering fakes the alpha blending with an exposure palette -- makes the whole program very simple. It's just a WS_POPUP and a BitBlt of a top-down 8-bpp DIBSection.

ESC to exit, left-click to move window.

---

I've not played with other color palettes or optimized the render algorithm.


Description: Animated squids.
Download
Filename: creature.zip
Filesize: 4.71 KB
Downloaded: 46 Time(s)



Last edited by bitRAKE on 29 Aug 2026, 13:04; edited 2 times in total
Post 26 Aug 2026, 01:37
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4592
Location: vpcmpistri
bitRAKE 26 Aug 2026, 04:22
The obvious questions are: What is this math doing? How are the squids created/animated?

Here is one way to look at it expanded out:
Code:
function a(m) { // squid
    // local coordinate pair and distance between:
    k = 9*cos(5*i)*sin(i)
    e = 9*cos(3*i)*cos(2*i)
    r = mag(k,e)

    // density modulation, local structure, animation:
    d = r**3/1999 + 1.5 - sin(t/2 + m)**3/3
    c = d/16 - t/48 + m
    p = d ** sin(d*d - t + m)

    // structure mapping: center + Lissajous-style curve + squid
    x = 200 + 99*sin(c)   + k*p
    y = 200 + 99*sin(4*c) + e*p
     point(x,y)
}

t = 0
function draw() {
    if (!t) createCanvas(400,400)
    background(9)
    stroke(400,96)
    t += PI/20 // time
    for (i=10000; i--;) a((i%16)*13)
}    
... there are 16 squids render on a Lissajous-style curve of ratio 1:4 using a density field of 10k partially transparent points.
Post 26 Aug 2026, 04:22
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1473
Location: Piraeus, Greece
Picnic 26 Aug 2026, 17:41
The executable worked like a charm on Windows 11. Mesmerizing!
But looking at that expanded code... my brain refuses to parse the math.
The mystery of how these squids are born remains unsolved Smile
Great job bitRAKE!

_________________
Hobby BASIC Interpreter
Post 26 Aug 2026, 17:41
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4592
Location: vpcmpistri
bitRAKE 26 Aug 2026, 21:59
Thank you. TBH, the high-level concepts are clear to me, but there is much subtlety the original author has developed over years - they model realistic 3D jellyfish and have studied the dynamic in depth.

Some things to note:

Periodicity is baked into the construction - all the time variable are within sine functions.

There is no randomness. It's all curve management.

Any of the tweets from the last year or so should be adaptable to the renderer.

It should work on WinXP, iirc.


Last edited by bitRAKE on 03 Sep 2026, 12:31; edited 1 time in total
Post 26 Aug 2026, 21:59
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1473
Location: Piraeus, Greece
Picnic 27 Aug 2026, 04:39
No randomness, no mercy for my CPU cycles apparently.
Bookmarking this as required reading before I attempt anything with trig.
Post 27 Aug 2026, 04:39
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4592
Location: vpcmpistri
bitRAKE 27 Aug 2026, 09:00
One of the nice things about a density field of points is that it's completely parallelizable! I've intentionally not provided SIMD or shader code, but that would make the generation trivial - even for a full screen app.

The below update has five different generators. The first one has been configured for a better presentation, imho. If I have time I might configure the others.


Description: Five different generators.
Download
Filename: creature.7z
Filesize: 6.78 KB
Downloaded: 31 Time(s)

Post 27 Aug 2026, 09:00
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 2120
Roman 27 Aug 2026, 10:30
Good if you post render image here.
Post 27 Aug 2026, 10:30
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4592
Location: vpcmpistri
bitRAKE 27 Aug 2026, 11:33
Images don't really reflect the pulsating animation well -- requires a lot of imagination. The saving grace is that we do see many states in this generator - the other generators are radically different in form - a single creature.


Description:
Filesize: 33.32 KB
Viewed: 573 Time(s)

Screenshot 2026-08-27 052956.png



_________________
¯\(°_o)/¯ AI may [not] have aided with the above reply.
Post 27 Aug 2026, 11:33
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 2120
Roman 27 Aug 2026, 12:43
Nice for magic spells in games.
Post 27 Aug 2026, 12:43
View user's profile Send private message Reply with quote
yy



Joined: 28 Aug 2026
Posts: 9
yy 28 Aug 2026, 05:03
bitRAKE wrote:
It's best to look at the original tweet


The author also has another one for fish:

https://x.com/yuruyurau/status/2091191600814907612


Description:
Filesize: 287.27 KB
Viewed: 411 Time(s)

Screenshot_20260829_134034_X.jpg


Post 28 Aug 2026, 05:03
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4592
Location: vpcmpistri
bitRAKE 29 Aug 2026, 07:48
My prior implementations have a fundamental error: the use of p5 is doing a source-over blend -- not additive. This means sampling was very inefficient despite the implementation simplicity.

The following OpenGL application faithfully reproduces 108 generators from @yuruyurau. Don't take my word for it -- double-click can redirect to the exact post of the author. Of course, the application lacks mpeg compression artifacts.

Furthermore, generators can be edited while viewing - just press "R" to reload. So, if you want to create a new generator in a similar style just copy to a similar file name (see 0000000000000000001.glsl).

(Note: use the left-arrow button to see recent work - right-arrow is oldest first.)

Edit: improved frame timing - should be zero jitter - very smooth, always.


Description: Build with basic fasm2.
Download
Filename: POST.faithful.7z
Filesize: 33.76 KB
Downloaded: 24 Time(s)



Last edited by bitRAKE on 31 Aug 2026, 01:18; edited 1 time in total
Post 29 Aug 2026, 07:48
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4592
Location: vpcmpistri
bitRAKE 30 Aug 2026, 23:49
This update adds a tiered live gallery: backspace change from the primary focus mode to gallery mode (2x2, 4x4, 8x8) -- push backspace again to move to smaller thumbnails. The ESC key will increase thumbnail size or move back to focus mode.

Very little increase in resource usage. Home/End/PgUp/PgDn or mouse wheel quickly navigates the live gallery. Clicking on any generator switches to focus mode.

There was a major code refactor which happened prior to adding the gallery. The DEBUG split was getting messy and fractured.

Two main features to add:
1. More presentation schemes will enable broader generator support.
2. Library families. Not just @yuruyurau's work, but other collections.

Probably dropping the window decoration to be the initial POPUP - no one needs the window title and buttons.


Description: Add to above application.
Download
Filename: gallery_update.zip
Filesize: 22.33 KB
Downloaded: 20 Time(s)

Post 30 Aug 2026, 23:49
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.