-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init_game now runs server_bfs for instance maps with npcs or monsters #137
base: main
Are you sure you want to change the base?
init_game now runs server_bfs for instance maps with npcs or monsters #137
Conversation
17617fd
to
99d3319
Compare
for (const name in G.maps) { | ||
const gMap = G.maps[name]; | ||
if (gMap.ignore) { | ||
continue; | ||
} | ||
|
||
const hasNpcs = gMap.npcs && gMap.npcs.length > 0; | ||
const hasMonsters = gMap.monsters && gMap.monsters.length > 0; | ||
if (gMap.instance && (hasNpcs || hasMonsters)) { | ||
// running this is important for instances, so that npcs and monsters can navigate / move | ||
server_bfs(name); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see the full list of what this loop will run the bfs for, please! Can you edit the PR description with the info? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update the description when I'm on my computer, as far as I remember this run of bfs is only needed if precompute.js has not been run. But I'll verify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is a little different on my own branches where I've added more debug output but this part returns early if data has been precomputed in server_bfs
adventureland/node/server_functions.js
Lines 4042 to 4046 in f39039c
if ((precomputed && precomputed.version == G.version) || (precomputed && precomputed.smap_data)) { | |
smap_data[map] = precomputed.smap_data[map]; | |
amap_data[map] = precomputed.amap_data[map]; | |
return; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the description, I have additional debug statements in my branch for my server, I could include them in the PR as well if you think so. @Telokis feel free to mark this conversation as resolved if you think it is
99d3319
to
99107b4
Compare
This PR makes it easier to make new instances. Instead of hardcoding
server_bfs
for instances ininit_game
it will now dynamically acquire them from G.maps. and runserver_bfs
if there are npcs or monsters in the instance.This change was initially part of the bee dungeon branch i'm working on.
This is the console output from my ptr server with added debug, keep in mind
create_instance
inserver_functions.js
will also callserver_bfs
if precompute has not been run.log output from my change where i've added a console log for precomputed.