The place where random ideas get written down and lost in time.

2024-01-01 - Defold vs Godot

Category DEV

Week of 2023-12-24 to 2023-12-31, I wrote Nerdkill Defold. Worked well, was easy to use and get something.

One thing that was nice was that I ported the original game, with all the original 8 “weapons”.

Started looking at Nerdkill w/ Godot 4.2, just to compare with Defold.

Not sure there's a point in concluding that one though.

A new Asqare using Godot 4 for Android would make more sense.

One angle of Nerdkill w/ Godot would be how to create a project that can produce both a web version and a mobile version? More specifically, I’d want the screen form factor to be different.

  • Nerdkill “desktop” in landscape can use the cartouche with the 8 weapons.
  • Nerdkill “mobile” in portrait can use the 5 weapons.

I could of course change the mobile version to have the same 8-weapons row, but I feel the mobile version looks better that way.

(Alternate idea: consider using 7 weapons on mobile; drop the flag. 2 rows of 5 slots each, the cartouche would occupy the 3 middle bottom slots.)

So one thing I realize I don’t know if it’s possible is to configure the window size dynamically, or at least static by export type. Or maybe it could be two projects using the same resources.

https://forum.godotengine.org/t/how-to-change-window-size-using-gdscript/2861/3

“get_window().size = Vector2i(width, height)”

https://docs.godotengine.org/en/stable/tutorials/rendering/multiple_resolutions.html

“the size in Project Settings > Display > Windows… think of it as the design size”

“to support both landscape and portrait, consider using e.g. 720x720”

Click here to continue reading...


2023-12-24 - Defold

Category DEV

Started going through the Defold tutorials.

I have 3 possible learning projects I could try with this:

  • Nerdkill.
    • Could be limited to an HTML5 output, purely as-is with no changes (e.g. no goals), and visible only via the Nerdkill web page.
  • Asqare.
    • This would be an Android output. I’d limit it to one of the 2 engines.
    • One goal would be to “finish” the game by adding more animation / interactions, and power ups, and better scoring.
  • Cangrejo.
    • That could be HTML and Android.

On the Android side, an aspect would be to check the Play Game integration. E.g. leaderboards, achievements, profile management, saves/restores, etc.

One open question, similar to Godot: how does one separate the engine from UI, and how does one provide unit tests for the engine part? There seems to be a clear lack of MVC or MVP design in these tutorials.


2023-11-21 - Rig4 Index

Category DEV

Just a quick thought on something that still bugs me with Rig4’s generated blog:

  • I write pages with 10 posts per page, from 00NN.html down to 0001.html.
  • I then write an index with the 10 most recent posts.

The rationale is:

  • The numbered pages are “stable”: older pages (with lower numbers) don’t change when new posts are added “normally”, that is when posts are added for the most recent day.
    • It’s exceedingly rare that I’d add a “late” post in the middle.
  • The last numbered page fills up and, once it reaches 10 posts, becomes stable.
  • I never link to page numbers, but I do expect them to be indexed by search engines and I’d like these links to become stable.

The downside:

  • The index page necessarily duplicates N < 10 posts from the last page.
  • When clicking the “next page” button from the index, we land on the top most page, which basically duplicates the same content, and that’s a bit confusing.

That last bit is what annoys me. I don’t have a solution for it.


2023-10-16 - C++ “r-value reference T&&”

Category DEV

Trying to make any sense of the “T&&” notation in C++.

It means “an r-value reference” “a forwarding reference”.

https://stackoverflow.com/questions/4549151/c-double-address-operator

https://stackoverflow.com/questions/5481539/what-does-t-double-ampersand-mean-in-c11 (*)

It’s referenced in the C++11 “range-based for loop” loop construct:

https://en.cppreference.com/w/cpp/language/range-for

for (auto&& [first, second] : mymap) { … }                ← WAT?

The summary of the SO (*) above is:

  • rvalue is the result of an expression or any temporary (e.g. type conversion).
  • Typically, it would be used as a “copy” using a “const T&” reference and becomes an lvalue. E.g. the user cannot modify the value (since it becomes const).
  • T&& is used as a receiving argument type in a function.
  • An argument of “T&&” preserves (forwards) the “rvalue” property and passes it down as-is. The user can modify the value (since it is not const).
  • When used in a template, “T&&” becomes either “T&” (for an lvalue), or “T” (for an rvalue / temporary).
  • As such it’s named a “forwarding reference” and is associated with std::forward<T>.

About std::forward<>, it’s equivalent to performing a static cast of “T&&” to preserve its rvalue:

https://stackoverflow.com/questions/3582001/what-are-the-main-purposes-of-stdforward-and-which-problems-does-it-solve/3582313#3582313

Coming back to that “range-based for loop” construct:

https://en.cppreference.com/w/cpp/language/range-for

  • for (auto x : array) {}                → access by value (I guess “copy”)
  • for (const T& x : array) {}        → access by const reference
  • for (auto&& x : array) {}        → access by “forwarding reference” (not const)

are all possible.


2023-10-06 - CMake

Category DEV

https://cmake.org/cmake/help/latest/guide/tutorial/index.html

In a file called CMakeLists.txt:

cmake_minimum_required(version)

project(name)

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_CXX_STANDARD_REQUIRED True)

target_include_directories(ProjectName PUBLIC list_of_dirs)

for an exe, the minimum is add_executable(Name file_list)

for a library, add_library(Name file_list)


2023-09-20 - Game Engines to Look at

Category DEV

Game engines to look at:

Defold seems like an interesting choice to explore. It’s the King (candy crush) engine. I don’t think it’s truly open source. Programming is done in Lua.


2023-09-08 - Monitor Raspberry Pi Temperature

Category DEV

Over here on the servers, I know have a script that monitors the Raspberry Pi (1 or 4) temperature and prints it when it rises:

#!/bin/bash

CA=0

CI=90000

while true; do

  C=$(</sys/class/thermal/thermal_zone0/temp)

  if [[ "$C" -gt "$CA" ]]; then CA="$C"; fi

  if [[ "$C" -lt "$CI" ]]; then CI="$C"; fi

  D=$(date)

  T=$(python3 -c "print('min: %f C | curr: %f C | max: %f C' % ($CI/1000., $C/1000., $CA/1000.))")

  echo "$D : $T"

  sleep 5s

done

Note this is not a service, just a basic shell/python script to run ad-hoc.

The RPi 4 is currently around ~50 C, with no fan.

According to sources, it can go up to 80-85 C before it starts throttling to reduce heat.


2023-07-29 - Thought of the Day: DWM on Automation Computers?

Category DEV

So first, let’s make this clear: DWM is both terribly good, and terribly bad.

  • Excellent small footprint and minimal functionality.
  • Keyboard only usage is both excellent yet terrible. I generally don’t remember the shortcuts except for the 3 main ones: Alt-S (new shell), Alt-1..9 to select a workspace, and Shift-Alt-1...9 to move a window to a workspace (they call them “tags”).
  • A lot of programs aren’t designed for the “full screen / forced tiling” approach and require some kind of floating windows to be usable.
  • DWM has basically one “window model”: a main shell, and a stack of secondary windows opening on the right of it. It’s really designed to have one shell per workspace.

My window manager of choice is LXDE. It’s very light in resources, and in features, yet it’s a “proper” window manager. I could do without the session manager aspect.

As a thought exercise, how would I use Consist with DWM?

  • I have 3 shells that start. Ideally they could be tiled on space 1.
  • JMRI needs 3 windows: JMRI main, WiThrottle, and Conductor.
    • JMRI main + WiThrottles could be tiled on space 2.
    • Conductor should be tiled on its own space. Is that possible, or does it need to be with the rest of the app?
  • When debugging, I like to have Conductor + the JMRI shell window together.
  • When resetting a failed automation, I like to have Conductor + 1 or 2 new JMRI Throttle windows together.

That’s the part where DWM starts to suck. It’s not designed for this kind of functionality.


2023-07-03 - Updates: GA4, Rig4k / Rig4j; What’s Next?

Category DEV

On the GA4 front, I now have some basic dashboards working for Randall:

  • Alfray blog                        DONE
  • GGMRC                                DONE
  • Conductor 2                        DONE
  • Server Pings                DONE
  • Inkblot3 (flutter)        Already GA4
  • RTAC (tablet)                TBD
  • Vision                        DONE
  • Other web pages?                TBD

On the Rig4 front:

  • Rig4k is slowly starting.
    • Have some good skeleton around.
    • Gdoc separation/caching is not as clean as desired.
    • Starting to focus on the html-to-izu.
  • Rig4j:
    • Found a way to re-inject the missing CSS styles, so this temporarily fixes the web site's lack of bold / italics / tables.
    • So basically one more little bandaid keeps this working for now.


2023-06-29 - SPA Web Alternatives: Flutter / ReactJS vs Smalltalk Seaside / AIDAweb

Category DEV

Something to try:

The critical question is why bother? Flutter / React already offer well-rounded frameworks, and Smalltalk is just yet-another-esoteric language. It’s on the same level as JS/TS/Dart when it comes to “stuff I only use occasionally”, with the typical issue of feeling mostly write-only.

On that part, I ended up actually enjoying Dart as it seemed like a suitable compromise between Java, JS, and TS.

Flutter vs ReactJS:

  • Pro of Flutter = dev in IJ… The integration is excellent.
  • Cons of Flutter = dev in IJ… Requires IJ to edit a project.
  • Same goes for ReactJS. The VS Code integration is good, but lacks an IJ-level project management.
  • VS Code is good for short-sided projects (e.g. Wazz), whereas IJ is better for large project organization.


 Generated on 2025-01-18 by Rig4j 0.1-Exp-f2c0035