Sun damage tweaks

Feedback on past, current, and future development.
User avatar
akortunov
Posts: 899
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation

Re: Sun damage tweaks

Post by akortunov »

MaxCross wrote: 20 Jun 2020, 11:19 Is there any way to fix it without modifying any files except tickableeffect.cpp?
I suppose no since the CharacterController is responsible for the "idlestorm" animation, and it is not aware of your changes.
MaxCross
Posts: 9
Joined: 18 Jun 2020, 08:56
Gitlab profile: https://gitlab.com/MaxCross

Re: Sun damage tweaks

Post by MaxCross »

akortunov, thanks for the reply! I moved code responsible for eye covering into UpdateIdleStorm() in character.cpp. I don't really like that i have to check for sun damage effect, recalculate sun direction and raycast from head in character.cpp too, but, I guess, there's no better way.

By the way, I added ability to cover from sun with cloth! https://youtu.be/lNcsqr5DYdw
Now if I have some cloth/armour equped that replace some bodypart - I just don't raycast from that bodypart (with some additional tweaks, like, for example, with open helmet equped I apply partial damage to head, that also depends from angle between character direction and sun direction, so if i have open helmet equped, i can simply turn away from sun to don't take damage).

And... I guess that all I wanted to change in sun damage effect for now. Maybe after few days I create my own fork of openmw, upload changes to that fork as merge request and post a link here. Until then, here's all the changes in the code I made so far:
Spoiler: Show
Also, I never worked with git projects as huge as openmw (and, probably, never done anything more complicated than git commit), so I don't know if merge requests is good way to organize code by different features/tweaks. So, if anyone can suggest a better way - I would appreciate it.
User avatar
silentthief
Posts: 456
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

Re: Sun damage tweaks

Post by silentthief »

I've been watching this thread of posts, and this is an awesome feature! I mean, the idea of cover from sun damage is a cool effect. I cannot wait until we have the functionality that MWSE does that would allow us to grab references of creatures/NPCs to script/code them to follow you outside of caves (wandering into a vampire coven would become MUCH more dangerous with this kind of thing). I am not a dev, I don't know if we can do this already - but still.

Watching this develop. Awesome work

ST
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: Sun damage tweaks

Post by CMAugust »

Just wanted to say this is a seriously cool feature, everything is exactly how you'd expect a vampire in the sunlight to behave. I love the idea of fleeing from shadow to shadow to avoid the yellow face. :)
User avatar
Capostrophic
Posts: 794
Joined: 22 Feb 2016, 20:32

Re: Sun damage tweaks

Post by Capostrophic »

The idea is alright, the implementation... is very, very, exceptionally inoptimal. :|
User avatar
AnyOldName3
Posts: 2668
Joined: 26 Nov 2015, 03:25

Re: Sun damage tweaks

Post by AnyOldName3 »

I'm not sure. Remember, he could have tried using occlusion queries against the shadow maps.

Actually, that would have been pretty fast if done optimally. It would just have had a frame or two of latency.
MaxCross
Posts: 9
Joined: 18 Jun 2020, 08:56
Gitlab profile: https://gitlab.com/MaxCross

Re: Sun damage tweaks

Post by MaxCross »

Spoiler: Show
UPD: Nevermind, I just needed to

Code: Select all

cinst ninja
UPD2: okay, now it build everything in 13 minutes, but ... Does it really need to notify ne about EVERY file inclusion? It looks like it outputing about 10000 lines just with:

Code: Select all

Примечание: включение файла:        deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/qrubberband.h
Примечание: включение файла:        deps\Qt\5.15.0\msvc2019_64\include\QtCore/qabstractitemmodel.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QHBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QLabel
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QSpacerItem
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QVBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QWizardPage
Примечание: включение файла:  C:\OpenMW_source\openmw\apps\wizard\existinginstallationpage.hpp
Примечание: включение файла:   deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\QWizardPage
Примечание: включение файла:   apps\wizard\ui_existinginstallationpage.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtCore/QVariant
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtGui/QIcon
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QApplication
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QHBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QLabel
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QListWidget
Примечание: включение файла:     C:\OpenMW_source\openmw\MSVC2019_64_Ninja\deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\qlistwidget.h
Примечание: включение файла:      deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/qlistview.h
Примечание: включение файла:       deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/qabstractitemview.h
Примечание: включение файла:        deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/qabstractscrollarea.h
Примечание: включение файла:        deps\Qt\5.15.0\msvc2019_64\include\QtCore/qitemselectionmodel.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QPushButton
Примечание: включение файла:     C:\OpenMW_source\openmw\MSVC2019_64_Ninja\deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\qpushbutton.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QSpacerItem
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QVBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QWizardPage
Примечание: включение файла:  C:\OpenMW_source\openmw\apps\wizard\installationtargetpage.hpp
Примечание: включение файла:   deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\QWizardPage
Примечание: включение файла:   apps\wizard\ui_installationtargetpage.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtCore/QVariant
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QApplication
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QHBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QLabel
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QLineEdit
Примечание: включение файла:     C:\OpenMW_source\openmw\MSVC2019_64_Ninja\deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\qlineedit.h
Примечание: включение файла:      deps\Qt\5.15.0\msvc2019_64\include\QtGui/qtextcursor.h
Примечание: включение файла:       deps\Qt\5.15.0\msvc2019_64\include\QtGui/qtextformat.h
Примечание: включение файла:        deps\Qt\5.15.0\msvc2019_64\include\QtGui/qpen.h
Примечание: включение файла:        deps\Qt\5.15.0\msvc2019_64\include\QtGui/qtextoption.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QPushButton
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QSpacerItem
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QVBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QWizardPage
Примечание: включение файла:  C:\OpenMW_source\openmw\apps\wizard\componentselectionpage.hpp
Примечание: включение файла:   deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\QWizardPage
Примечание: включение файла:   apps\wizard\ui_componentselectionpage.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtCore/QVariant
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QApplication
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QLabel
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QSpacerItem
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QVBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QWizardPage
Примечание: включение файла:    ..\.\apps/wizard/utils/componentlistwidget.hpp
Примечание: включение файла:     deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\QListWidget
Примечание: включение файла:  C:\OpenMW_source\openmw\apps\wizard\importpage.hpp
Примечание: включение файла:   deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\QWizardPage
Примечание: включение файла:   apps\wizard\ui_importpage.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtCore/QVariant
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QApplication
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QCheckBox
Примечание: включение файла:     C:\OpenMW_source\openmw\MSVC2019_64_Ninja\deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\qcheckbox.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QLabel
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QSpacerItem
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QVBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QWizardPage
Примечание: включение файла:  C:\OpenMW_source\openmw\apps\wizard\conclusionpage.hpp
Примечание: включение файла:   deps\Qt\5.15.0\msvc2019_64\include\QtWidgets\QWizardPage
Примечание: включение файла:   apps\wizard\ui_conclusionpage.h
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtCore/QVariant
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QApplication
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QLabel
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QVBoxLayout
Примечание: включение файла:    deps\Qt\5.15.0\msvc2019_64\include\QtWidgets/QWizardPage
[1227/1227] Linking CXX executable Release\openmw-wizard.exe
when I

Code: Select all

$ cmake --build . --config Release
UPD3: I just go to the file MSVC2019_64_Ninja/rules.ninja and remove EVERY "/showIncludes " in the file (just replace them (Ctrl + H) with ""). Now the output is much cleaner, and now everything builds in 6:44. I feel like it isn't the right way to do disable showIncludes, but at least it works.
User avatar
AnyOldName3
Posts: 2668
Joined: 26 Nov 2015, 03:25

Re: Sun damage tweaks

Post by AnyOldName3 »

It didn't show includes for me when I was setting it up. Maybe you've got an environment variable or something set that's making CMake be more verbose.
MaxCross
Posts: 9
Joined: 18 Jun 2020, 08:56
Gitlab profile: https://gitlab.com/MaxCross

Re: Sun damage tweaks

Post by MaxCross »

I forked openmw and created an merge request. Since, as I said, I don't think that this very speciffic feature will ever be merged into master branch of the official repository, target branch is in my fork also.
Just, if someone wants to have realistic sun damage in their version of openmw, maybe with this merge request it will be easier for them...
This is a temporary feature anyway - until the scripting system is added. And I really hope that when it is added, functions such as rendering raycast or getting the coordinates of the actor’s body parts will be available in it, so I don’t have to modify the engine source code only for realistic sun damage.
Capostrophic wrote: 21 Jun 2020, 23:51 The idea is alright, the implementation... is very, very, exceptionally inoptimal. :|
Well, I'll still be glad if someone suggests a more optimal way. As I said - this was the first time that I got into digging into the openmw source code. And, seriously, I sometimes felt that I wasn’t writing code, but solving some kind of CTF task or something. ("okay, this castRay() function looks like the version of raycast I need, but to call it I need a reference to the RenderingManager. Okay, there is an mRendering in the World, but it's private, and there isn't any getRenderingManager() in the World class... Why? Whatever, I'll just create my own castRay() function in the World class that calls that castRay() in that mRendering...". And something same about the way to get actor's body part position. And multiply that by 100). So yeah, maybe I'm doing it in not the most optimal way...
CMAugust wrote: 21 Jun 2020, 23:23 Just wanted to say this is a seriously cool feature, everything is exactly how you'd expect a vampire in the sunlight to behave. I love the idea of fleeing from shadow to shadow to avoid the yellow face. :)
silentthief wrote: 21 Jun 2020, 18:15 I've been watching this thread of posts, and this is an awesome feature!
Thanks for the feedback! It's really nice to read that.
AnyOldName3, akortunov - thanks again for help!
Post Reply