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

Transcript crashes games online #1054

Closed
KVonGit opened this issue Oct 1, 2018 · 8 comments · Fixed by #1352
Closed

Transcript crashes games online #1054

KVonGit opened this issue Oct 1, 2018 · 8 comments · Fixed by #1352

Comments

@KVonGit
Copy link
Collaborator

KVonGit commented Oct 1, 2018

Enabling a transcript online crashes (freezes) the game.

I seem to remember writing code to handle online transcripts in a dialog popup, but it was long ago and I'm not positive my recollection is correct.

@KVonGit
Copy link
Collaborator Author

KVonGit commented Oct 14, 2018

This is the function that is missing when playing online:

// SaveTranscript added by KV to write/append to GAMENAME-transcript.html in Documents\Quest Transcripts
function SaveTranscript(data) {
    data = data + "<style>*{color:black !important;background:white !important;text-align:left !important}</style>";
    if (!webPlayer && transcriptString != '') { UIEvent("SaveTranscript", data); }
    transcriptString += data;
}

I added that to desktopplayer.js, but I'm pretty sure that I should have added it to WebPlayer\player.js as well.

@KVonGit
Copy link
Collaborator Author

KVonGit commented Sep 2, 2024

Transcript Redux

I have been working diligently for about two weeks to come up with the best overall solution for the transcript issues I introduced in Quest 5.8.0.


Known Issues

Online

When enabling the transcript online, the game completely crashes. This is because I added a SaveTranscript() function to Player\desktop.js, but I failed to add its online counterpart to WebPlayer\player.js.

Desktop

After enabling the transcript in the desktop player, the turn scripts all cease firing until the transcript is disabled.

Also, when recording a walkthrough while the transcript is enabled, each step recorded is the HTML output from each turn.

Both Desktop and Online

There is also "scrollback" functionality that was introduced in Quest 5.8.0.

The clearScreen() function was modified to hide all the text rather than deleting it when saveClearedText is true (which is the default). If saveClearedText is false, clearScreen() uses its old method (deleting all the cleared text).

So, by default, all that text is being saved and slowing the game down exponentially each turn.


All the Details Concerning This Update

saveClearedText in PlayerController\playercore.js is now set to false by default.


CoreTypes

game.notranscript

  • false by default
  • no transcript activity at all if set to true

game.ingametranscript

  • false by default
  • transcript will use scrollback functionality when true

game.writetranscripttofile

  • false by default
  • transcript will use JS SaveTranscript() to write to an HTML file in "Documents\Quest Transcripts" while the player has the transcript enabled while this is true

game.transcriptenabled

  • false by default
  • This gets set to true when the player enables the transcript. If game.notranscript is not true, this allows both writing to file and the in-game transcript, neither, or whichever is set to true

REQUIRED

Core InitInterface has a bit that sets JS gameName and transcriptName


Core HandleCommand modified to add player's command to transcript if game.echocommand is false


CoreFunctions ShowMenuResponse modified to add player's command to transcript if game.echocommand is false


CoreCommands view_transcript_cmd


CoreCommands transcript_on_cmd


CoreCommands transcript_off_cmd


CoreFunctions DisableTranscript()

  • Disables the transcript, sets game.transcriptenabled to false, JS transcriptEnabled to false, and JS saveClearedText to false

CoreFunctions KillTranscript()

  • Completely stops all transcript functionality. Sets game.nostranscript to true, game.ingametranscript to false, game.writetranscripttofile to false, JS writingTranscriptToFile to false, JS inGameTranscript to false, JS noTranscript to true, and runs DisableTranscript

CoreFunctions ClearHtmlTranscript

  • Clears any saved scrollback text.
  • JS.eval("saveClearedText = false; $('.clearedScreen').remove(); transcriptString = '';")

PlayerController\playercore.js addText()

  • calls SaveTranscript() if writingTranscriptToFile

PlayerController\playercore.js clearScreen()

  • hides all cleared text instead of deleting it when game.ingametranscript and saveClearedText are true

PlayerController\playercore.js showScrollback()

  • This will be the in-game transcript window when game.ingametranscript and inGameTranscript are true

Player\desktop.js SaveTranscript()

  • should do nothing if webPlayer
  • in desktop, writes to HTML file in "Documents\Quest Transcripts" if game.transcriptenabled and game.writetranscripttofile (and JS writingTranscriptToFile and transcriptEnabled)

WebPlayer\player.js SaveTranscript()

  • does nothing, just here to avoid errors online

PlayerController\playercore.js default booleans:

    var writingTranscriptToFile = false;
    var inGameTranscript = false;
    var transcriptEnabled = false;
    var noTranscript = false;

CoreEditorGame has an added checkbox for the transcript, and a tab if that box is checked


Player\PlayerHTML.vb has modified code to fix the issue with using the transcript name entered by the player when enabling the transcript


DEPRECATED

CoreCommands - UpdateTranscriptString() [gone]


game.transcriptstring string [gone]


game.savetranscript boolean [sort of replaced with game.ingametranscript]


JS - savingTranscript boolean [replaced with inGameTranscript and saveClearedText]


JS - transcriptString string [gone]


JS - replaceTranscriptString() [gone]


JS - showTranscript() [replaced by showScrollback()]


JS - printTranscriptDiv() [replaced by printScrollback()]


Comments

I tested this extensively, to the best of my ability. I found three or four forum threads concerning all the different issues during debugging and testing, and I made sure all those issues were addressed.

I ran the web player from Visual Studio to test everything out as well. Here is a PDF of the transcript: NewTranscriptTester1-transcript.pdf

NOTE: I could not actually test saving the game, but it seemed to make it all the way to end until it found that I was not logged into the site.

I also ran the web editor from VS, just to make sure the new Transcript editor controls looked okay.

I'll submit a pull request in the morning. (I would wait to post this, too, but I don't want to lose all this. It took much longer to write than I expected, haha.)

TextMisadventures added a commit to TextMisadventures/quest that referenced this issue Nov 25, 2024
- transcript
  - added missing function to player.js
  - changed desktop player file saving format from HTML to TXT
  - added localStorage functionality for the web player
  - removed in-game transcript viewing
  - automatically uses game name for transcript name when command bar is hidden

Closes textadventures#1054

---
- log
  - restored log window in the desktop player
  - removed ability to view the log in-game

Closes textadventures#1025

---
- AllRooms()
  - fixed by @Pertex

Closes textadventures#1202

---
- setBackground()
  - fixed by @ThePix

Closes textadventures#1052

---
- enter_verb
  - fix stolen from mrangel forum post

Closes textadventures#1121

---
- save command
  - now uses `saveGame()` when online
  - scrolls when printing saveGameResponse messages

Closes textadventures#1200

---
- DictionaryRemove
  - fixed typo

---
- update transcript.md doc

---

Tidy up language files

- remove code that "includes" EditorEnglish.aslx when English.aslx is already included

---
Addition submitted by @Pertex

Added option to use custom image in the location bar, complete with editor controls
@KVonGit
Copy link
Collaborator Author

KVonGit commented Dec 27, 2024

@alexwarren

I have questions concerning how to handle the transcript, or if it should just be removed.

I vote we remove it, with a message that it's been deprecated in response to any existing commands.

The best I can get it, it doesn't work as well as it could online, and I'm most definitely overlooking some issue or bug in the desktop versíon (and online) -- I always do. Plus, it uses JS when it should probably use the output buffer or something, which I know nothing about. It slows things down, even after I remove the bits that store the JS data. Simply writing to a file slows games down.

This is all my code, and I don't think it should have ever been added to Quest, in retrospect. Plus, it never worked properly in 5.8 to begin with. So, no one should miss it.

Anyone who wanted to add transcript functionality to their game would basically only need to modify addText and add two commands.


If you'd rather fix the issues, I am more than willing to submit changes. I would have a question or two for you before making any changes, though.

@alexwarren
Copy link
Contributor

If it never worked properly, that's a good argument for getting rid of it for now. For 5.9 at least. We can consider re-adding it for a future version.

@Pertex
Copy link
Collaborator

Pertex commented Dec 27, 2024

Really? Why? KV, I thought you have repaired the transcript? In my eye transcript was one of the most important features in 5.8 (ok, only in my eye). If we remove it now, it will be dead forever
What must be done to uses it without issues?

@KVonGit
Copy link
Collaborator Author

KVonGit commented Dec 27, 2024

Right now, in 5.8, it doesn't work at all online and never has. It will throw an error because I didn't add the JS function to a file that's accessible from the WebPlayer app.

The 5.8 desktop player saves the text properly (to my knowledge), but

  • it saves as HTML (we've since learned how to save as TXT)
  • I messed the code up in PlayerHTML.vb, and it doesn't use the file name entered by the player for the transcript file and uses the game name-transcript.html instead (we've also fixed this in the closed PR).

I got it working right in the desktop player after the recent changes, as far as I know. (Now that I think of it, I never tested a game with a YouTube video or anything beyond images.)

The WebPlayer app seems to save the transcripts to localStorage just as well as the desktop player saves to a file. The only thing I don't like is accessing those transcripts from localStorage. Plus, there's no central place to access those transcripts, and my code to view the list and all that is extremely rudimentary.

Also, the in-game transcript stuff in 5.8 is horrendous. I add to a string variable in JS each time text prints, and it slows everything down.

Not to mention the jQuery-UI pop-ups I use for viewing the in-game transcript (and in-game log). They cause problems if they were opened and closed while recording walkthroughs, and I've seen them mess up a saved game file when a player had the in-game log open when they saved progress. It broke the <output> HTML that gets saved, and we never could figure out why.

I also hadn't seen the reports created by ActiveLit, else I'd have just lobbied to add that functionality for all users instead of using any of this for the WebPlayer.

Anyway, if someone can come up with a solid way to open the transcript online without the pop-up blocker causing the first attempt to open to fail, I wouldn't be totally against keeping the transcript functionality intact, but I still think someone who knows how output buffers and all that works should have done all this. This sends text from Quest to JS, then back to Quest, then Quest writes to the file.

Also note, Pertex: you can just keep the existing transcript code in your playercore.js file. Just modify it so it always records without needing the commands in other people's games.

And note to Alex: Pertex has been using the transcript all the time since we fixed it. In the web player and in the desktop player, and he hasn't found any issues lately. I've learned from 5.8 that I am terrible at testing, and am therefore nervous about this code (because it had the most problems).

So, I'll defer to you two.

NOTE: If it does get removed, I think we'd need to leave the existing JS functions (and add the missing one for the WebPlayer), just to avoid errors in 5.8 games. I would think the JS functions should just exist and not actually do anything if we went this route.


In my eye transcript was one of the most important features in 5.8 (ok, only in my eye).

Pixie said the same thing, and I agree that Quest really needs the functionality. I just don't think my way is the best way to handle it. You have recently contributed a lot of code to this cause, though. If you think it's good now, we can submit a PR and let Alex review it. Unless he's already decided that it's best to remove it, of course.

@alexwarren
Copy link
Contributor

No, I defer to you two...

If you have a PR to fix it then please submit it, otherwise if it's broken in just the WebPlayer then we should disable it there.

@Pertex
Copy link
Collaborator

Pertex commented Dec 27, 2024

KV needs some sleep so I will talk to him later or tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants