Another sci-fi adventure joins ScummVM

From 1940 to 2099, Nightlong: Union City Conspiracy is now ready for public testing. Take the role of private investigator Joshua Reev in this cyberpunk-themed adventure released in 1998 by Trecision, featuring pre-rendered environments and 3D software rendering. Uncover the conspiracy, and all the bugs!

Thanks to the original developers for providing us the source code, and to SupSuper, Strangerke, bluegr and madmoose for porting it to ScummVM.

All Windows versions of the game are supported, as well as original savegames, check the wiki for required datafiles. If you don't own the game we have demos available. To test you will need the latest daily build of ScummVM. As always, please submit the bug reports to our issue tracker.

2021/6/11

2021/6/11

Still in the first week of GSoC, this blog is a record for a problem which confused me over day, and finally solved with help of sev

wish to write more blogs which can help me with the communication skills

let me describe more detailed here.

few day’s earlier, i was on a task about adding custom target to director

because for those games, seems like they have those info in those executables. e.g. game name, director version.

but for those movies which don’t have executables. such as Dictionary, we can only lanunch them by --start-movie. they don’t save info which is needed.

previously, we put some special file like D4-mac, D3-win into Dictionary to indicate their platform, director version.

But we won’t be able to save much info directly though that file name, which is not user friendly.

So here’s the goal of this task. Add more info into those special files which is created by us, and we use fallback detect to detect those files. We create a list called custom target list and read info from those files. thus we can gain more than just platform and version.

Currently, we are putting 4 stuff into that file, platform, version, targetID and game name. Previously, in fallback detect, we need to return a struct which used to save info of the game. And that struct already has the slot for version and platform, but we don’t have slots for the targetID and game name. Thus, sev told me to extend that struct to save more info.

At first, i want to just extend the previous struct by using a method which is very similar to inheriting. We keep the head as the same and put extra info at the end. Thus we can easily cast the pointer from base struct to the extended one.

Then here comes another problem, director has already using this trick to save gameGID and version, which means, if we directly append extra info to the tail of base struct, then we will facing a problem that the tail will be different. One is for directorGameDescription, and the other is ExtendedGameDescription.

This problem really confused me a lot. I take nearly a day trying to figure out some approach to solve this. But finally failed.

I think there are two reason that i didn’t managed to solve this problem. one is the lack of experience. With more experience with those problems, i think i can tackle those thing easily.

And the second is that i don’t want to give up on that idea. I though that extending the existing struct by using that trick is good. I’m trapped into that framework. I want to solve that problem by using that idea, and didn’t even think about other approach. And that leads to my failure.

Later sev gave me another solution, which i think is more readable and extendable.

we can just extend that function with one more parameter which is a pointer point to that extra info.

If there are extra info, then fallback detect can allocate the resource and add extra info into it.

then we just need to check whether it’s nullptr or not, and handle the task of freeing that pointer.

with this approach, devs can read this code easily and extend the extra info structure with no non-sense efforts.

During this task, i learned not only the technical solutions, but also the disposition of mind as a dev.

Think about the question from the begining and the top level, don’t stick to one plan, and don’t let those tricks trap my mind.

We gather together here for creating something amazing.

The Algorithm

2 Days into coding period

If dreamweb was like finding a needle in the haystack (with git grep -i text, to be fair)
sci is going through the haystack again but three times the hay size
I chose dreamweb as my first engine after griffon, not only because that was what I scheduled on my proposal
but because it was the only engine I could make sense of at that point of time
well, I am almost always working on the only thing I can make sense of that isn’t done yet
and here we go again
happy coding

First day of GSoC: Not what I have expected

After reading my blog, criezy generously suggested that I took time learning git commands and even discussed with him. Sev also repasted the git pro book, and suggested that the first 3 chapter would do. So basically, although I thought is was not a good idea to resolve something like this at the very first day of GSoC coding period, that’s what I did. Read the docs.

The Surprise

What’s amazing was it was actually useful. Very useful. Much effective than what I have expected. Probably because after finding out how to do it with the GUI, there is no pressure on me that I cannot commit something (although I would have to give every file a separate commit). It was also probably because it was the right time to read the git pro book. Compared to the me 2 months ago, it’s kind of different after 32 “git add && git commit -m "GRIFFON: Commit message" && git push “es.

So after griffon I can understand the first three chapters of git pro. The magic is, after git pro, I understand the tutorial how git works (the tutorial I have been watching since the weekend).

It’s astonishing how my understanding went from 1% to 90% (and imagine that I regarded that 1% of learning as some highly recommended material, and you would understand what I went through). As if the language the lecturer was speaking had changed. (From something like French to English, while I recognize like 150 vocabularies of the former language, and will only understand anything typed on the terminal, shown in the animation, or demonstrated non-verbally.)

Git is amazing in the way it is both simple and not easy at the same time. I feel git is something most people get only by playing with and studying for a period of time. That’s why it is not introduced to google docs or any other things. I wish we had that. No more “duplicate files”, “All changes saved to drive”, “Oh we have a conflict pick a version!”.

Small Notes

Below are some notes to what I have learned from git.

The funny thing is that what you “know” before and after you “really know” is the same. It feels dump yet magical as I look at what I type.

Git exists for this purpose
To manage files that are similar but not the same. To edit while keep tracking, separately or together, and unifying versions when we want to.

Existing files have this problem
There is only space to store the file content, but no one is responsible for tracking changes – git is responsible and accomplishes it by hashing and matching lines to detect change

commit – a change
branch – a series of changes. The current branch tracks new commits.
head – a pointer to the branch that is tracking new commits

switch – change the branch the head is pointing at. Your working directory and its content are changed to the lastest commit at that branch
merge – combine changes by manually resolving conflicts
rebase – change the base of a branch. Specify a branch A to be rebased and branch B to be rebased to. Starting from the place the the files’ content diverge, move branch A to following after branch B
merge and rebase are used for similar purposes but work differently. If you use merge you will need to resolve conflict. If you use rebase you will need to . If you rebase a commit that has been updated to the internet, things get screwed up.

(beginners can ignore these three for a while, just know that check-out is like switch because it’s often referred)
*check-out – everything in switch, but including checking out a commit. When you checkout a commit, nothing strange happens, but that it doesn’t belong to a branch. You can make a series of commits, just like in a branch. However, you cannot come back to the series of commits once you switch back to a real branch, and the commits are lost when a garbage collector comes by, unless you switch back in time, and created a branch (surely, check-out is not a bug, must be another killing feature)
*fast-forward – you have already done the merge/rebase, go to merged/rebased place
*tag – branch that doesn’t update once it is created (same comment as check-out)

remote copy – taylorzhancher/scummvm. Not to be confused with local copy (files on the computer)
origin – the default name of a remote copy (every copy is a remote copy) on the local copy
fetch – get the branches from the internet to local copy
pull – fetch then merge

upstream – the default name the main repository on the local copy

git config --global pull.rebase true make git pull do fetch then rebase instead


Some questions to answer in the future
So what if we do a rebase, and go back to branch A, then do a merge? Does a fast forward happen?
Not clear with what is a change. How do you define two lines as the same? Is delete considered a change? If so, what if I propose a blank file to merge with a new one? What happens when I try to merge an unrelated file to a repository?

Good things take times

While studying, it was pretty irritating to see the time ticking, and nothing done except something referred as “the second quadrant activity” in The Seven Habits of Highly Effective People – Things that are important but not urgent, and are usually the long term things that counts the most but gets ignored.

For some reason, the feeling was especially prominent during the last chapter of git pro and the last half an hour of how git works. I wanted to tell myself it’s only a few minutes left, and still I had to rewatch or re-read it a few times because I kept losing my attention. Maybe the excitement of understanding documentation that I hardly comprehend before was wearing off, more likely because I can’t help thinking what to do next.

I do understand though, after taking and looking at the notes, that I have a lot to learn, even though it’s the basics, and I have put so much time in it. Happy developing.

Another Surprise

Sev reviewed my code, so I have something to commit today without making progress on finding secret code to specifying GUI options on the sci engine. After publishing this post I will be typing command to my terminal and praying that they will work. Then I will make commits to fix the code, hopefully. (Actually no hope. Uggh!!)

Final words

Although I haven’t fully seen the impact of blockchain in anything else than crypto, here is a good example of hashing and tracking.

I think it’s just beautiful.


2021/6/8

2021/6/8

First day of GSOC

This is my first time to write a blog in English, hopefully there won’t be many mistakes which will confuse others.

Because of the school stuffs, i didn’t managed to give a lot of time on ScummVM in past few weeks. But since GSOC is start now, i will treat ScummVM as the first priority thing in next few months.

I think this first week would be familiar with director. sev had gave me some tasks for me to get familiar with director. I have confidence to finish dealing with those tasks and reading the director manual sooner. I think this period should be past very quickly.

Here i want to summerize some of my past work to remind me to hardworking for the following days. Most of my time of working for ScummVM is to dealing with MacText. And for now, the MacText can behave very well. And i think this should be the point where i cut into the director.

Then is the debug flag feature, this task shows me how the ScummVM is working with those games and engines. Through this task, i had a chance of having an overview of ScummVM. Also during working on that feature, i made a lot of mistake. But sev and other devs helped me fixing those bugs, which really surprised me a lot. I felt the charm of open source projects by this experience.

And next would be MacBorder. sev taught me about how to drawing 9-patch images, and guided me a lot while i was doing this work. During that time, i learned a lot of stuffs that i can never learn from school, such as, git operations, code styles, comments and code readabilities. I benefited a lot from this task, and it opens the door to the open source projects for me. Also gave me the confidence to be the member of open source community.

Most importantly, this project makes me realize i still got many things to learn and to do. So let’s move on.

Back to Work

I’m finally back to work on the Director engine, returning for a second year of Google Summer of Code!

As I just got started again, I don’t have a ton of progress to share yet, but in the past few days I’ve:

  • Fixed “autohilite” detection. Certain sprites invert their colors on click, depending on several different factors which were previously not properly handled.
  • Improved version handling. All movie/cast loading functions now use the version number stored in the file instead of the global VM version. This lets the engine properly handle games with files created in different Director versions.
  • Fixed flickering when switching from frames with digital video.
  • Made --dump-scripts patch the offsets in movie extracted from executables, correcting them so that they can be opened in Director or ProjectorRays.

I’ve also made a good deal of progress on my Lingo decompiler ProjectorRays in the last few months. The number of Lingo features that can been decompiled has been greatly improved, with only a few opcodes left to implement. In addition, Shockwave DCR movies are now supported, and I’ve begun releasing development builds for Windows. The tool should be extremely helpful understanding and debugging Director 4 movies, which have no source code.

Now onward to more Director 4 Lingo. 😀

Tales of MacVenture: Debugging and Reading code

The current state of MacVenture:

Changes were made to MacGui, and MacVenture wasn’t touched for long, so lots of things broke down.

My first task will be to get it running to it’s previous state and that’s it for the beginning.

Current running state of MacVenture

Current Known Bugs:

  1. Controls Window having incorrect dimensions, and engine crashing when inside of Controls Window is clicked.
  2. Self window not displaying correctly.
  3. Border loading and displaying somewhat broken ( stuff changed so need to change calls accordingly )

And that’s it for now.
😀

How to Open a Pull Request & Push and Commit Code to ScummVM

I’ve open a brand new Github account just to learn how to.

Not recommended for long term. I do recall sev saying something like as a dev you should use command line and I do agree with that.

Well, I wanted to do everything with terminal commands, but was unsuccessful. I couldn’t find satisfying answers online before I decided it was too much time. I may find out how, later.

  1. Go to Scummvm’s GitHub repository, and click “fork” on the top right corner.

2. Now you should see a brand new page, yourGithubUserName / scummvm
What we basically did in the last step, is to clone all the code from ScummVm to our own repository
A repository, is a lot like a folder that you keep code. They are grouped together, because they share a similar purpose of use.
What ever you edit in this repository is yours, and will not be updated to scummvm
But it can be convenient if you would want to update code from other people’s contributions to scummvm. You can click “fetch upstream” right below the green download code button.

If you care to go to your profile, you would see a new repository on it (scummvm)

Now let’s get to the point.

3. Make a file change

Okay, I must admit that I’m getting to the part that I am positive that is not optimal, but it works.

First make sure you have a compiling copy of code that you would like to be added to Github.

Go to the yourGithubUserName / scummvm page, and select a file you want to make alterations, and make the change by clicking the pencil icon

Replace the code with your copy.

A very handy tool is the “Preview changes” tab. It kindly tells you what changes you have made, in case you made unintended changes.

4. Type commit message

Here’s the important part. It’s time to come up with a commit message.
I have yet found a way to change the commit message, so for what I know, if the message is wrong, then it’s gonna get hard.

DON’T PRESS commit changes yet!!!

5. Create new branch

Select “Create a new branch for this commit….”, and name it with something relevant

Great! Now go ahead and propose changes

You will be directed to this page. Not bad ehh!

6. Open Pull Request

However, that is not you are looking for.

Go back to scummvm / scummvm, and you will see this. Click Compare & pull request

Be sure to view the contributing guidelines. The rest is amendable and thus less stressful. Happy coding.

Hurray for new PR DREAMWEB: Text To Speech (TTS) for the game

This is something really to celebrate. Yes I have just opened a hello-world-difficulty PR but did you know how long it took me
????????

I feel I should write a tutorial for this. (And I did: Here)

It feels so great to see a brand new PR with three beautiful commit messages.

https://github.com/scummvm/scummvm/pull/3048