Up to Main Index                               Up to Journal for May, 2022

                     JOURNAL FOR WEDNESDAY 11TH MAY, 2022
______________________________________________________________________________

SUBJECT: Updates on Raspberry Pi, Go 1.18.2 and combat
   DATE: Wed 11 May 21:02:21 BST 2022

After all the problems I was having in the lab things have started to settle
down and everything is back to normal. The Raspberry Pi 4 (4Gb) that I pressed
into emergency service as the lab’s firewall, router and backup server — the
server I was using failed — has been doing a sterling job.

I’m still considering letting the Pi carry on in this role full-time.

After a power-cut I decided to add a DS3231[1] real-time clock (RTC) to the
Pi. The Pi runs NTPsec but the broadband router can take an age to provide an
internet connection, resulting in odd timestamps in logs and on files. When
setting up the RTC I couldn’t work out why it kept being detected as a DS1307.
If you run “modinfo rtc_ds1307” it shows the module is aliased to a number of
different devices, including the DS3231 — doh! Maybe this will help others :|

The RTC should be quite accurate as it’s temperature compensated and has an
accuracy of ±2 ppm (0°C to +40°C) or ±3.5ppm (-40°C to +85°C). That’s about
±0.1728sec/day and ±0.3024sec/day, which can be adjusted for in software.

I found out from my logwatch nightly email, under the lm-sensors section, that
the RTC also has a temperature sensor with an accuracy of ±3°C:


  ds3231-i2c-1-68
  Adapter: bcm2835 (i2c@7e804000)
  temp1:        +42.5°C


Yesterday Go 1.18.2 was released with a security update. It also contained the
patch[2] to fix issue #51776[3]. The issue prevented Go 1.18 and 1.18.1 from
being used to build and release WolfMUD binaries. I’ve already built Go 1.18.2
on 32-bit ARM on the Pi and used it to build WolfMUD binaries without issue :)

I have some news on WolfMUD and the combat system. Since the last update I
must have re-written the combat code several times from scratch :( It would
have been much easier to implement just one-on-one combat. Stupid me, I wanted
to aim higher and have multi-combatant fights *sigh* :|

The good news is I now have the basic combat code working. Basic as in 50/50
chance who hits who and fixed 2+(1-2) damage still. The code is a bit of a
mess, player messages are not quite right and debugging messages are being
spewed out all over the server logs, but it’s working :) Along the way I
found, and fixed, a few subtle issues in the event handling code.

For multi-combatant fights the rules are that if you are not attacking anyone
then you can start a fight with someone — even if that someone is already
fighting. This allows a group to gang up on a opponent and for others to come
to the rescue and assist in a fight. The size of a fight is currently only
limited by the crowd size in a location.

I’m not quite ready to push everything to the public dev branch yet. I need a
few days to clean up the code and do more testing.

--
Diddymus

  [1] A tiny board with the DS3231 chip and a super capacitor for £5, no idea
      how long it runs for without power:

      https://thepihut.com/products/mini-rtc-module-for-raspberry-pi

  [2] runtime: align m.procid to 8 bytes on 32-bit systems
      https://go-review.googlesource.com/c/go/+/399754/

  [3] Go Issue #51776: https://github.com/golang/go/issues/51776


  Up to Main Index                               Up to Journal for May, 2022