Changes for MAME/MESS chessengine plugin init.lua file?

320 views
Skip to first unread message

RandyR

unread,
Sep 30, 2022, 12:14:03 PM9/30/22
to PicoChess
After talking with Al yesterday, I started wondering what changes were made to the init.lua file for the chessengine plugin of MAME/MESS. I mentioned to Al that when I compiled v0.245 I just used the updated plugin from Sandro Ronco's Github site. It occurred to me that it might cause issues in PicoChess since I wasn't using the one modified by Dirk.

Today I had a look at Al's original release and noticed that there are 3 files in the chessengine folder. I assumed the init.lua file was a copy of init_molli.lua, but it isn't - it's missing some edits. I then checked what I was using in my images and it's different still.

Since MAME v0.227, the LUA C++ <--> Lua interface was migrated to Sol 3 (=Sol 2 v.3). Therefore, this required some changes to the chessengine lua files. However, we remained on an older version of MAME with Al manually editing the code to support new rom releases/changes. Going forward this will become unsustainable as the changes will become harder to integrate and the MAME code evolves.

All this to say, what changes were needed in the init.lua file to support PicoChess? And, how can it be easily tested (what fails when no changes are made)? I hope Dirk and Al can answer these questions.

An unfortunate side effect of the changes is that the custom artwork (used in CB-Emu) doesn't seem to work (that is to say, the board shows but the pieces don't). I'm not sure why (is it because the images are not open source and MAME somehow checks?) but perhaps the artwork files will get updated in the future. Currently, only the built-in graphics can be used (if using the MAME GUI.

Randy

DannyN

unread,
Sep 30, 2022, 5:25:47 PM9/30/22
to PicoChess
It's all a bit of a mess. Franz Huber regularly updates engine lua files and it would be nice if we could at least use these as they sometimes fix important errors in setting levels etc.

Op vrijdag 30 september 2022 om 18:14:03 UTC+2 schreef RandyR:

RandyR

unread,
Sep 30, 2022, 5:41:54 PM9/30/22
to PicoChess
Yes, it is unfortunate. Franz updates the machine lua files based on the old version of MAME, which I believe is v0.220. Someone with experience with Lua could probably edit the new machine files so it supports the latest MAME versions.

DannyN

unread,
Oct 1, 2022, 5:04:30 AM10/1/22
to PicoChess
I haven't encountered any problems with your compile of 245 and Sandro Ronco's lua files. All the engines I've played seem to work fine so far so maybe Frans's updates aren't that important anyway.  Being able to play against some of Johan de Koning's engines on my stock DGTPi is something I did not expect anymore. I was thinking about upgrading the hardware for it but I can live with how it is now.

Op vrijdag 30 september 2022 om 23:41:54 UTC+2 schreef RandyR:

Scally

unread,
Oct 3, 2022, 8:48:26 AM10/3/22
to PicoChess
Hi all,

I managed to compile mame0245 for Raspbian Buster then created a new mame_emulation folder from the latest CB-Emu/chessengine folders & files. Simply copying the mame0231 lua files is not enough to get it running. This is where Dirk’s extra files are needed, which were originally supplied in a folder called mame-molli-plugins.

As you can see it’s working fine on my RPi4:

Al@RPi4-SSD:/opt/picochess/engines/armv7l-MAME+v3 $ ./tascr30_gideon
uci
id name ChessSystem R30 (Gideon 3.1, prototype) (mame 0.245a-Scally)
option name Speed type spin default 100 min 0 max 10000
option name Level type string default 10 sec/move
option name Style type combo default normal var defensive var solid var normal var active var offensive
uciok
quit
Average speed: 99.77% (6 seconds)

Running it with Danny’s suggested bench command gives:
Average speed: 371.52% (29 seconds) !!

Attached are screen shots of my /opt/picochess/engines and ~/mame-stuff folders from my RPi4 Dev machine.


Cheers,

Al.
3EAD5A32-5F77-485F-BB96-BC3E38F5A19E.jpeg
13E6E643-076C-4DE7-992C-DA1E5AD56BCC.jpeg

DannyN

unread,
Oct 3, 2022, 10:10:26 AM10/3/22
to PicoChess
Great stuff Al. The difference in speed between my RPi3 and your RPi4 is impressive. I get 95% with -bench 30 for the Tasc R30 Gideon. Hmm.

So where can I get Dirk's extra files (mame-molli-plugins)?

Op maandag 3 oktober 2022 om 14:48:26 UTC+2 schreef Scally:

Scally

unread,
Oct 3, 2022, 10:50:13 AM10/3/22
to PicoChess
Hi Danny,

I’m tidying them up, some are out of date and I’ve added other bits based on my findings during mame0245a.

Then I’ll make it generally available, plus you’ll need the mame0231 lua files that Randy gave a link to.

Al

DannyN

unread,
Oct 3, 2022, 10:58:24 AM10/3/22
to PicoChess
Hi Al,

 I already have the 231 lua files installed and I haven't encountered any problem with them and Randy's compile. Looking forward to your compile and files though. Can't wait to test it. Maybe things get even better :-).

Danny
Op maandag 3 oktober 2022 om 16:50:13 UTC+2 schreef Scally:

RandyR

unread,
Oct 3, 2022, 12:42:45 PM10/3/22
to PicoChess
I'm not sure there needs to be any change to the init.lua file from Sandro Ronco. I looked at Dirk's modified one and it appears that he added support for the "position fen" command. But that function is now included in the 0.231 version.

Dirk, can you provide any info?

Randy

P.S.

Al, are you still using the 0.226 code in your Buster compile with modified source for the updated chess machine drivers?

Scally

unread,
Oct 3, 2022, 12:55:47 PM10/3/22
to PicoChess

Hi Randy,

No, it’s the mame0245 source with your provided Makefile. I downloaded the latest CB-Emu/chessengine files from Sept 30 which was renamed to mame_emulation, I then changed the relevant files to get it running (some from Dirk’s initial mame-molli-plug-ins) and added the older lua files from mame0231.

I’m planning to look through any additions since mame0231 and add them to the Makefile source plus add any other required files. Then I’ll compile the latest version which is currently mame0248.

Danny please note, this is a Buster Compile not a Bullseye Compile which Randy has already done. His should run better on Bullseye but I’m sure mine will be upwards compatible and also run on Bullseye. I’ll test this later …

Al

Dirk

unread,
Oct 3, 2022, 12:57:32 PM10/3/22
to PicoChess

Hi,

Yes the position fen support was added by me and is necessary for picochess (otherwise the engine gets stuck after few moves).
I asked Franz to include this change in his CBemu version for us and luckily he did this.

I assume that Sandro just used this version of init.lua for his updated lua file compilation...

Dirk
Picoches rules!

Scally

unread,
Oct 3, 2022, 1:12:43 PM10/3/22
to PicoChess
Hi all,

Ok, my mame0245a Buster compile runs on my CM4 that’s running Bullseye.

I also tried Randy’s Bullseye Compile but it says it’s missing files on the 1 engine I tried, I’ll test more later …

Photo attached …

Al
FF2842A2-70F4-4181-A355-27AFCB63F97F.jpeg

Scally

unread,
Oct 3, 2022, 1:17:47 PM10/3/22
to PicoChess

Arghh, silly me.

Randy’s are missing the vital ROMs.

I’ll retry after dinner 🤬

Al.

DannyN

unread,
Oct 3, 2022, 1:49:17 PM10/3/22
to PicoChess
Hi Al,

I know your compile is made on Buster. I'm just curious to see if your compile plus extra files is even faster than Randy's setup with certain engines. I was planning to test that but I guess you are going to do that sort of after your dinner :-).

Btw, when you run the -bench command there is no need for any additional commands (it is the equivalent of -video none -sound none -nothrottle). Just "sudo SDL_VIDEODRIVER=dummy /opt/picochess/engines/mame_emulation/mess -bench <seconds-to-run> <romname>" is enough.

I also believe it is possible to set -skip_gameinfo, -lightgunprovider none, -video none etc. as defaults in mess.ini/mame.ini.

Danny 

Op maandag 3 oktober 2022 om 19:17:47 UTC+2 schreef Scally:

Randy Reade

unread,
Oct 3, 2022, 1:57:34 PM10/3/22
to pico...@googlegroups.com
Overclocking. 😁

DannyN

unread,
Oct 3, 2022, 2:18:11 PM10/3/22
to PicoChess
I tried it (sort of) with the RISC 2500 with the command -speed 1.5 added as I was not entirely happy about the response times I'm getting. At a level with 2 sec/move, the response time for book moves was faster (within 3 seconds i.s.o 5 seconds on my DGTPi) but once out  of book the response times went back to +/- 10 seconds per move. I don't know why the response times are so slow on the RISC 2500 (and Montreux). It benchmarks at 225% with nothrottle and 98,5% with throttle so should run ok on my DGTPi. It is playable and I'm very happy that I can play some JdK engines but I would like to see them a bit more responsive. But maybe it's a driver issue that still needs to be fixed (according to http://adb.arcadeitalia.net/dettaglio_mame.php?game_name=risc2500&arcade_only=0&autosearch=1 it is still imperfect in MAME).

But overclocking MAME engines on Picochess should be possible as Franz Huber and Ruud Martin are doing it as well. 

Op maandag 3 oktober 2022 om 19:57:34 UTC+2 schreef RandyR:

Randy Reade

unread,
Oct 3, 2022, 2:18:26 PM10/3/22
to pico...@googlegroups.com
Thanks, Dirk.

I compared the init.lua file between CB-Emu and Sandro and they are fairly similar. Franz has not updated to Sol3 so I doubt it would work in MAME versions above 0.226, but Franz has also added some changes (like randomness for engine tournaments, Sensorboard Clear, some machine-specific functions, etc.) into his code. They look simple to port over, though. But there may also be tweaks in the machine.lua files that aren't available in Sandro's files.

Randy

DannyN

unread,
Oct 3, 2022, 2:31:53 PM10/3/22
to PicoChess
I compared Sandro's lua and Franz's lua for the RISC2500 as I thought maybe my issue with responsiveness was caused by the level not being set correctly by the lua so that it defaulted to 10 sec/move (the default). There's only a tiny difference between them. Franz added code to let the emu wait for 0.25 seconds between setting the level and setting the style. That's the only difference I can see but with Franz's lua installed the engine stops after my first move on the board. With Sandro's lua I can play without a problem.

Op maandag 3 oktober 2022 om 20:18:26 UTC+2 schreef RandyR:

RandyR

unread,
Oct 3, 2022, 2:33:13 PM10/3/22
to PicoChess
I meant Al overclocks his RPi4. Here is my RPi4-4Gb overclocked using my v0.245 compile on 32-bit Bullseye Desktop:

pi@picochess:~/mame $ ./mess -skip_gameinfo -lightgunprovider none -video none -plugin chessengine -bench 300 tascr30g
Average speed: 386.29% (299 seconds)

No overclocking:

pi@picochess:~/mame $ ./mess -skip_gameinfo -lightgunprovider none -video none -plugin chessengine -bench 300 tascr30g
Average speed: 291.41% (299 seconds)

RandyR

unread,
Oct 3, 2022, 2:36:24 PM10/3/22
to PicoChess
I guess the custom artwork won't work then, or did you find a way to get it working?

DannyN

unread,
Oct 3, 2022, 2:41:38 PM10/3/22
to PicoChess
Oh I see. Well, overclocking my RPi3 is not advisable apparently. I don't need to be able to run every single engine. I'm happy if I can run certain MAME engines from certain engine authors (Kittinger, Schröder, Lang, de Koning). Overall, I'm satisfied with the speed I get from it.

Op maandag 3 oktober 2022 om 20:33:13 UTC+2 schreef RandyR:
Message has been deleted

Scally

unread,
Oct 3, 2022, 3:36:18 PM10/3/22
to PicoChess
Hi all,

Surprisingly there’s very little between a Buster Compiled mame0245 and a Bullseye Compiled mame0245 both running on my Bullseye Compute Module 4

See the attached screen shot where various Emulations are compared using a bench of 30 seconds

More tomorrow …

Al.



On Monday, October 3, 2022 at 8:06:25 PM UTC+1 Scally wrote:
Hi Randy,

I’ve looked at the artwork yet, first thing first.

I’m about to compare our compiles on a 30 second bench with some engines …

Al.
0B0F149D-09B9-44EE-911B-AB48F57E3361.jpeg

RandyR

unread,
Oct 3, 2022, 3:59:48 PM10/3/22
to PicoChess
Thanks for testing, Al. I'm glad my compile holds up as it was a cross-compile done on my Linux (Mint) laptop, which is considerably faster than the RPi4.

Randy

Scally

unread,
Oct 4, 2022, 3:51:34 AM10/4/22
to PicoChess
Hi Randy,

I did a typo last night after a long day, so I deleted that message, this is what my reply should have read:

I haven’t looked at the artwork yet, first things first … 

Al.

Scally

unread,
Oct 7, 2022, 6:43:30 AM10/7/22
to PicoChess
Hi all,

I ran -bench 30 against the same engines as before using the latest compile of mess0248a

These can be compared against the mess0245a figures 3 posts prior to this ^^^^^

See attached screen print ….

Al.
98B47223-C792-4AC7-92C7-C945412DACDA.jpeg

Scally

unread,
Oct 7, 2022, 10:03:15 AM10/7/22
to PicoChess
Hi all,

If anyone wants to try mame0248 I have uploaded 2 files to my Dropbox here:

The 2 files are both zip’d:

mess0248-small.zip - you can unzip this and replace the mess file in your existing  “opt/picochess/engines/mame_emulation”  folder.
You may want to rename your existing mess file to mess.old. You will need to give the new mess file executable rights via
chmod a+x mess  (You may need sudo to do this)

Or

mame_emulation_mame0248a.zip - unzipped, this contains a full mame_emulation folder with all the latest code plus the above mess file. This needs to be paced in  “opt/picochess/engines” after renaming your existing mame_emulation to old or whatever.
Again give the mess file executable rights as above

These were compiled within Raspbian Buster and will work in both Buster and Bullseye environments.

Please note these will not work in a Graphical environment, but hopefully we can work out how to do that soon.


Cheers,

Al.

DannyN

unread,
Oct 7, 2022, 1:44:20 PM10/7/22
to PicoChess
Hi Al,

Just tested it (the binary only) and it's working fine. Benchmarked a few engines as well and the speed I get for them is the same as with Randy's 245 compile.

Btw, you may consider cleaning up the mame_emulation folder that's in the full zip file. There's no need for all the Windows executables and files for Franz Huber's messchess interface. It would reduce the size of the folder from more than 100mb to about 60mb.

Danny

Op vrijdag 7 oktober 2022 om 16:03:15 UTC+2 schreef Scally:

Scally

unread,
Oct 7, 2022, 2:18:24 PM10/7/22
to PicoChess
Hi Danny,

Thanks for testing it, I’m aware of the extra files, I use a bash script to set everything up and it was only meant for my use. However I knew you wanted to try it out. 

I owe Randy a big thanks for the updated source files within the Makefile.

I expect Randy will include his compile in the official new images, but first I have to get my arse in gear and update the Engines 😉


Cheers,

Al.

DannyN

unread,
Oct 8, 2022, 9:03:56 AM10/8/22
to PicoChess
One other thing to note is that Franz Huber actually uses two plugins: chessengine and data. On Picochess only plugin chessengine is needed and you don't need to load the data plugin. If you change plugin.ini so that only chessengine is loaded (with a 1) you can safely delete the data folder - at least that's what I have done.
See https://docs.mamedev.org/plugins/data.html for what the data plugin does. FH uses the data plugin with messinfo.dat for giving loads of information about the engines in his interface but since that can not be read in Picochess, it is not needed imo.


Op vrijdag 7 oktober 2022 om 20:18:24 UTC+2 schreef Scally:

Scally

unread,
Oct 8, 2022, 12:29:01 PM10/8/22
to PicoChess
Noted, thanks …

Dirk Sommerfeld

unread,
Nov 17, 2022, 11:28:07 AM11/17/22
to PicoChess
Hi all, for information.
Franz make some  Messchess updates last time to setup positions in mess engines.
I migrate all of his new stuff to our init.lua compare to the new syntax. That's work now.
Now I will also do this with lua romfiles.That's a lot of work, between the version difference. 
I hope that I can setup positions in retroengines with picochess soon. 
stay tune, I will provide this stuff it is ready-
Dirk

Randy Reade

unread,
Nov 17, 2022, 11:40:27 AM11/17/22
to pico...@googlegroups.com
That's great, Dirk! Thank you. I had a stab at it but it was beyond my abilities.

Looking forward to using updated lua files in the latest MAME versions.

Randy
Reply all
Reply to author
Forward
Message has been deleted
0 new messages