Chapter navigation improvements #244

Merged
MapAnon merged 107 commits from Iggy/SnootGame:master into master 2024-10-01 21:05:06 +00:00
Contributor

Went into full 'tism mode and rewrote the way the game handles chapter navigation.

General and ending chapters labels are now stored into global string lists.

Instead of manually calling each chapter as the game previously did, I wrote some Python functions to handle the logic, similar as looping through lists.

  1. The function 'next_story_chapter' is called once a chapter ends, which handles call logic.
  2. Once it has gone through every general chapter, it calculates the ending and navigates accordingly.
  3. Ending chapters are now stored in the 'ending_routes' dictionary.
  4. Several new global variables have been defined for the functions to work, and to track the game's current position.

A new tool for watching global variables has been added to make testing easier.

  • It can only be enabled if config.developer is set to True.
  • All new functions are located in the storyline.rpy file.

Only noticeable bug I've encountered so far when testing, was that words containing the letters 'ft' such as 'after' or 'left' are shown with a weird russian symbol as shown in the picture attached.

Finally, starting from RenPy version 8.1 onwards, there is a new way of playing movies. I've modified it in chapter 5, where the fang tail movie plays, to make it work.

All testing for the game has been done on RenPy's latest version as of making this PR (8.2.3).

_Went into full 'tism mode and rewrote the way the game handles chapter navigation._ ### General and ending chapters labels are now stored into global string lists. ### Instead of manually calling each chapter as the game previously did, I wrote some Python functions to handle the logic, similar as looping through lists. 1. The function 'next_story_chapter' is called once a chapter ends, which handles call logic. 2. Once it has gone through every general chapter, it calculates the ending and navigates accordingly. 3. Ending chapters are now stored in the 'ending_routes' dictionary. 4. Several new global variables have been defined for the functions to work, and to track the game's current position. ### A new tool for watching global variables has been added to make testing easier. - It can only be enabled if config.developer is set to True. - All new functions are located in the storyline.rpy file. ### _Only noticeable bug I've encountered so far when testing, was that words containing the letters 'ft' such as 'after' or 'left' are shown with a weird russian symbol as shown in the picture attached._ ### Finally, starting from RenPy version 8.1 onwards, there is a new way of playing movies. I've modified it in chapter 5, where the fang tail movie plays, to make it work. ### All testing for the game has been done on RenPy's latest version as of making this PR (8.2.3).
236 KiB
Iggy added 18 commits 2024-08-17 17:43:22 +00:00
Iggy changed title from WIP: Chapter navigation improvements to Chapter navigation improvements 2024-08-17 17:44:00 +00:00
MapAnon was assigned by nutbuster 2024-08-17 23:14:06 +00:00
nutbuster requested review from MapAnon 2024-08-17 23:14:30 +00:00
MapAnon requested changes 2024-08-18 03:44:01 +00:00
Dismissed
MapAnon left a comment
Member

This rewrite isn't very necessary on it's own, however it makes perfect sense if a chapter select could be implemented, and one that's more sane than Wani's. See if you can implement it.

I think this set up with needing a separation of a 'next chapter' and 'next ending chapter' is a bit convoluted. A simpler way of thinking this is the game will always know there is a set of general chapters to start with, but it will only know the rest of the chapters if we decide on an ending.

An array of chapters and an index for where we are in the story is already perfectly intuitive to understand, so if we append to this array when an ending is determined, then there's no need to track a different set of variables. The logic for determining what chapters to go to can be handled entirely by next_story_chapter() if we check the current ending when needed.

Speaking of, I'd recommend putting the watched variables and anything else chapter related into initstats() so long-term story vars can be organized there.

Aside from chapter code, if you're testing on the latest renpy version, please test it on the build system we use, Woodpecker, if you want your changes to be reflected properly. It's config file is in the root of the project (.woodpecker.yml), and controls the version of renpy and renkit. Since both are currently using outdated versions, refer to Wani's more updated config file and the updated renconstruct.toml file to update them. If they turn out bloated, it may be related to this issue.

Additionally if you want to fix the font issue, just copy the font file from Wani. A few other people had forks to fix it separately, but you'd be the first to implement it in a PR.

This rewrite isn't very necessary on it's own, however it makes perfect sense if a **_chapter select_** could be implemented, and one that's more sane than Wani's. See if you can implement it. I think this set up with needing a separation of a 'next chapter' and 'next ending chapter' is a bit convoluted. A simpler way of thinking this is the game will always know there is a set of general chapters to start with, but it will only know the rest of the chapters if we decide on an ending. An array of chapters and an index for where we are in the story is already perfectly intuitive to understand, so if we append to this array when an ending is determined, then there's no need to track a different set of variables. The logic for determining what chapters to go to can be handled entirely by next_story_chapter() if we check the current ending when needed. Speaking of, I'd recommend putting the watched variables and anything else chapter related into initstats() so long-term story vars can be organized there. Aside from chapter code, if you're testing on the latest renpy version, please test it on the build system we use, Woodpecker, if you want your changes to be reflected properly. It's config file is in the root of the project (.woodpecker.yml), and controls the version of renpy and renkit. Since both are currently using outdated versions, refer to Wani's more updated config file and the updated renconstruct.toml file to update them. If they turn out bloated, [it may be related to this issue.](https://git.cavemanon.xyz/Cavemanon/SnootGame/issues/239) Additionally if you want to fix the font issue, just copy the font file from Wani. A few other people had forks to fix it separately, but you'd be the first to implement it in a PR.
game/options.rpy Outdated
@@ -133,6 +133,11 @@ default preferences.text_cps = 50
default preferences.afm_time = 15
init -999 python:
Member

Is this a leftover from debugging? Remove if so.

Is this a leftover from debugging? Remove if so.
@@ -55,0 +95,4 @@
debug_story_variables(True, True)
# label storyline:
Member

If these commented out code bits truly aren't needed (as in, they cause problems or saves work fine without them), remove them wholesale.

If these commented out code bits truly aren't needed (as in, they cause problems or saves work fine without them), remove them wholesale.
game/utility.rpy Outdated
@@ -20,3 +18,1 @@
return(2) # Doomer
else:
return(1) # Shooter
# label get_ending:
Member

Ditto for these

Ditto for these
MapAnon marked this conversation as resolved
Author
Contributor

Yes, you are perfectly right. At first I thought about only using the same next_story_chapter function to handle all chapter navigation, including the endings but couldn't find the proper way of doing so.
By appending the chapters from the ending dictionary once the ending has been locked we manage to simplify things by a lot.

About the chapter selection tool, I have one implemented in the project I'm currently working on. Gonna try implementing it here when I can. Should this only be usable if debug mode is enabled, no?

Thank you for your input.

Yes, you are perfectly right. At first I thought about only using the same **_next_story_chapter_** function to handle all chapter navigation, including the endings but couldn't find the proper way of doing so. By appending the chapters from the ending dictionary once the ending has been locked we manage to simplify things by a lot. About the chapter selection tool, I have one implemented in the project I'm currently working on. Gonna try implementing it here when I can. Should this only be usable if debug mode is enabled, no? Thank you for your input.
Member

Just have it as Wani does, still available to the end-user but disabled by default while not in dev mode.

Just have it as Wani does, still available to the end-user but disabled by default while not in dev mode.
Iggy changed title from Chapter navigation improvements to WIP: Chapter navigation improvements 2024-08-19 21:25:27 +00:00
Iggy added 12 commits 2024-08-19 21:31:58 +00:00
Iggy added 1 commit 2024-08-19 21:35:31 +00:00
Test change
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
b7da3f957e
Iggy added 20 commits 2024-08-23 21:00:58 +00:00
Iggy added 1 commit 2024-08-23 21:49:16 +00:00
Update Renpy versions in woodpecker.yml and reconstruct.toml
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
df967527e4
Iggy added 1 commit 2024-08-23 22:32:08 +00:00
Add tasks.patch
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
80bdae1d08
Iggy added 1 commit 2024-08-23 22:50:49 +00:00
Upgrade Renkit version to 4.4.0
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
351e433504
Iggy added 1 commit 2024-08-23 22:57:29 +00:00
Update Renkit url
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
a75d26de8d
Iggy added 1 commit 2024-08-23 23:15:36 +00:00
Change tar compression option
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
dd6da86a8c
Iggy added 1 commit 2024-08-24 00:06:34 +00:00
Update build commands
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
84f6d467dd
Iggy added 1 commit 2024-08-24 00:26:35 +00:00
Downgrade Renkit version
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
b048e9c32a
Iggy added 1 commit 2024-08-24 00:35:36 +00:00
Remove tasks.clean
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
a04c4e6912
Iggy added 1 commit 2024-08-24 00:43:07 +00:00
Remove tasks.notarize
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
c020847800
Iggy added 1 commit 2024-08-24 00:56:09 +00:00
Enable tasks.keystore
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
ae7454506e
Iggy added 1 commit 2024-08-24 13:57:00 +00:00
Remove tasks.convert_images
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
c06e73743a
Upgrade Renkit version
Iggy added 1 commit 2024-08-24 14:22:53 +00:00
Delete android from woodpecker.yml
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
002e2b6a13
Iggy added 1 commit 2024-08-24 14:40:35 +00:00
Add keystore keys from Wani
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
9ef954bd9f
Iggy added 1 commit 2024-08-24 18:35:30 +00:00
Add missing files to fix Woodpecker build
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
50b64f170e
Iggy added 6 commits 2024-08-24 18:58:10 +00:00
Iggy added 1 commit 2024-08-24 22:04:23 +00:00
Modify cache directory
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
01135c64b9
Iggy added 1 commit 2024-08-24 22:19:46 +00:00
delete task_dir
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
05b0525a3d
Iggy added 1 commit 2024-08-24 22:40:52 +00:00
Remove initial dot from android.json
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
8dd717abeb
Author
Contributor

Implementation of the chapter selection tool and of the suggested improvements is done.
I've also updated woodpecker.yml and renconstruct.toml to handle new Renpy versions. However, I'm stuck with the woodpecker build error shown in the image. Any ideas on how to fix it?

Implementation of the chapter selection tool and of the suggested improvements is done. I've also updated woodpecker.yml and renconstruct.toml to handle new Renpy versions. However, I'm stuck with the woodpecker build error shown in the image. Any ideas on how to fix it?
MichaelYick was assigned by MapAnon 2024-08-24 23:29:32 +00:00
Owner

/tmp/renkit-x86_64-unknown-linux-gnu/renconstruct build "." dist/

I think you forgot the -c "renconstruct.toml"

I tried it and it complained the .toml file was broken so im sure thats also a problem

`/tmp/renkit-x86_64-unknown-linux-gnu/renconstruct build "." dist/` I think you forgot the `-c "renconstruct.toml"` I tried it and it complained the .toml file was broken so im sure thats also a problem
Iggy added 1 commit 2024-08-25 01:20:41 +00:00
Update renconstruct dir command
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
ac1c51543e
Iggy added 1 commit 2024-08-26 00:12:34 +00:00
Moar possible fixes
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
9078bb8aa1
Iggy added 1 commit 2024-08-26 00:43:17 +00:00
Last try
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
32894af0af
Iggy added 1 commit 2024-08-26 00:52:30 +00:00
Enable keystore task
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
62ffab3bed
Iggy added 14 commits 2024-08-26 20:42:07 +00:00
Author
Contributor

Pipeline is fixed. Take a look now.

Pipeline is fixed. Take a look now.
Iggy requested review from MapAnon 2024-08-26 22:46:20 +00:00
MapAnon reviewed 2024-08-28 22:03:48 +00:00
@@ -199,0 +209,4 @@
build.classify('android.keystore.original', None)
build.classify('*dist/*', None)
build.classify('game/dev/**', None)
Member

We don't need these 3 classifiers since we don't use them.

We don't need these 3 classifiers since we don't use them.
Author
Contributor

Done.

Done.
MapAnon marked this conversation as resolved
Iggy added 1 commit 2024-08-29 17:11:49 +00:00
Remove unused build.classify
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
dcff088d11
Iggy added 1 commit 2024-08-29 17:12:14 +00:00
fix commit
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
76e61ee78e
MapAnon requested changes 2024-08-29 19:07:33 +00:00
Dismissed
MapAnon left a comment
Member

Sorry, I meant to continue on with a review but I got sidetracked.

No chapter selection for the ending chapters? Please put them in.

I'm iffy about using a function to increment scores. If lock_scores is only used in chapter selecting, then alternatively it could instead store the ending to lock to and have any functions that calculate score to return the designated ending, i.e get_ending or otherwise (and make sure this is noted by a comment). This removes the need for an abstraction so adding to score remains as simple as fangscore += 1

With that info you can easily make the chapter select only display chapters of a designated ending to make things concise.

Otherwise, this all looks fine. I've only tested up to the ending branch-off point for anything that bugs out because of the engine update, but I'll get the rest in the next day or so.

Sorry, I meant to continue on with a review but I got sidetracked. No chapter selection for the ending chapters? Please put them in. I'm iffy about using a function to increment scores. If `lock_scores` is only used in chapter selecting, then alternatively it could instead store the ending to lock to and have any functions that calculate score to return the designated ending, i.e `get_ending` or otherwise (and make sure this is noted by a comment). This removes the need for an abstraction so adding to score remains as simple as `fangscore += 1` With that info you can easily make the chapter select only display chapters of a designated ending to make things concise. Otherwise, this all looks fine. I've only tested up to the ending branch-off point for anything that bugs out because of the engine update, but I'll get the rest in the next day or so.
Iggy added 1 commit 2024-08-29 21:10:21 +00:00
Remove lock_scores logic and point-increasing functions
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
908d8f62f7
Legalo reviewed 2024-08-30 02:11:27 +00:00
@@ -12,3 +1,1 @@
cert_file = "certificates/developerID_application.cer" # the path to the Apple-generated certificate file generated during the provisioning process
app_store_key_file = "certificates/app-store-key.json" # the path to the combined App Store key file generated during the provisioning process
json_bundle_file = "certificates/renotize.json" # the path to the combined certificate file. replaces the key, cert and app store files above
[tasks.patch]
Member

Why did you enable patching?

Why did you enable patching?
Author
Contributor

This was a leftover from when I was trying to fix the Woodpecker pipeline. It's now removed.

This was a leftover from when I was trying to fix the Woodpecker pipeline. It's now removed.
Legalo requested changes 2024-08-30 02:30:42 +00:00
Dismissed
@@ -55,0 +17,4 @@
# Add check "is_end_reached" to have this if statement be executed only once when finishing the general chapters
if not is_end_reached and is_end_of_chapters():
process_ending()
Member

This doesn't need to be a function since it's only called here, just move the function's code to here and if it needs further clarification add a comment

This doesn't need to be a function since it's only called here, just move the function's code to here and if it needs further clarification add a comment
Author
Contributor

Done.

Done.
@@ -55,0 +34,4 @@
def process_ending():
global ending_route_number
ending_route_number = get_ending()
Member

You are abusing global variables to the point that most of the code is unreadable, this is only a specific example but in this case it would be 100x better if instead of doing

ending_route_number = get_ending()
add_ending_chapters()
update_ending_variables()

You did

ending_route_number = get_ending()
add_ending_chapters(ending_route_number)
update_ending_variables()

That way you communicate what a function does beyond of what it's called and where it's getting it's information without having to investigate and jump around different functions seeing which one updates a specific variable.

You are abusing global variables to the point that most of the code is unreadable, this is only a specific example but in this case it would be 100x better if instead of doing ```py ending_route_number = get_ending() add_ending_chapters() update_ending_variables() ``` You did ```py ending_route_number = get_ending() add_ending_chapters(ending_route_number) update_ending_variables() ``` That way you communicate what a function does beyond of what it's called and where it's getting it's information without having to investigate and jump around different functions seeing which one updates a specific variable.
Author
Contributor

Functions are now (I hope) easier to read. Thank you for your advice!

Functions are now (I hope) easier to read. Thank you for your advice!
Iggy added 1 commit 2024-08-30 21:14:30 +00:00
Remove unused globals
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
7865a0164c
Author
Contributor

Sorry, I meant to continue on with a review but I got sidetracked.

No chapter selection for the ending chapters? Please put them in.

I'm iffy about using a function to increment scores. If lock_scores is only used in chapter selecting, then alternatively it could instead store the ending to lock to and have any functions that calculate score to return the designated ending, i.e get_ending or otherwise (and make sure this is noted by a comment). This removes the need for an abstraction so adding to score remains as simple as fangscore += 1

With that info you can easily make the chapter select only display chapters of a designated ending to make things concise.

Otherwise, this all looks fine. I've only tested up to the ending branch-off point for anything that bugs out because of the engine update, but I'll get the rest in the next day or so.

Originally, I wanted to use the functions to avoid unnecessary increases in points. I realize that it won't matter if points keep increasing, since the ending is already being set with the tool.

Nice to have a different opinion on these things.

> Sorry, I meant to continue on with a review but I got sidetracked. > > No chapter selection for the ending chapters? Please put them in. > > I'm iffy about using a function to increment scores. If `lock_scores` is only used in chapter selecting, then alternatively it could instead store the ending to lock to and have any functions that calculate score to return the designated ending, i.e `get_ending` or otherwise (and make sure this is noted by a comment). This removes the need for an abstraction so adding to score remains as simple as `fangscore += 1` > > With that info you can easily make the chapter select only display chapters of a designated ending to make things concise. > > Otherwise, this all looks fine. I've only tested up to the ending branch-off point for anything that bugs out because of the engine update, but I'll get the rest in the next day or so. Originally, I wanted to use the functions to avoid unnecessary increases in points. I realize that it won't matter if points keep increasing, since the ending is already being set with the tool. Nice to have a different opinion on these things.
Iggy added 1 commit 2024-08-30 23:43:28 +00:00
fix commit
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
4d3801dd3d
Iggy requested review from MapAnon 2024-09-06 23:51:59 +00:00
Iggy requested review from Legalo 2024-09-06 23:52:04 +00:00
Member

noting this down: completing ending 1 should close the game during normal play after credits

noting this down: `completing ending 1 should close the game during normal play after credits`
Iggy added 1 commit 2024-09-18 18:55:57 +00:00
Add exit game after ending 1
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
92ee2a56f1
Author
Contributor

noting this down: completing ending 1 should close the game during normal play after credits

Implemented in last commit.

> noting this down: `completing ending 1 should close the game during normal play after credits` Implemented in last commit.
MapAnon removed review request for Legalo 2024-10-01 20:59:02 +00:00
MapAnon approved these changes 2024-10-01 21:01:29 +00:00
MapAnon left a comment
Member

For the time being this is all seems good. I'm probably gonna revise this after the fact, but merging this needs to not stall.

For the time being this is all seems good. I'm probably gonna revise this after the fact, but merging this needs to not stall.
MapAnon changed title from WIP: Chapter navigation improvements to Chapter navigation improvements 2024-10-01 21:01:45 +00:00
Legalo approved these changes 2024-10-01 21:04:37 +00:00
MapAnon merged commit ee3f8b7152 into master 2024-10-01 21:05:06 +00:00
Sign in to join this conversation.
No Reviewers
No Label
5 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Cavemanon/SnootGame#244