Skip to content
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

Add logger device #39

Closed
byorgey opened this issue Sep 23, 2021 · 0 comments · Fixed by #128
Closed

Add logger device #39

byorgey opened this issue Sep 23, 2021 · 0 comments · Fixed by #128
Assignees
Labels
C-Low Hanging Fruit Ideal issue for new contributors. G-Design An issue having to do with game design. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. T-UI Involves the user interface.

Comments

@byorgey
Copy link
Member

byorgey commented Sep 23, 2021

We should add a new kind of device (a logger, recipe: 1 log) which allows logging messages via a log command (i.e. there will be a log capability, provided by a logger, and required to execute the log command). This will also be the mechanism by which uncaught exceptions are reported; on any robot without a logger, such uncaught exceptions will just be silently discarded. See this comment in Swarm.Game.Step.

This will require adding a message queue field to the Robot record type. We should also get rid of the global message queue in the GameState.

We'll have to rethink what the say command does---perhaps it should broadcast a message that will be added to the log of nearby robots?

@byorgey byorgey added C-Low Hanging Fruit Ideal issue for new contributors. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. T-UI Involves the user interface. G-Design An issue having to do with game design. labels Sep 23, 2021
@byorgey byorgey self-assigned this Sep 30, 2021
@mergify mergify bot closed this as completed in #128 Oct 8, 2021
mergify bot pushed a commit that referenced this issue Oct 8, 2021
…e logs (#128)

The original main goals of this PR are to (1) solve #36 , that is, make the bottom-left info area fully wrapped and scrollable; and (2) solve #40 , that is, persist the info in that bottom-left info area even when switching to other panels.  In order to address those I ended up making a rather large constellation of related changes, which in the end I hope work well with each other.  Eager to hear others' feedback either from looking at the code or just trying out the game with this PR.

- In order to make the bottom-left area scrollable, split it out into its own panel.  Now we can focus it and then use normal keybindings to scroll it.
- The bottom-left info panel now indicates whether it has additional content scrolled off the top or bottom.
- The bottom-left panel used to display a global list of log/error messages when the inventory was not focused.  So where will those messages be viewable now, if the information displayed in the bottom-left panel persists?  My answer: there is a special `logger` device (#39) which, when focused, now displays the log messages.
    - This means that logs are now per-robot instead of global.
    - The base starts with a `logger` installed.
    - A `log` command can be used to write to a logger.
    - Uncaught exceptions also now write to a logger (instead of using `say`), or are simply discarded if there is no `logger` device installed.
    - The first time a robot's inventory is viewed after a message has been appended to its log, the `logger` device will be automatically focused and the log scrolled all the way to the bottom to show the new entry.  This means that e.g. typing `move` at the REPL will immediately show an exception in the lower left.
- Add a `salvage` command, making it possible to access the log of a dead robot after the fact, once we implement #17 .

There are still a few issues to address which I think can be done in separate PRs:

- The global message log still exists, and the `say` command still appends to it, but there is no way to view it.  Obviously we need to do something with this --- either get rid of it, or figure out a sensible way to view it, etc.
- Exception messages should probably be reformatted to not include any newlines, now that we know they will be wrapped.

Closes #36.  Closes #40.  Closes #39.  Closes #21.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Low Hanging Fruit Ideal issue for new contributors. G-Design An issue having to do with game design. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. T-UI Involves the user interface.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant