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

[CR] Feature progression diary - "Dark diary" #52372

Merged
merged 30 commits into from
Dec 6, 2021

Conversation

LFKrause
Copy link
Contributor

@LFKrause LFKrause commented Oct 20, 2021

Hi I am a first-time contributor. I had some time at my hand and wanted to implement this feature I had in mind, as well as switch from c# to c++ and get use to this game code to help with contributions in the future. Therefore, feedback is appreciated.

Summary

Features "Adds progression diary"

Purpose of change

Its a in-game diary, that track the players progression between entries. The player can add an entry and write the diary for the character.
CDDA is a game that holds lots and lots of tales. This feature invites the player to write them down, remember them and share them with the community.

pasted_image004

pasted_image003

Describe the solution

This pull will
* Add diary.h/.cpp -> diary logic
* Add diary_ui.cpp -> diary UI logic
* Add string_editor_window.h/.cpp -> this class can be used to edit text in-game, its a multi line text editor. (I know, a pull request should just contain one new feature, I got carried away.)

The diary will do the following:
Once the UI is opened, the player can read all the entry. Add or delete a entry, export the diary to .txt and edit the text of an entry. Once a new entry is added, the progression will be saved and the difference in progression to the previous entry is shown.

  • Currently, the following progression is saved and compared:

    • stats
    • traits (Mutation)
    • Bionics
    • kills (NPC and monster)
    • Proficiencies
    • skills
    • quest
    • Spells
  • The player is asked on death to write the last entry and the diary is exported as .txt to memorial

  • The diary is serialised to a seperate .json file to keep the opportunity to open other players diarys later

other changes:

  • Add ACTION_DIARY to action.cpp/h
  • Add ACTION_DIARY
  • Addition to avatar.cpp/h
    • add value diary a_diary this is the players diary
    • add Methode diary* avatar::get_avatar_diary() that return a_diary, if there is non its will create a new one.
  • Addition to game.cpp
    • Add serialise & deserialise of avatar diary
    • Add ctxt.register_action("diary")
  • Addition to handle_action.cpp
    • Add ACTION_DIARY this will open the diary UI with the avatar a_diary
  • Addition to killtracker.h
    • I marked diary as frendclass. Because it needed access to private member of killtracker. This could be changed with get methods.

Future, development?

  • add default key bindings.
  • Add additional stats to track like achievements, follower
  • Ask the player, before sleeping to add an entry (make this togglable)
  • Add photos to a page

Future, Future, development?

  • to be able to find and read other players diarys in game,
    • some system to share them in the community
    • some system to find them in-game.

Describe alternatives you've considered

Testing

I tested on windows 10 x64.
Play a Character and make entrys, see if progression is saved (I used the debug menu to see if the progression and changes stored and displayed right.).
Write an entry.
Export the diary.
save and reload the game.
Die, and write the last entry.
Resized the game window.
Further testing on other systems may be required.

Additional context

Questions.
First Question
Just give me feedback. What do you think of this feature? Does it have a place in the core game if not could it be added as a mod and how?

Second Question
What do you think about the way the diary is integrated in the game?
At the moment its a value of avatar. Alternative (a more narrative implementation) we could add a CBM that is used for this purpose. Like a chip for the hat called "personalised log" or something like that. But for that I would need input on how to implement it this way. Another solution would be to implement it as an item, but I do not like this solution, because items can get lost or be destroyed.

Third Question.
What are additional values to track? What would you like to see added and tracked in the changes? At the moment I think about, achievements and followers as well as to add photos to a page.

One addition:.
I am overwhelmed at the moment, I have this feature now but the pull request is a bit intimidating right now, so I hope I will do it the right way ;)

Known Issues.
string_editor_window:
I used fold_string() to convert the Text into multiple string to show them in the UI. But fold_string() to be more precise word_rewrap( strline, width, split ); cuts away spaces after a break. This can course issues in the editor. I may need to write a new fold_string() method thats stays the same character size as the input string to avoid this problem. Another bug I noticed is, that the courser is one of when there is a space in front of '\n' this may also be fixed with a new fold_string() method.

Lion Krause added 17 commits September 28, 2021 14:00
|Diary for the player, where the Character progression is stored|
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* Diary accessible in game
* Diary UI
* Export Diary
* Save progression in skills, kills, traits
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* Save progression in bionics
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* Page header Text
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* track proficentcies
* track stats
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* optimasation
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* map to save connect change to discription
* show discription for changes for profichentcy, traits, skills, bionics
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* track missions
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* track spells
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* Changes in skill tracking, just track level not Skilllevel
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* refactoring
* Export after Death, and entry question after death.
* serialize and deserialize in game save system
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* first version off editor window, to write entry
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* [wip]editor window, to write entry
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* [wip]editor window, to write entry
* the bug i cant fix.
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* refacture
* editor window as seperate script
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* refacture
* cleaning up the code
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* small UI change
|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
@BrettDong BrettDong added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` labels Oct 20, 2021
src/diary.h Outdated Show resolved Hide resolved
src/diary.h Outdated Show resolved Hide resolved
src/diary_ui.cpp Outdated Show resolved Hide resolved
src/diary_ui.cpp Outdated Show resolved Hide resolved
Co-authored-by: Zhilkin Serg <ZhilkinSerg@users.noreply.github.com>
@LFKrause
Copy link
Contributor Author

Tanks for the first feedback, I will continue with implementing the feedback and working on the failed checks. :)

@lgtm-com
Copy link

lgtm-com bot commented Oct 20, 2021

This pull request introduces 1 alert when merging 41e2cff into d7802dd - view on LGTM.com

new alerts:

  • 1 for Resource not released in destructor

|The stories told in CDDA are lost in time and after death the stories are all we have. It is a way to encourage creative writing in the game and to save the experience. Also, the diary can be exported as .txt to share the stories of the players with the community.|
* formatting
* fixed, errors shown by check
@lgtm-com
Copy link

lgtm-com bot commented Oct 22, 2021

This pull request introduces 1 alert when merging b1b50ad into 042913d - view on LGTM.com

new alerts:

  • 1 for Resource not released in destructor

src/diary.cpp Outdated Show resolved Hide resolved
src/diary.cpp Outdated Show resolved Hide resolved
src/diary.h Outdated Show resolved Hide resolved
src/diary.h Outdated Show resolved Hide resolved
src/diary.h Outdated Show resolved Hide resolved
src/diary.cpp Outdated Show resolved Hide resolved
src/diary.cpp Outdated Show resolved Hide resolved
src/diary.cpp Outdated Show resolved Hide resolved
@ZhilkinSerg
Copy link
Contributor

There are some minor issues with UI, but overall it is functional.

изображение

@Inglonias
Copy link
Contributor

Is the diary an item action or does it have a default keybinding? If it is an item action, what item is required?

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Dec 1, 2021
@LFKrause
Copy link
Contributor Author

LFKrause commented Dec 4, 2021

Is the diary an item action or does it have a default keybinding? If it is an item action, what item is required?

No, there is no item for it. You have to set the keybinding to open the window by yourself. Once the diary is open it has default keybindings.

@LFKrause
Copy link
Contributor Author

LFKrause commented Dec 4, 2021

May someone explain the "continuous-integration/appveyor/pr — AppVeyor build failed" error for me ?

@BrettDong
Copy link
Member

May someone explain the "continuous-integration/appveyor/pr — AppVeyor build failed" error for me ?

Upstream SDL audio library is broken by a recent update in up-upstream audio codec library, so this CI check is currently failing for everyone.

@ZhilkinSerg
Copy link
Contributor

You can ignore that failure - it should not prevent merging.

@ZhilkinSerg ZhilkinSerg merged commit d7a2cc0 into CleverRaven:master Dec 6, 2021
@I-am-Erk
Copy link
Member

I would very much like this interface and framework to be used to add readable books.

@rumly111
Copy link
Contributor

rumly111 commented Dec 12, 2021

Finally diaries are in CDDA ^_^ But this is not exactly how I imagined it. I thought e-ink readers will have this feature. Or, I don't know, paper+pen? Also, why the hassle with all the stats in the middle of the screen? It takes up valuable space.

Mostly I need a diary in-game not to write stories, but to keep a to-do list to remember things. You know, visit that place, get that stuff etc. I used to write them on paper, later I just alt-tabbed from the game to write in a .txt file, and lately I do the same in simplenote. But it breaks the game immersion :'-(

Anyway, can this feature be used as a to-do list? What about being able to use diaries if you have some electronic device like a laptop or e-ink reader?

Also, I doubt I'll use the "last message of death" feature, but maybe some people like such things.

@Inglonias
Copy link
Contributor

Judging by the reaction that this feature got when I told the subreddit about it, it looks like you have a hit on your hands, my friend! Very well done.

@LFKrause
Copy link
Contributor Author

Thank you for this post :) the reactions of the reddit community have made my day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants