Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Simon

Pages: [1] 2 3 ... 249
General Discussion / Re: Simon blogs
« on: January 28, 2023, 06:56:07 AM »
Templates in C++

Nice talks on Youtube:

CppCon 2016: Template Normal Programming, part 1/2
CppCon 2016: Template Normal Programming, part 2/2

By Arthur O'Dwyer. A thorough explanation of C++17 templates and their language rules. The examples are straightforward, and it avoids metaprogramming examples wherever possible to keep it accessible, hence the title "Template Normal Programming".

CppCon 2014: Modern Template Metaprogramming: A Compendium, part 1/2
CppCon 2014: Modern Template Metaprogramming: A Compendium, part 2/2

By Walter E. Brown. Many short examples of type manipulation. You'll see the implementation and ideas behind standard library utilities such as  std::is_same<T, U> or std::remove_const<T>. Introduction to SFINAE.


I should revisit one of my toy C++ examples: How nice of a functor can you create, e.g., with C++ template magic, to minimize boilerplate in the usercode. Here, I mean functor in the sense of category theory, not necessarily in the sense of object that overloads operator().

The use case is: You have
struct ErrorOr<T> { int error; T value };
... with the unenforced rule that we should use its good value if and only if the error is 0. You have a function func: T -> U. The goal is to lift func into the world of ErrorOr: The lifted function is of type ErrorOr<T> -> ErrorOr<U> and calls func when a good T comes, and merely copies the error code when an error code comes.

The solutions will likely not be beginner-friendly, and I'm sure that other people have already found solutions that make the usercode calls look reasonably straightforward. Nonetheless, I'll keep it in mind as an exercise for myself.

-- Simon

Lix Levels / Re: Simon streamed lemforum/Hopeless, 2023-01-22
« on: January 27, 2023, 10:14:41 PM »
Thanks for the feedback! Yes, that spoiler said exactly what I figured it would probably say.

Next Hopeless stream will be in a few weeks. I'll be busy this weekend. Next week, geoo will visit me for a few days, and there is already a multiplayer session.

-- Simon

There is wisdom in this list beyond defining what is L1-like.

Most good levels don't need the player-assist tools. Yet the player-assist tools are always there to have your back, to encourage exploration with minimal pain. It's reasonable to think of overly sharp pausing as player assistance.

-- Simon

Sent PM to weirdybeardy with the Mumble server info. It's optional to join voicechat.

Thanks for your interest! Yes, we're always happy to have new players. When it's time to play, select Network Game in the Lix main menu, then connect to the central server.

-- Simon

I'll play! Thanks for organizing.

geoo will visit me that weekend. Most likely, both geoo and I will play. I'll let you know in case something prevents either of us from joining.

-- Simon

Padding in a struct of only floats: When I read the C11 standard on structs, it looks like it allows padding between any two members, and at the end, but not at the beginning. Nonetheless, in practice, the floats will be packed without any padding, like an array of 4 floats.

Yesterday, I've written a custom version of al_convert_mask_to_alpha and asked the Mac users in the github issue to try that. I'll see if anything comes up.

In Allgero's IRC channel, nobody can tell for sure if −0 is a valid color component within 0 and 1. I'd like to see what comes back from the Mac testing before I possibly open a pull request to change the memcmp to four ==.

-- Simon

Digging around the cutting edge A5 source of al_convert_mask_to_alpha: This function is OS-independent, and it is, like my handwritten Lix recoloring, a high-level pixel-by-pixel loop.

One possible method of attack: Investigate how C memcmp can fail to recognize two pixel structs as identical even though both are pink. A5 color structs contain 4 floats without padding:

   float r, g, b, a;

Now, for IEEE floats, the C language considers +0 == −0 when we compare them with ==, but memcmp(+0, −0) will not consider them equal. (Perhaps even +1 won't memcmp-equal some other representation of +1, but I doubt it.) Then memcmp will fail. I'll ask on A5 what they think about memcmp here. Comparing floats with equality is a can of worms in general, I have no good immediate fix to offer.

I don't want to scare away other Mac users with technicialities. Who has a Mac? :lix-grin:

-- Simon

Thanks for the offer! Right, let's see if others have a more recent Mac.

I've looked at the source, and it looks like I call the al_init_* before creating color constants and before creating the A5 display. The calls are in src/basics/init.d: al_init_image_addon(); al_init_font_addon(); al_init_ttf_addon(); al_init_primitives_addon();

The bug report suggests wrong colorings after al_convert_mask_to_alpha that also gets called after the al_init_*; it looks like that function failed to recognize the magic pink in the images. I have further recoloring with handwritten pixel-by-pixel code with al_get_pixel, al_put_pixel, e.g., to replace the greyscale GUI icons with the GUI hues based on user's options. Those handwritten recolorings (in src/graphic/recol.d, here be dragons) also appear to fail. The screenshots on github have grey icons on the GUI buttons, not pale blue icons.

I'm not 100 % sure with the ordering of the various calls other than that the al_init_* are called early. Reducing Lix or having minimal A5 examples still looks helpful.

-- Simon

Lix Main / Re: Lix 0.10.5 released
« on: January 24, 2023, 02:06:13 AM »
Lix 0.10.5 released.

:lix-cool: Download for Windows 64-bit -- recommended
:lix: Download for Windows 32-bit -- fallback for ancient machines
:lix: Download for Linux 64-bit
:lix-evil: Source code
:8(): Changelog
:8:()[: Issue tracker

How to update (click to show/hide)
  • The replay tweaker shows little skill icons instead of the first three letters of the assigned skill. This also allowed the tweaker to become narrower.
  • Fix #445: Whenever you assign one of the following skills with or without directional force, the replay will always record a directionally forced assignment: Walker, jumper, batter, builder, platformer, basher, miner. Holding directional force for these skills is now merely a filter while you hover over multiple lix. As before, unless you hold directional force, the replay will record unforced assignments of: Permanent abilities, imploder, exploder, blocker, digger.
  • Right-clicking now takes you back to the level browser from the end-of-singleplayer screen or from the find-replay-for-level screen.
  • Fix #390: Redraw matt/underworld/Lava.W.png: The lava's top is now a wobbling surface, not a straight line. Physics remain identical.
  • Lemforum prettiness: Tower of Babel: Corrected lighting on top blocks. Added lower layer to central bridge to avoid bridge looking cut off. Can't Reach It, Under the Rainbow, The Ring of Fnargl: Add/move stacked lava because of the above change to matt/underworld/Lava.W.png.
  • Removed the spare platformer in One-Way Road to make it easier for Lovely.
  • Lemforum backroute fixes: Division of Labor: Add extra steel block in the central wall, add little triangle at the top of the diagonal shaft. Chasm: Add steel in the center. Theresa Falls Up the Stairs: Add second hatch. Wait Why is There a Tree: Add a third notch to the top half of the pillar. The Last Laugh: Surround the right-hand exit with steel to force solutions that use the left-hand exit.

-- Simon

Lix Levels / Re: Lemforum backroute fixes, Lix 0.10.x
« on: January 24, 2023, 01:49:10 AM »
Thanks, earmarked Divison of Labor and The Last Laugh for 0.10.5. Indeed, everything is covered with existing replays.

-- Simon

Lix Levels / Re: Lemforum backroute fixes, Lix 0.10.x
« on: January 22, 2023, 10:20:13 PM »
For 0.10.5, I propose this backroute fix for Division of Labor. It's a single triangle added in the background, see screenshot.

This prevents a lucky right-facing basher from cancelling directly before the basher reaches the diagonal shaft. Now, the basher will see enough pixels that the basher decides to continue. The diagonal shaft will still open from bashing and then kill left-facing walkers.

Edit: Earmarking this fix for 0.10.5. I didn't get feedback, but it seems sensible to me. The terrain looks nice and the fix prevents my backroute. If you don't want it, let me know, and I'll remove it in 0.10.6 or beyond.

-- Simon

Lix Levels / Re: Simon streamed lemforum/Hopeless, 2023-01-22
« on: January 22, 2023, 10:12:46 PM »
I streamed for 2 hours today and didn't announce it beforehand because I merely wanted to experiment with backroute-fixing Division of Labor.

In the end, I solved 3 levels: Division of Labor (with my proposed backroute fix, a little triangle), One Step Off, We're in This One Together. I've attached the replays, and the recorded stream will stay online for 14 days.

-- Simon


In 2022, naymapl and cameo69 reported:
github #431: Magic pink won't become transparent on macOS (both Intel and ARM64)
I'd like to debug this, but I don't have a Mac. Thus:

Who has a Mac? Would you like to compile and run Lix on it, and are you up for some testing?

I'll walk you through everything. I'll answer all of your questions. No need to hurry: It's okay if you can spare a few hours here and there. It's okay if you take several days off before you can test a new theory that I'll get.

Let's see if the bug still manifests in 2023. Since naymapl's and cameo69's reportings, has been at least one new release of Allegro 5, Lix's graphics library, and it's possible that the bug is already gone. And if the bug reproduces on your Mac, I'll create some minimal example programs for you to try, to see if the bug is in Lix or in Allegro 5.

-- Simon

General Discussion / Re: Simon blogs
« on: January 22, 2023, 06:49:57 AM »
That's a Tamandua, a small anteater. It's not a Tapir. Very much lovely still. :lix-grin:
See also Gronklink's post about tamanduas.

Still so much work on Lix in my free time, I'm beginning to lose sleep over it. I'm 50:50 on whether the endorphines break even with health, or whether the Lix work is getting detrimental. I should probably schedule a day where I don't look at the source at all, don't play Lix, and don't check Lemmings Forums. Some time after 0.10.5 is out, which should release in the next few days.

-- Simon

Lix Levels / Re: Simon streamed lemforum/Hopeless, Friday, 2023-01-20
« on: January 21, 2023, 07:42:10 PM »
Thanks for the feedback!

I think WhyTree is ranked well as is; I could live with a downrank to mid-Vicious in a pinch:

Spoiler (click to show/hide)

Thanks for creating this rich set of puzzles! Most of lemforum came together ten years ago, and I've only attacked the harder puzzles in the past few months.

-- Simon

Pages: [1] 2 3 ... 249