Author Topic: Possible to make a screensaver that cycles through games? (solved, sort of)  (Read 6180 times)

qqplayer

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
Well with a whole lot of duct tape I got everything working. My cabinet swaps to a random game every 5 minutes if no one is playing it, which has officially gotten us out of our rut of playing the same few games over and over. And it makes our MAME cabinet a lot more interesting in general, since every time I walk past there's some new oddball artifact of the 80s or 90s playing on it. If you don't mind a heinous pun, it's a game changer (oof, sorry about that).

It would be so nice if this was natively possible in Attract Mode! Unfortunately I don't where to start for adding the functionality there though. If any AM devs are interested, I'm glad to help however I can though.


An outline of how I got it working:

- I made an Attract Mode screensaver.nut that simply launches my Python script after X minutes of inactivity

- my Python script then launches a new game after every 5 minutes (configurable) of inactivity, and is smart enough to reset it's inactivity counter even during game play (something that Attract Mode currently can't do, as far as I can tell). So it keeps launching random games whenever no one is using the cabinet. And someone can start playing that game any time. But if someone presses the exit button, they're returned to Attract Mode so they can choose specific games manually.

- and the cycle repeats: Attract Mode will then relaunch my script after X minutes of inactivity.


A couple of nice features:

- the script starts either via a screensaver.nut after X minutes, or manually via a "Random" button on my cabinet (the Random button executes an AM plugin that launches the script)

- currently it picks a random ROM from the roms directory, but it could easily be adapted to choose a random entry from a specific Attract Mode romlist.

- it detects when a ROM doesn't launch properly and adds it to a list of bad ROMs that it won't use in the future. Also handy for finding and fixing bad ROMs.

- the script can run independently of Attract Mode, but it's nice to also give the user the ability to choose their own games manually, which Attract Mode does so beautifully. So the user is returned to Attract Mode when they press the Exit button on the cabinet.

- it works with my ServoStik to change the joystick between 4 and 8 way as needed



The duct tape part:

- when my Python script launches it has to kill Attract Mode, or AM will keep responding to keystokes in the background. That's a big issue since for example when exiting a game from my script AM will simultaneously launch a game, which is a pretty big conflict. Solved by simply killing AM.

- when my Python script exits, it then relaunches Attract Mode, so the player can manually choose games again.


I'm glad to share it if there's interest, but I made it for Linux so I'd have to make a few mods if someone wanted to use it on Windows.

And if any Attract Mode devs have interest in implementing this natively in AM, I'd be glad to help. I think this is what would be required:

- have AM listen for keystrokes and/or joystick action while a ROM is playing. Possibly solvable by a secondary script that sends an activity notice to AM whenever there's activity (maybe by sending dummy keypresses to the AM interface?).

- or if AM was remote controllable, an external script could simply tell Attract Mode to launch new games at will. For example if I could run "attract_mode_cli mame/dkong" or maybe send a command through a webserver or a network socket, then an external script could handle the screensaver part but still play nice with AM.

Maybe someone can improve a solution if you post the code...
I think you need to use the github channel if you want the main developer to answer.

spud1

  • Full Member
  • ***
  • Posts: 40
    • View Profile
Hi wrybread. I would be very interested in your code if you are willing to publish it please. I'm using linux/ raspberry pi. Thanks.

justez

  • Newbie
  • *
  • Posts: 2
    • View Profile
I am also interested in this script or similar, has anyone finally been able to do it?





wrybread

  • Full Member
  • ***
  • Posts: 71
    • View Profile
Re: Possible to make a screensaver that cycles through games? (solved, sort of)
« Reply #18 on: September 24, 2020, 03:26:49 PM »
Ak sorry, the forum wasn't notifying me of replies.

If anyone still wants it, email me at my username at gmail.

mrchrister

  • Newbie
  • *
  • Posts: 2
    • View Profile
I wrote a screensaver in ahk for anyone interested. Google how to download and install ahk for Windows if you haven't heard of it. It's easy to use.

Just add games to the list you'd like to see displayed. I posted my list at the bottom if you want to use that.

Copy mame64.exe to a new instance (in my case groovymame64_223.exe).
Don't point it to your main mame64.exe. Instead copy mame64.exe to a second instance in the same mame folder that you're only using for the screensaver. This is necessary because the script will otherwise close your mame games you are playing. It's a pretty simple script ;)

You also need to update the buttons that will close the screensaver and return to attract mode. In my case its
      1::
      2::
      1joy7::
      1joy8::
      2joy7::
      2joy8::

And don't forget to update the paths in the script and you are good to go.

One more thing: Time_to_start defines the screensaver to start after 5 minutes. For testing you should set it to something like 30000 (30s). Don't do anything below 10s or you might have trouble turning it off lol

Code: [Select]
#NoEnv
#Persistent

Time_to_start=400000

list =
(
2020bb
64street
88games
)



GroupAdd, screensaver, ahk_exe attract.exe
GroupAdd, screensaver, ahk_exe groovymame64_223.exe

SetTimer, MameRelaunch, %Time_to_start%
return

MameRelaunch:


if WinActive("ahk_group screensaver")
{
StringSplit, ListArray, list, `n`r
Process, Close, groovymame64_223.exe
sleep 500
random, selected, 1, %ListArray0%
check := ListArray%selected%
Run, C:\Games\Emulators\Groovymame\groovymame64_223.exe -sound none -inipath C:\Games\Emulators\Groovymame\ -homepath C:\Games\Emulators\Groovymame\ %check%
return

}


#IfWinActive, ahk_exe groovymame64_223.exe
{
1::
2::
1joy7::
1joy8::
2joy7::
2joy8::
Process, Close, attract.exe
Process,Close,groovymame64_223.exe
Run, c:\Games\AttractMode\attract.exe --config c:\games\attractmode
SetTimer, MameRelaunch, %Time_to_start%
return
}




Here is my complete list of games I have in the screensaver. It's almost all horizontal games and from my Top500

Code: [Select]
list =
(
2020bb
64street
88games
airbustr
alexkidd
aliens
aliensyn
alpham2
alpine
altbeast
androdun
aof3
aoh
aquarush
arabfgt
arabian
archrivl
armwar
astdelux
astorm
asurabus
athena
avengers
avsp
avspirit
baddudes
bakubaku
bangball
bangbead
batcir
battlera
bayroute
bchopper
berzerk
bigfight
bigkarnk
biomtoy
bionicc
bjourney
blazeon
blazstar
bldyror2
blitz
blitz
blkheart
blktiger
blockhl
blockout
bloodwar
bmaster
bnzabros
bombjack
bonkadv
boogwingu
bosco
brapboys
breakrev
bssoccer
bstars2
btoads
bubblem
bubbles
bublbob2
bublbobl
buckrog
bucky
burningf
cadash
captaven
captcomm
carket
cawing
cbaj
cbasebal
chinagat
choplift
chukatai
cloak
clshroad
cninja
cobracom
columns
commando
contra
cotton
cotton2
cottonbm
crimec
crimfght
crkdown
crospang
crysking
csclub
cshift
ctribe
cupfinal
cyberbal
cyberlip
cybots
daraku
darius
darius2
dariusg
dbreed
ddragon
ddragon2
ddsom
ddtod
deathsml
defender
demonwld
denjinmk
deroon
dharma
dino
dmnfrnt
doapp
dondokod
dowild
drgnbstr
drmario
dynagear
dynwar
ecofghtr
edf
edrandy
ehrgeiz
eightman
elevator
elvactr
emeralda
eprom
eswat
excitebk
extdwnhl
fantjour
fatfury3
fbfrenzy
ffight
fgtlayer
flamegun
flipshot
footchmp
ga2
gaia
gaiapols
ganryu
garou
gauntdl
gauntleg
gauntlet
gaxeduel
gberet
gdarius
gdarius2
gforce2
ghostb
ghostlop
ghouls
gigawing
gng
goldnaxe
gradius
gradius3
gradius4
gratia
grdians
growl
gtmr
gundamex
gunforc2
gunforce
hattrick
hcastle
hellfire
hharry
hook
htchctch
hvysmsh
hyperath
hyperath
hyprduel
ikari3
indytemp
inthunt
jjsquawk
joemacr
jojo
jojo
jojoban
joust
joyjoy
junglek
junofrst
karnov
kbash
keith
kicker
kidniki
kingofb
kinst
kinst
kinst2
kinst2
kizuna
klax
knights
kod
kof2000
kof96
kof98
kov
kov2
landmakr
lastbld2
lbowling
ldrun
legendoh
lightbr
liquidk
locomotn
lresort
mace
mace
machbrkr
macross2
madgear
magdrop3
magerror
maglord
mario
martmast
marvland
matrim
mcatadv
megaman2
mercs
metalb
metamrph
metmqstr
miexchng
mk2
mmatrix
momoko
moomesa
motos
mpatrol
mrdrillr
msgogo
msh
mshvsf
mslug
mslug2
mslug3
mslug4
mslug5
mslugx
msword
mtlchamp
mtrap
mtwins
mushitam
mutnat
mvsc
mwalk
mysticri
mystwarr
nagano98
nagano98
nam1975
narc
nbahangt
nbajam
nbbatman
ncommand
nemesis
nemo
neodrift
ninjak
nitd
nslasher
nspirit
nwarr
ohmygod
openice
ordyne
orlegend
oscar
osman
outfxies
outzone
overtop
p47
p47aces
pacland
parodius
pblbeach
pbobble2
pbobble4
penbros
pepper2
pgm
pgoal
pigout
pigskin
pktgaldx
pkunwar
plotting
plsmaswd
popeye
pow
prehisle
primrage
progear
pulirula
pulstar
punisher
punkshot
pururun
puyopuy2
puzzledp
puzzli2
puzzloop
pwrgoal
pzloop2
qix
rallyx
rambo3
rampage
rastan
raystorm
rbff2
rbtapper
recalh
ringdest
ringking
riotcity
riskchal
rmpgwt
roboarmy
robocop
robocop2
robotron
rodland
rohgau
rollerg
roms
rotd
rsgun
rthun2
rthunder
rtype
rtype2
rtypeleo
rungun
rushhero
rvschool
sabotenb
sailormn
salamand
salmndr2
samsh5sp
samsho2
samsho3
scontra
secretag
sengoku
sengoku3
senkyu
sexyparo
sf2ce
sfa2
sfa3
sfex2p
sfexa
sfiii2n
sfiii3n
sfiiin
sgemf
shadfrce
sharrier
shdancer
shimpact
shinobi
shocktr2
shocktro
sidearms
silentd
silkroad
simpbowl
simpsons
skykid
slammast
slapshot
snowbro2
snowbros
socbrawl
sokyugrt
soldivid
sonicwi2
soulclbr
spang
spdodgeb
speedspn
spelunkr
spf2t
spidman
spinmast
splatter
ssf2t
ssideki3
ssriders
stakwin2
stdragon
stonebal
strahl
stratof
strider
stvbios
suprmrio
suratk
svc
tapper
tbowl
tbyahhoo
teddybb
tehkanwc
tekken3
tektagt
tengai
terraf
tetrisp2
tgm2
theroes
thndrx2
thndzone
thoop
thunderx
tigeroad
timber
tmnt
tmnt2
tmnt22pu
tnzs
toki
tokkae
tophuntr
trackfld
trojan
ts2
tumblep
turfmast
twinspri
uccops
ultennis
umk3
unsquad
uopoko
vamphalf
vball
vendetta
vf
vigilant
viostorm
vsav
wakuwak7
wardner
warriorb
waterski
watrball
wb3
wbml
wboy
wg3dh
whp
willow
winspike
wiz
wizdfire
wjammers
wof
wow
wrally
wwfmania
wwfwfest
xevi3dg
xexex
xmcota
xmen
xmultipl
xmvsf
xsleena
zerowing
zookeep
)

« Last Edit: October 05, 2020, 09:09:42 PM by mrchrister »