Commit graph

137 commits

Author SHA1 Message Date
Eric House
1181e908dc Add option to choose how rematch-game players will be ordered
When rematching, some users have a convention that e.g. lowest scoring
player in the "parent" game goes first. So allow that, providing the
choice on each rematch until a default has been chosen. Support
changing that default in a new prefs setting.

The place I chose to enforce the order was on the host as invitees are
registering and being assigned slots. But by then there's no longer
any connection to the game that was rematched, e.g. to use its
scores. So during the rematched game creation process I create and
store with the new game the necessary ordering information. For the
3-and-4 device case, it was also necessary to tweak the information
about other guests that the host sends guests (added during earlier
work on rematching.)
2024-01-04 09:50:24 -08:00
Eric House
55e36e10a7 new script to run many games per device
I need it to be much closer to Android....
2023-11-27 21:32:43 -08:00
Eric House
cae91d20cb Preliminary sketch of how cmd callbacks work 2023-08-14 08:11:01 -07:00
Eric House
53ce78e1ed initial changes toward a new test script
Android has lots of games on a single device. My current test has one
device per game. I'm hoping to fix that, and am starting with figuring
out how the script and "device" instances will communicate.
2023-08-08 12:09:47 -07:00
Eric House
8f1dfc9817 include rematching in test script
Add new script param setting a timeout before which games will be
rematched on finishing. Add new param to ncurses version telling it to
try to rematch when finishing. This introduces a new problem because
now there are multiple games per "device", and various log-grepping
stuff like listing the number of tiles in play or determing whether
device is finished all assumed one game. I addressed the latter by
adding a way to query the DB to see if all games are done, but that's
not quite right because the number of pending messages is increasing
after a game completes. Still, the testing is useful so I'm pushing
this.
2023-03-04 09:36:42 -08:00
Eric House
1e447e9d60 move TransportProcs into cGlobals to fix gtk crash 2022-11-18 11:09:22 -08:00
Eric House
4996d3fe89 improve comms address tracking (breaks android for now)
Remove legacy relay-inspired logic around comms addressing. Now when a
device creates a game it's required to provide its "self address," and
if it's a client, the address of the host (which it presumably got
through the invitation in response to which the game is being
created.) Then as registration messages come in from clients, the host
gathers their addresses as always.
2022-09-06 11:40:09 -07:00
Eric House
da23bfe23b add debug pref to not add mqtt to all games
I want it for testing that stuff like NBS (data SMS) works for more
than connecting. MQTT works so well nothing ever gets used once it's
there.
2022-05-09 15:10:15 -07:00
Eric House
afc3ff156e make game ask for dicts when needed
It's awkward for platform code to create a dictionary prior to opening a
game whose data contains the information about what dict to open. So add
a dutil method to fetch a dict, and call it from inside game opening
code. Makes linux code better at least.
2021-03-19 14:27:04 -07:00
Eric House
b8f359c3e5 add filtering to wordlist browser
Add a basic regular expression engine to the dictiter, and to the UI add
the ability to filter for "starts with", "contains" and "ends with",
which translate into ANDed RE_*, _*RE_* and _*RE, respectively (with
_ standing for blank/wildcard). The engine's tightly integrated with the
next/prevWord() functions for greatest possible speed, but unless
there's no pattern does slow things down a bit (especially when "ENDS
WITH" is used.) The full engine is not exposed (users can't provide raw
REs), and while the parser will accept nesting (e.g. ([AB]_*[CD]){2,5}
to mean words from 2-5 tiles long starting with A or B and ending with C
or D) the engine can't handle it. Which is why filtering for word length
is handled separately from REs (but also tightly integrated.)

Users can enter strings that don't map to tiles. They now get an
error. It made sense for the error alert to have a "Show tiles"
button, so there's now a dialog listing all the tiles in a wordlist,
something the browser has needed all along.
2020-08-05 09:47:44 -07:00
Eric House
f6d7eed84d add mqtt as a new transport
This is meant to replace the relay eventually, but for now it's a new
option, like BT or SMS, to be chosen. Protocol is handled in common/
code for the first time, meaning that linux and android interact without
the need to keep two platforms in sync. Linux uses lib-mosquitto, and
Android uses eclipse's Paho client (the generic java version, not the
one that uses four-year-old Service patterns and so crashes for SDK >=
26.)
2020-05-20 13:58:53 -07:00
Eric House
b7b7da795a remove use of thread->env mapper for drawing 2020-04-26 13:39:21 -07:00
Eric House
cfaa6849b2 pass env into dict-related methods
I was getting an occasional crash using a stale env to delete a dict's
resources because the dict was cacheing the env that created it. Dumb!
Using the thread->env mapping stuff worked, but that felt risky and so I
tried just passing it in. It's safe, and involves an amount of change I
can tolerate. So likely going that way.
2020-04-26 13:39:16 -07:00
Eric House
99df8806c3 wrap test-only feature in new compile-time flag 2020-04-24 13:33:40 -07:00
Eric House
4720ede1d7 fix so curses app can invite two players on one device
Turns out the host, when inviting a remote device, needs to know how
many players are on it (since more than one is supported and the script
currently generates that case.) So pass to --server devices an array,
one per remote -- but don't bother when all entries are "1";
2020-04-22 21:28:27 -07:00
Eric House
9d04b97ec8 add option to have robot words reversed
With reject-phonies set this will trigger the reject path.
Also init CommonPrefs in jni land since its makePhonyPct, left unitialized,
causes the robot to deliberately reverse every turn, firing an assertion that the
robot's moves are legal.
2020-04-22 21:26:55 -07:00
katianderic
38a4e494a4 make sms work via invitations too 2020-02-16 22:34:33 -08:00
katianderic
c7c1946793 use deviceID to invite via relay; make 3- and 4-device games work 2020-02-16 19:12:22 -08:00
katianderic
e5255f59eb add flag without which new game isn't created by default 2020-02-16 19:12:15 -08:00
Eric House
7076501710 cleanup: unify gtk&curses; make duplicate mode work 2020-02-02 22:10:20 -08:00
Eric House
97c0a58fff make gtk timer stuff work for both
It's glib-based, so why not. And curses implemention didn't work.
2020-02-02 19:03:10 -08:00
Eric House
cdcf63a0bf enable invite by relayID (and rematch from gtk side) 2020-01-31 17:34:41 -08:00
Eric House
3f5b9f5992 get "sms" games going on curses 2020-01-29 20:40:14 -08:00
Eric House
598be04bef make curses app more like the rest
Lots of changes adding a games-list view to the app from which you
create new games, open and delete existing ones, etc. There's still
plenty that's unimplemented, but it's already more useful for testing
and development. Which is the point.
2020-01-24 09:05:16 -08:00
Eric House
2d8ac995b7 add test case where (fake) sms messages never arrive 2018-07-14 15:43:42 -07:00
Eric House
1c58ab3d99 clean up linux db usage
For load/store I'll need more flexibility to store large values.
2018-07-06 08:04:53 -07:00
Eric House
2e9fbb8204 add common implementation of the SMS proto stuff
And use in linux client. Goal here is to reproduce then improve the
Android SMS pre- and post-processing stuff with a common/ implementation
that can be tested on linux and used wherever.
2018-07-05 21:40:56 -07:00
Eric House
87418d63d1 fix linux "sms" and modify script to test it
My linux sms hack used inotify and didn't check for messages that were
there when the app launched. Replace inotify with a simple glib periodic
timer. A bit of latency mimics SMS better anyway. Update test script to
support SMS, and add params to and otherwise fix linux client so
everything works.
2018-07-05 21:22:20 -07:00
Eric House
d4436b7706 Break part of util into dutil
Trying to separate what's game-specific from what can be app/device
specific (i.e. with a long lifespan, and available when a game isn't
open.)

Android will be broken after this commit and fixed after the next
2018-07-05 07:58:50 -07:00
Eric House
c68a067009 add option to not check moves except manually 2017-10-24 19:18:19 -07:00
Eric House
37162e0471 fix curses commit; refactor & cleanup 2017-10-21 12:11:26 -07:00
Eric House
6e5973c55b toward making tile picking work through rotations
Make face-up tile picker util method return void and add mechanism for
passing in selected tiles asynchronously, as has been done recently with
the rest of the once-blocking util callbacks. Works perfectly in the gtk
case. Likely crashes in curses (if picking face-up option is on.) In
java all the callbacks are there but rather than put up a UI we pretend
the user says "pick 'em for me" each time. Putting up a UI is next.
2017-03-09 20:36:14 -08:00
Eric House
5f12d1a03b assign faces to blanks asynchronously
Next step in converting util_ methods that required blocking: blank tile
assignment. Now post a query and add a method that the client code can
call when the user's decided. Include enough state (col, row, and
playerNum) so that it's probably pretty safe.
2017-02-18 19:16:32 -08:00
Eric House
ca6edcfc9a make trade and move confirm non-blocking
Probably breaks curses build, but for gtk and Android
turn move and trade confirmation into a two-step process, making
board_commitTurn() non-interactive when called with a second
parameter. The old blocking util methods now return void and it's up to
the client code to interact (on the main thread) then re-call
board_commitTurn() if appropriate.
2017-02-17 08:58:20 -08:00
Eric House
92029b2443 fix to build with CURSES_ONLY flag 2016-12-22 08:57:54 -08:00
Eric House
55d86d5ca2 don't try drawing snapshot in curses mode
Was crashing on game save. Add to main launchParams struct whether we're
in curses or gtk mode and only save snapshot in latter case.
2016-11-09 07:38:41 -08:00
Eric House
012b015f82 gtk: save games list window size and position 2016-08-05 18:31:17 -07:00
Eric House
0f33228155 get rematch working on linux, at least for two-device games. (Handling
the case where one of several guests wants to rematch is a hard
problem for later.) Requires passing old-style relayIDs (connname plus
device index) when devIDs aren't available, which they may not always
be.
2015-07-06 20:28:16 -07:00
Eric House
6d8f13df9e Merge remote-tracking branch 'sf/android_branch' into android_multi2
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2015-02-19 06:45:11 -08:00
Eric House
59bf77c871 fix occasional assert by increasing buffer size 2015-02-19 06:39:32 -08:00
Eric House
28bfa3c904 make forceChannel part of CurGameInfo rather than comms, since Android
needs to save it there on receipt of an invitation (doesn't create
full game with comms until later.)  Passes discon2 tests and seems to
work on a single Android device. (Haven't tested inviting on Android
yet.)
2014-12-29 07:39:28 -08:00
Eric House
897c4d5786 add param to force a client to connect to host requesting a particular
channel. Works well enough that relay test script works. Not yet
integrated for let alone tested on Android.
2014-12-21 17:40:00 -08:00
Eric House
b2b60d6c48 add commandline params that disable comms types on game creation so
relay not connecting initally can be tested.
2014-12-02 06:49:35 -08:00
Eric House
17bc0ab47c snapshot of work toward communicating when two addresses are in use.
An invitation works with relay and (fake) SMS on, and the invited
client connects successfully using both (the second to arrive being
correctly identified as a dupe.)  While the game can be played after,
only SMS messages are being received. And opening a saved game
crashes.
2014-11-05 07:41:20 -08:00
Eric House
fe4c7b52f2 snapshot: relay test script works with a second address type set
(though with its actual transport stubbed out).  Android doesn't even
compile.
2014-10-15 07:26:18 -07:00
Eric House
049cf284c5 toward getting direct-ip addressing working again: add a tab to the
connections dialog
2014-09-20 18:08:33 -07:00
Eric House
5500d36cde add and use dict manager that caches, using refcount, dicts across games. Allows multiple games to be opened, and open at the same time, with only one instance of a dict ever created. Works on linux; not used or tested yet on Android. 2014-03-09 19:12:21 -07:00
Eric House
35c12eb7bb add --ask-timeout param 2013-12-30 07:08:43 -08:00
Eric House
6d84dfea7e cleanup: remove '2' from function and struct names 2013-12-30 07:08:42 -08:00
Eric House
79fae43100 enable invite and commit buttons based on game state 2013-12-19 06:59:34 -08:00