The place where random ideas get written down and lost in time.
2022-09-17 - Screen Alternative: TMUX
Category DEVI tried tmux a while ago, and didn’t like it, can’t remember why. Time to look at it again.
Let’s try it:
$ sudo apt install tmux
That does also require a few libs, libjpeg, lua (?!), etc.
Now the test is that I’m going to run Screen from Portal, and then inside I have Tmux on PiR.
[pir] $ tmux
[pir] $ tmux a | attach | attach-session # equivalent to -r -d
[pir] $ tmux list-sessions
Tmux has “windows” and “panes”: a window contains 1 or more panes.
Contrary to screen, “split” creates a new “pane” with its own shell. I don’t see how to “bring” a different window pane into the current one like I do with screen.
Contrary to screen, re-attaching preserves the split panes in a window.
Nesting screen in tmux in screen:
- I have this setup: screen > tmux > screen. I know 😕
- Ctrl-a + key for the first screen
- Ctrl-b + key for the first tmux.
- Ctrl-a + a + key does send to the 2nd screen
That actually works well, and it’s better than nesting 3 screen sessions inside each other.
2022-08-31 - Android Kingdom Rush TD
Category DEVhttps://love2d.org/ -- open source 2d game framework over Lua
Another site online mentioned the use of cocos2d which is not very interesting.
2022-08-14 - Nerdkill Android and Godot
Category Android
Nerdkill needs to be updated to satisfy the Play store requirements.
I started an “N2” branch in the Nerdkill Android repo, simply rebuilding the existing Android source under a modern AS / gradle project. This should be considered 90% done. The only known issues are:
- As for Asqare, I had to implement a “canvas zoom” in the rendering engine to simulate a smaller screen. This results in the desired pixelated look.
- The weapon / cartouche area is 50% height. Probably needs to be adjusted by the canvas zoom or similar. [⇒ FIXED]
- Lack of default Android menu. In Asqare, I fixed that by adding the window nav bar and populating a menu icon. I can do the same here, or I can just add a 3-dot menu icon in the intro screen. [⇒ Not Needed]
I’m likely going to just fix issue #2 (or maybe even not) and release the game as-is to meet the store requirements to avoid delisting. That’s the “immediate band-aid” strategy. [⇒ DONE, submitted to the store]
But a bit more long term, I’ve been wanting to put out a Godot-based game, and after contemplating doing that for Asqare, I’ll use Nerdkill instead. After all that’s the core leitmotif of the project, to be a test bed for platform adoptance.
Thinking of using D3 for learning how to use it, and RPisicine could be a good candidate for that. It’s a React app so how do we integrate them?
Many D3 tutorials: https://www.google.com/search?q=d3+js+tutorial
With React, apparently an obvious complexity is that they both manipulate the DOM, so need to use state/useEffects to combine them. This has more details:
https://www.pluralsight.com/guides/using-d3.js-inside-a-react-app
https://blog.griddynamics.com/using-d3-js-with-react-js-an-8-step-comprehensive-manual/
There are some wrappers to help with that:
https://react-d3-library.github.io/
In npm https://www.npmjs.com/search?q=react%20d3, projects fall under 2 categories: “generic d3-in-react” libraries, and dedicated graphic components.
2022-06-18 - Bearing Waypoints
Category DEVCurrent waypoint management needs some improvements:
- Compass screen
- Label Target waypoint (saved name)
- Display save name, truncate as needed.
- Menu save if new, vs edit if saved.
- Waypoint screen
- Label list as "saved Waypoints"
- Change selected buttons as row below text field.
- Separate the delete button
- "Set target" button to match the compass screen, with same icon.
- Share to map on this screen
- A more menu with 3 dot icon
- Export all (use a simple JSON)
- Import from JSON
2022-06-18 - Android Studio Emulator
Category Android
In the latest version of Android Studio, the emulator shows up in a pane in the IDE. This is annoying and absolutely unusable on a small laptop screen. How do I get rid of that and have a separate window as usual?
To get rid of that: AS > File > Settings > Tools > Emulator > uncheck “Launch in a tool window”.
Also keep creating the AVD with the “Cold Boot” setting instead of “Quick Boot”. Most of the time the emulator starts “unpowered” in quick boot, nothing on screen, and no idea on how to fix it.
If I had to rebuild Asqare today, which framework would I choose?
Clearly I would use an existing one instead of rolling my own. There are lots of choices out there.
- Godot is one obvious choice. It’s even officially listed in the Using a game engine on Android guide.
- libGDX is another obvious choice for something lower level. It’s not a “full stack” game engine, yet it’s a good foundation for someone to roll their own renderer.
For Jump!, the idea was to use scenes to implement everything in Godot. It’s a Godot thing, which just happens to export to Android. Some functionality can be provided by plugins, such as the screen sharing/export provided by GodotShare.aar → this is done by generating an “aar” library, and making it available to Godot..
For something like Asqare, the native Android implementation has some advantages as the gameplay screen is a view in an actual activity. It would be nice to know how to implement that level of integration using Godot. E.g. ideally a scene is just one view, or maybe one fragment, which is controlled by an otherwise “pure” Android app. That is, I want the reverse: instead of adding android library functionality to Godot, I’d like Godot to generate a library that I integrate in an external android app. This mode doesn’t quite seem supported but this seems the closer we can get:
https://docs.godotengine.org/en/3.5/tutorials/export/android_custom_build.html#
The obvious cons here is that this implies we now have to deal with two tools/frameworks and they might have incompatible release schedules or requirements.
Generally speaking for all these small games, there’s a strong desire to reorganize them in a clear MVP or MVC pattern -- model-view-presenter or model-view-controller. MVC makes the most sense here: the model is the core gameplay, which can be coded in a separate library (e.g. an aar import), the view is an android skeleton and/or godot, and the presenter is godot.
It’s worth pointing out that games like Asqare and even Nerdkill are already architectured like that.
In a sense that seems to run contrary to the default Godot game implementation: Godot naturally tends to architecture a game around its scene graph as being the directing entity. The scene graph is the model. Furthermore entities in the scene graph embed part of their own logic such as collision and event handling.
In the Asqare case, that’s not incompatible with the MVC pattern: the “core” Asqare game can be modeled as a board representation (an array of e.g. integers) and a function computing the name board state as well as a list of view updates. The presenter part in Godot would basically map each board cell to a sprite entity. Updates are actions like select (implemented as blinking or rotating a sprite), vanish, or animate an entry. This is the way the game is currently implemented in its Java micro “game engine”, even though it’s all hard coded functions and nothing is really generic.
From that description, it does read like using Godot for Asqare would be a bit of a stretch actually:
- Godot drives the android app creation, instead of being an embedded view/fragment.
- Godot strives to be the model with its scene graph.
The only benefit of using Godot is to use it as an animation engine (and without having to learn a new one). That’s more or less what using libGDX would do.
I should make the point that Nerdkill on Godot does make a lot of sense. The “scene graph is the model” works fine for Nerdkill.
But what about Asqare. If not Godot, then what?
What do I want, ideally?
- Some kind of scene graph thingy.
- An animation engine with some basic effects.
- Optional: 3d support with an orthographic top view. Would allow to draw elements in Blender and animate them without having to render them to static image maps
- The cons of that is the added complexity of a 3d GL view.
What if we took a different approach? Kotling game engines:
- MiniGDX: https://gamefromscratch.com/minigdx-kotlin-game-development-framework/
- Besides the name, this has no affiliation with libGDX. It uses ljgl and al.
- This is just a one-person game engine with no pedigree and no support team.
- Same person has contributed to libKTX.
- libGDX is well known and documented.
- Does both 2d and 3d.
- https://libgdx.com/wiki/jvm-langs/using-libgdx-with-kotlin
- https://libktx.github.io/
- Korge: https://korge.org/
- https://gamefromscratch.com/korge-engine-kotlin-powered-open-source-game-engine/
- Korge is a set of libraries + some IJ plugin.
- It focuses on 2d.
- Kotlin-is-fabulous indoctrination is a cons.
- That Flutter-simple-game thing?
- Meh to Dart.
- No desire to use it long term.
- Android Jetpack Compose?
In my case, looking at the long-term, say I update an app next in 5-10 years:
- The IDE project may be obsolete. E.g. some of my projects still use Eclipse.
- The project configuration may be obsolete, even if the IDE is still the same.
- Example: gradle groovy now vs maybe gradle kotlin later.
- Who knows about stuff from e.g. Godot?
- The language could become obsolete.
- Example: go1 projects not compatible with go1.5, etc.
- C# has the same issue. I expect Kotlin to have the same issue.
- Java has this “legacy” thinking model which saves it for now.
- Who knows about GDScript?
- Library support for Android and older API models changes.
- Compat library is min 14 these days.
- A lot of stuff at G is min 21.
Having an app/game that depends on e.g. Godot + Android means to have to deal with all that, times 2, for each platform, plus their intersection.
I found the sources for both under the old Autosettings project.
Back then I was using branches, instead of placing such projects in their own repository.
I should move them under their own git repo under bitbucket/ralfoide.
Flashlight matters; Brighteriffic not so much yet I may update it if it isn’t too cumbersome.
In both cases it makes sense to duplicate the autosettings repo entirely to preserve history, and limit it to these app folders only.
<fork autosettings repo>
$ git clone git@bitbucket.org:ralfoide/brighteriffic.git
$ git filter-branch --prune-empty --index-filter 'git rm --ignore-unmatch --cached -r AlarmTest branches Flashlight wiki distrib/[aAfqtT]* trunk/AutoSettings trunk/TimerifficTest'
$ git push --force
Spent the last week or so “rebuilding” Asqare.
Only needs “one last little change”.
Tradeoffs:
- See plenty of things I could change in the game, but that would delay release.
- Did a few minor things to make the game usable on Android 12.
- Will release a “1.4” which is mostly the same thing.
- Wrote dev notes and maybe will do a “1.5” that has game changes.
One thing that works well: Android 12 + Android Studio chipmunk ⇒ Wireless Debugging. Enable in android settings, customize a quick setting tile to toggle it. Very convenient to push/debug from AS that way.
Question: can command-line adb also use Wireless Debugging?
For release, using the B3 script to create a bundle (aab), without the flavors.
This produces a signed AAB (for Dev Console) + temporary APKS for local deployment.
My script signs the AAB using the old jarsigner. I had to work around it that way because the key format is old and I failed to update into a newer format.
Issue: the local APKS are signed with a debug key. Which means I can’t push and update an app store signed binary.
⇒ According to this SO, I should be able to sign the AAB with release and thus the APK should be signed too?
For the Dev Console, the only choice is to upload an AAB. I’m using the self-signed method where the console does not sign the APK for me (I think?)
When uploading the AAB: “Error: To upload an Android App Bundle you must be enrolled in Play App Signing.”
When uploading the signed APK: “You uploaded an APK with an invalid signature (learn more about signing). Error from apksigner: ERROR: MIN_SIG_SCHEME_FOR_TARGET_SDK_NOT_MET: Target SDK version 32 requires a minimum of signature scheme v2; the APK is not signed with this or a later signature scheme”
The “signature scheme v2” is explained here: https://source.android.com/security/apksigning/v2
The tool to use is “apksigner” available in build-tool 24.0.3 and above.
However I had already tried it years before and my signature uses an older SHA-1 which is now considered obsolete; I had tried to change the keyfile with no success.
Plan B:
“Google isn't protecting the app signing key for your app. Opt in to use Android App Bundles”
I had to do that for Bearing and Seeds: see “\pɔʁt.na.wak\”
Learning for these:
- The Opt In selection in the Dev console is FINAL. The choices are confusing, poorly explained, and there’s no way to change them later on. <grrr>
- Be very careful to select the option to keep using my signing key and not let the store generate a new one. This is NOT the default and it’s a PITA to use.
- Need their PEPK tool to sign the release key to set it up the first time.
- Need the upload key from the store.
Opt In:
- In screen “Let Google Play manage your app signing key”:
- Use option “Use existing app signing key from Java KeyStore”
- Generated a release key based on my key using PEPK ⇒ that’s the same signature arguments as used for Bearing, so maybe keep that file around and write down where it is!
- Upload release key
- Save
IMPORTANT:
- My keystore has 2 aliases. Asqare uses alias 1. Bearing/Seeds used alias 2. Because history.
In the Dev Console:
- Upload an AAB to the Internal Testing track.
- WAIT for an email from Firebase Test to get a health check on many devices.
- Takes at least 5 hours, but less than 24 h.
- Once it’s fine, convert it to a prod push.
- There’s an email when it’s available.
2022-05-11 - Updating Android Apps
Category DEVThe new google play mandate is that apps must somewhat follow the latest API level, or risk getting booted out of the store after a certain delay.
https://developer.android.com/google/play/requirements/target-sdk
“Starting in November 2022, app updates must target API level 31 or above and adjust for behavioral changes in Android 12;”
https://support.google.com/googleplay/android-developer/answer/11926878
- New Apps: API 31 by 2022-08-01.
- App Updates: API 31 by 2022-11-01.
- Existing Apps: API 31 by 2023-11-01 / API 30 by 2022-11-01.
TL;DR: So that means all apps should be API 30 by Nov 2022, but because they would be updates they need to be API 31, so we might as well bring them to API 32 right away.
The plan is to try to update apps on a rotating basis, for example one per month.
For that, I need a list, and I’ll reuse my gradle-version spreadsheet.
List has been updated:
Ralf Flashlight (done) |
Prod v123 |
4 |
3 |
4 |
Nerdkill (done) |
Prod v105 |
4 |
3 |
4 |
Mandelbrot Map 2 |
Prod v13 |
11 |
4 |
11 |
Asqare (done) |
Prod v102 |
1 |
1 |
1 |
Brighteriffic |
Prod v103 |
4 |
3 |
4 |
Cangrejo |
Testing v1 |
29 |
18 |
29 |
Jump! |
Prod v4, Testing v3 |
29 |
27 |
29 |
Project E |
Testing v1 |
29 |
18 |
29 |
Seeds (done) |
Prod v402005 |
28 |