Posts: 30
Threads: 3
Likes Received:
14 in 11 posts
Likes Given: 51
Joined: Jan 2024
Reputation:
5
02-20-2025, 07:23 AM
(This post was last modified: 02-20-2025, 08:16 AM by stevantosic.)
Hi,
I have just realised the power of being Observer user. But I do not see any player moving in the same game (from different browsers which I use).
Posts: 559
Threads: 40
Likes Received:
445 in 307 posts
Likes Given: 213
Joined: Aug 2023
Reputation:
20
02-20-2025, 01:25 PM
(This post was last modified: 02-20-2025, 02:16 PM by litdev.)
Hi, I'm away from home for a few days so can't test but is was working for me. Must be in the same game name, use mouse and wsad to move. Also use different browsers like Firefox, chrome, edge etc for different players inclyding Observer on same pc.
Posts: 559
Threads: 40
Likes Received:
445 in 307 posts
Likes Given: 213
Joined: Aug 2023
Reputation:
20
Just a comment on the Observer - I tested and it works for me. The reason to use different browser vendors is that the player name and other settings are stored using localStorage in JS.
This means that these settings are persistent within any tabs (or windows) for this browser vendor both during and in subsequent sessions. To have 2 or more players (with different names) on the same PC they musty be using different localStorage and this can only be achieved afaik using different vendor browsers.
So the options for users (includoing Observer) to join the same game (defined by setting the game setting) are:
a) different names on the same PC using different browser vendors
b) different names on different PCs on the same IP address using any or the same browser vendor
c) different IP addresses regardless of name or browser
Posts: 30
Threads: 3
Likes Received:
14 in 11 posts
Likes Given: 51
Joined: Jan 2024
Reputation:
5
02-24-2025, 02:15 PM
(This post was last modified: 02-24-2025, 02:41 PM by stevantosic.)
Hi,
I have been testing the whole system on my localhost network and found a "suspicious" lines of code in the index.html. In details:
updatePlayer(element) {
const now = new Date();
const then = new Date(element.lastActive);
const inactiveTime = (now - then) / 1000;
....
if (inactiveTime < 60) { player ... }
1. const now = new Date();
is CET time for me.
2. const then = new Date(element.lastActive);
is London Time which comes from Sqlite DB (also on my PC).
Hence, the value:
const inactiveTime = (now - then) / 1000;
is around 3600 (one hour). It means that player ... code is unreachable.
I tried an adhoc solution just for testing purposes which works well:
updatePlayer(element) {
const nowLocal = new Date();
const utcTime = nowLocal.getTime() + (nowLocal.getTimezoneOffset() * 60000);
const londonTime = new Date(utcTime);
const now = londonTime;
const then = new Date(element.lastActive);
...
Also, Tag option is chosen in settings.html.
Posts: 559
Threads: 40
Likes Received:
445 in 307 posts
Likes Given: 213
Joined: Aug 2023
Reputation:
20
02-24-2025, 03:18 PM
(This post was last modified: 02-24-2025, 03:28 PM by litdev.)
Good catch, I assumed that the php sqlite CURRENT_TIMESTAMP, php DateTime('now') and JS Date.Now() would all use the same default.
It seems CURRENT_TIMESTAMP is always UTC/GMT. I changed the other php call and the JS to also work in UTC/GMT.
I tested by changing my time zone and it worked I think.
Posts: 559
Threads: 40
Likes Received:
445 in 307 posts
Likes Given: 213
Joined: Aug 2023
Reputation:
20
This is great AB,
One useful agorithm would be to be able to plan a path from one cell to any other based on knowledge of the maze already obtained. Fairly tough, but this may be the end goal for any competetive robot 'game' challenge. The main difficulty I would see with this is deciding when to take a known route (maybe long) or experimement with unknown paths (that may be better). I am just thinking ahead, not suggesting this directly.