Posts

ResidualVM: Summary

Image
This is the summary of all the works I have done in Google Summer of Code 2018.

Overall Description: Improvement for the Stark engine used in ResidualVM for the support of the game The Longest Journey with two main focuses: menus and characters' shadows.

Pull Requests: Below are the main PR created and merged, ordered by the sequence of development. One may click the number of the PR to view it in detail on GitHub, which contains discussions between me and my mentor along the development.
#1415: Implementing the main menu.


#1417: Implementing the settings menu.


#1422: Implementing the save & load menu.

#1442: Implementing the video replay in the Diary menu.

#1443: Implementing the diary pages in the Diary menu.


#1450: Implementing the conversation log in the Diary menu.

#1456: Improving the debug console of the game.

#1467: Implementing the version info text and the Book of Secrets in the main menu.

#1468: Implementing a rough version of confirmation dialogs.

#1474: Implementing the keyb…

ResidualVM: Week 12

Image
With the help of my mentor, I followed the logic in the original game and finally, now The Longest Journey in ResidualVM shall have shadows that are calculated based on actual lights in the scene!
Below are some screenshots as demonstrations. For a better illustration, I temporarily rendered the shadow with solid green. As you can see, in location 39 00, the shadow of April will become longer and change its direction based on the lights.



As I have said in the previous blog, the game computes the shadow in a way that is not the same as the reality. Well, with the help of my mentor on reading the disassembly, the truth behind the screen was revealed. Honestly speaking, after knowing this, I really don't think I can figure it out just by observing the game itself.
So, in general, the game first calculated an overall direction from lights. The way to compute the directional vector from lights varies based on the type of the light, but basically, it is related to the distance between …

ResidualVM: Week 11

Image
Well, probably the shortest blog ever this time...
Long story short, I haven't figure out how the original game computes the shadows. There can be at most ten lights in a scene but there is only one shadow, and the way that shadow reacts with lights in the game is just, so strange...
Take this scene as an example. The green circle is the range denoted by the field maxShadowLength. It's too large, way larger than the true shadow length in the original game. There is only one light entry here, the lamp. You may imagine what will happen if you hold a lamp so close like this. The shadow should be extremely long and cast on the wall, right? That's not what happens in the original game. In fact, the lamp just moves the shadow a tiny bit against its direction.

So I can only draw the conclusion that the original game does not compute the shadow as the reality. I have tried many possible and "reasonable" implementations that came into my mind but none of them seemed to b…

ResidualVM: Week 10

Image
And I said: "Let there be shadows!" And there are shadows. Just, not good enough...
So, from this week till the end of GSoC I guess I'll be dealing with OpenGL. As a newbie to computer graphics, I would be lying if I say that I am not worried at all. I once believed that OpenGL hated me, it hated me so much that it didn't even want me to render a tessellated triangle on the screen. But that hard time is passed now and I am happy that I start to get along well with OpenGL, and it is kind enough to let me produce something physical this week.

Okay, shadows. Actually what I have done so far is based on my previous wrong assumption about shadows in The Longest Journey. In most of the scenes I have played, which is not many actually, characters have shadows that look like they are cast from above. The Longest Journey is a 2.5D game with 3D characters and 2D backgrounds, so, in my personal perspective as a CG newbie, it won't be that intuitive to perform a full shadow…

ResidualVM: Week 9

Image
So apparently this week is still about the keyboard bindings, mostly on the two things: the display of exit locations, and further improvement on the dialog panel.

In the original game, when the player presses the key X, all the exit locations of the current location will be pointed out with a symbol on it. To achieve this, I need to find which PATTable (the object that contains info of a clicking area) has the exit action, get its location, and render a symbol on it. It sounds easy, but the OO structure of the game engine warps it in a pretty complex way and I have to open interfaces in many classes. After doing so, I started to understand that why people are being more critical to OO design and FP is getting more popular. You really need to know how to balance things. Also, it took me some time to verify the exact location of the symbol to be drawn.


As for the dialog panel, I made a wrong assumption in my previous implementation: assuming that all dialog options will be only one lin…

ResidualVM: Week 8

Image
So, this week's focus is on the keyboard binding in The Longest Journey. In the original game, although you can freely use only the mouse to play through the game, you can still use the keyboard to do numerous things, such as opening menus, pausing the game and selecting options and items. It is like a combination and cooperation of things I have worked on previously.
Most of the bindings, like opening menus, is pretty easy, but some needs extra working and twisting, like directly choosing inventory items through pressing A and S. Up to now, I would say that the most complex keyboard binding I've implemented is the binding for dialog options.

The Longest Journey has very heave dialogs, each of them with many many options, all fully voiced. It would indeed be very convenient for players if they can use keyboards to go through and select options in the game. However, the previous implementation of this part is fully based on mouse movements, with a structure that is not suitabl…

ResidualVM: Week 7

Image
Sorry for you guys waiting as if there really are people waiting to read my blog, it seems that this week, and potentially next week, are still about finishing small tails left from the menu task. Well, this is not just because of laziness (and there is some laziness recently... I didn't feel completely well for a couple days... But I am good now, so no excuses any more), but some of them actually have problems deeper than I had expected.
One example is the task of implementing the Book of Secrets, the extra content of the game, in the main menu. It looked easy at a glance since it is not a menu, but a game level. Just load the level when the button is clicked and there, the book opens.

But that's not the whole story of it. The Book of Secrets is probably the only game level that contains texts in its resources. When it comes to texts, one problem will show up: the texts' textures will not be automatically reset when the screen's resolution changes. I have done simila…