How it works.
After starting, Excel will establish a connection with the m-server. Further actions are determined by the mx-formulas (m-commands). During operation, interactive communication is maintained between the sheet and its virtual double in the m-server. M-commands are executed in virtual cells of the double, but the result is displayed on the real sheet as well.
The client part of the code for this game is on the MS Excel sheet and consists of:
m-commands for random arranging ships on the playing field (21 cells)
m-command to enable on-click m-trigger on all 100 cells of the playing field (1), red font
m-trigger (1), red font, see excel-file mx_forma_test.xlsb # sheet 'sea-battle'
The server part of the code (vmx.ro) is installed ones, it not change depending on the task, is the same for IRIS, CACHE, 16, 8-bit encoding, any applications, games, reports. The server side creates and supports ‘virtual excel’ in M.
SEA BATTLE can be tested without your mx-server, just download MX and unzip to any folder on comp with MS Excel, then run mx-sea-battle.xlsb, press big top button (51) The empty square of 10 by 10 cells will appear. Ship will unhide on click, the last section will red. For restart press “R”.
To install mx-server IRIS (tested for Ubuntu 18.04.4 LTS) unzip https://github.com/mx-alex/MX to any folder /path/to/mymx, then:
$ docker run --name myiris -p 5264:5264 -p 52773:52773 -v /path/to/mymx:/mx -d store/intersystems/iris-community:2020.1.0.202.0
$ docker exec -it myiris iris session iris
On clients side (any comp with Windows & MS Excel) :
unzip MX to any folder
open mx_confi.xlsb, see sheet ‘mx-sea-battle’, row 59
change ‘localhost’ in row 59 to IP4-address of mx-server (example : 192.168.1.106)
save this workbook
Run mx-sea-battle.xlsb, then press button 59 to connect with IRIS.
To see what is hidden under bonnet on the client side, just click ‘design’ icon on the top panel.
Under Windows, mx-server and mx-client can be the same comp, row 59 as is.