31 Commits

Author SHA1 Message Date
Aaron Suen
b37d01107f Do the distance check before db check
The distance check is less complex and will probably
filter out players a lot faster on a largeish server, so
it's a better check to run first.
2022-09-24 16:36:55 -04:00
Aaron Suen
a9e99f921e Deferrable discovery and witness optimization
- Split "discovery" into 2 stages: a check (to see if
  there is even anything new to discover) and a
  commit.
- When doing witness checks, check to see if there
  is anything to be discovered first, before doing the
  more expensive visibility checks.  If the player
  already knows all the discoveries, then we don't
  need to do any of the raycasts.

This should speed up especially pathological cases
like door catapulting, which can cause witnessing to
happen at multiple points, and causes major
slowdowns when multiple players are within the
distance range and facing the correct direction due
to tons of raycasts happening.
2022-09-24 12:23:24 -04:00
Aaron Suen
d872119fd7 Multiple press-craft fixes
- Fix door place-craft discovery not triggering due
  to wrong label name
- Fix many door witnesses not working because the door
  itself obstructs view of the action; "spread" the witness
  event to multiple positions and give the player credit
  if they can observe any part of the interacting nodes.
2022-03-29 09:06:15 -04:00
Aaron Suen
9c03cf35eb Log format cleanups 2022-01-19 23:30:56 -05:00
Aaron Suen
9d3acd6280 Periodically rescan for missed hint alerts
It seems that there may be some cases where hint alerts are not
detected immediately (e.g. due to changes in eligibility rules)
and thus not displayed until the player discovers some other
random thing, and then they get a bunch of alerts together.
Instead, just do some casual background scanning of all online
players and update hints as necessary continuously to catch
any missed cases.
2022-01-06 07:27:32 -05:00
Aaron Suen
8120a5c715 Re-rename hints/challenges to discovery
NodeCore is supposed to be a "player vs self" mental
challenge, neither tourism/spectacle, nor a "player vs
environment" conquest.  Players are supposed to find
their own goals, as well as applying the effort to
achieve them, and the nature of the goals is
purposefully as open-ended as possible, ideally with
no bias toward any kind of "completionism."

The name "Hints" implied some kind of assistance, and
thus was inappropriate.  The name "Challenges"
similarly implies an extrinsic source of motivation,
which the system is only marginally designed to
provide; especially, it helps new player gain some
momentum, but players are supposed to find their own
motivation eventually instead of chasing after
hint completion as a goal, especially since they will
miss the most compelling aspects of the game.

Somewhat experimentally, rename these once again
to "discovery"/"discoveries" and remove language that
suggests progress toward completion.  Add stronger
language suggesting that there is much more to
discover outside of this, hinting at emergent systems
as an example
2021-12-12 14:17:29 -05:00
Aaron Suen
17c5b2fda7 Leaching by group, fix settingtypes.txt 2021-12-11 11:36:52 -05:00
Aaron Suen
413641aa71 Fix delayed witness, finish known form use-cases 2021-11-29 23:10:22 -05:00
Aaron Suen
bba0a17abe Flexible craft discovery API
- Flexible discovery list format for discover and
  witness APIs
- Add "discover" key to recipes that contains a list
  of discoveries to give players so they can act like
  recipe groups and allow different recipes to
  complete hints

Recipe group system should be easier to setup for
hints than having to list all hints individually.  We
can use them especially in recipes that are loop
generated.
2021-11-29 21:08:34 -05:00
Aaron Suen
feca258e63 Rebrand "hints" as "challenges"
There seems to be a common misconception among
new players that the "hint" system is supposed to
help provide guidance when they're stuck, when what
they're really for is hinting that something exists and
challenging the player to find out how to access it.

Change the name of "hints" to "challenges" for all
text display purposes to try to clarify.
2021-11-24 21:26:34 -05:00
Aaron Suen
22ff675761 Fix hint alert state on re-granting interact
If a player loses interact after having discovered
things, then logs out, then later relogs in without
interact privs, it will not load the correct already
seen alert cache data on join.  This causes a
swarm of hint alerts to appear when interact
privs are restored.  Instead, detect when interact
is freshly re-granted and reset the cache at that
time automatically.
2021-08-19 21:35:46 -04:00
Aaron Suen
e7396e3aad Non-interact players cannot discover hints
Need to be granted interact privs before they can
start observing and discovering things and trigger
hint completion.  This should reduce the noise for
pure spectators, and not distract new players who
should be reading rules or something.
2021-08-16 18:41:27 -04:00
Aaron Suen
fb66115fb1 Order hint completion alerts chronologically
Instead of sorting hint completion alerts alphabetically
just so they'll be stable, sort them by order of actual
completion, so most recently completed hints are at
the bottom of the list, instead of inserted at randomish
places in the list.
2021-08-14 08:37:06 -04:00
Aaron Suen
b4315def27 Delayed witness on staring 2021-08-06 22:59:33 -04:00
Aaron Suen
5a9a18535f Hint completion by "staring", not "glancing"
Player needs to linger on the node for at least
long enough to reasonably read the description
before it counts as discovery.
2021-08-06 21:53:42 -04:00
Aaron Suen
3c41155550 Hint discovery by looktips
No touching necessary anymore
2021-08-06 21:46:27 -04:00
Aaron Suen
8a8bed8e5d Major settings cleanup
- Run all settings through a common API.
- Use modname prefix consistently for setting
  keys instead of "nodecore".
- Add automatic dumping of settingtypes.txt
  metadata for maintenance.
- Include initial settingtypes.txt for game for
  main menu use.
- Remove per-recipe tuning for pummel recipes,
  as there were way too many of those to be
  possibly useful and it was clogging up the
  settings menu.  Use tool rate adjustments to
  control it instead.
- Remove vestigial enable_damage setting.
2021-07-10 10:04:03 -04:00
Aaron Suen
c10e80ef87 Set name in mod.conf as demanded by 5.5+ 2021-03-01 20:10:27 -05:00
Aaron Suen
51b5aa8b94 Playerstep microoptimization
Avoid calling get_player_name too much
2021-03-01 18:58:34 -05:00
Aaron Suen
7cbd681d54 Fix issues with dig-by-mod
Crashes when a non-player digs a node, i.e.
having mod automation perform a dig_node()
2020-09-29 22:39:06 -04:00
Aaron Suen
fb6a4d7dd1 Hyrbid immediate/delayed witnessing
If we have line of sight to see the event happen
now, then discover it immediately, otherwise save
it for delayed witnessing on punch.
2020-09-26 20:17:31 -04:00
Aaron Suen
64e917fc95 New witnessing system
If a player is close enough to an event when it
happens (withing "likely hearing" distance) then if
they later punch the node then they can "collect"
the discovery.

The idea is that if a player hears the sound of
something happening, then they might go and
investigate and discover the thing they thought
they had left there isn't what's there anymore.

In retrospect I may want to combine this with a
limited form of the visual witnessing, just as there
may be events that a player is less likely to touch
in aftermath, or may not be practical to (e.g.
if what's left behind is air)
2020-09-26 17:52:09 -04:00
Aaron Suen
35186ec076 Hint for throwing an item really fast
Also expand player discover API to allow passing
multiple keys in a single call, saving db lookup/save
repetition.
2020-09-26 16:29:28 -04:00
Aaron Suen
6752808a81 Expand tote hint prereqs 2020-09-26 16:10:39 -04:00
Aaron Suen
3b864e5330 Fix and cache hint key expansion 2020-09-26 15:33:23 -04:00
Aaron Suen
77464e725a Reduce witness log noise 2020-09-26 15:04:34 -04:00
Aaron Suen
90e932bf9d Fix lode smelting hint 2020-09-26 14:19:12 -04:00
Aaron Suen
de87702497 Door crafting hints and witnessing 2020-09-11 01:08:20 -04:00
Aaron Suen
05d985c635 Expand hint system a bit
- Add reset command
- Reset alerts on resetting state
- Add option to hide hints
- Add option to add custom hint attrs
- Add option to pass in an already-fully-formed
  hint object and skip construction helpers
- Tidy up terrain hints a bit
2020-09-05 16:08:17 -04:00
Aaron Suen
db0bb65e57 Fix discovery API bugs
Crashes, broken stat names
2020-09-04 16:55:40 -04:00
Aaron Suen
edea123a1e Start on new unified Hint API
- Move hint handling down to API layer
- Simplify stat data; old nc_stats counting can
  be moved out to a separate mod.  We only
  need whether the player has seen or not.
- Invert inventory tab responsibility.
- Merge witness system in from crafting.

TODO:
- Redistribute hint registration responsibility
  to individual mods.
- Test external mod compat.
- Retire old nc_stats and nc_guide systems.
- Add a way to reset hints.
2020-09-04 16:28:27 -04:00