Day and Night lighting in 001 Game Creator

For this week I figured I’d do a behind the scenes look at how the time of day lighting system works in Tales of Astya.

The first step was creating a huge array in 001, to hold each of the overworld map locations, like so. You can also see that it says Z 1/24. Each of the Z layers holds the color information for that hour.

Setting up the array

Skjermbilde 2017-07-05 21.28.59

Now that’s all fine and dandy, it’s time to delve into the scripting side of it. The system consists of four different events, detailed below.

  • Initialize Sun color
    • Used at launch to fill the array with the correct color info, rather than doing it by hand. Efficient!
  • Set Map Sun Color
    • Sets a specific color for a specific map, at a specific hour.
  • Set Region Sun Color
    • Same as map, but for an entire region.
  • Update Region Sun
    • Updates the sun color to the correct color, with color blending.

The code behind it

Let’s take a closer look at each of them, starting with Initialize Sun Color.

Skjermbilde 2017-07-05 21.37.34.png

A very simple script that allows me to specify a color for each of the hours and fills the array on that Z index with the color code. Nothing fancy about this one.

Set Map Sun Color as well, very simple. It gets which region to use, then applies the proper offset on X and Y. In this screenshot the offsets have not been applied just yet, but it is in the game now. Skjermbilde 2017-07-05 21.41.27.png

The code for Set Region Sun looks pretty much the same, just with two for loops going through the X and Y axis.

Then at last, it’s Update Region Sun Color, the one that took the most amount of time to get working correctly. It consists of two more for loops, going through the X and Y axis of the array. Skjermbilde 2017-07-05 21.48.37.png

The above screenshot is from the X axis loop, where it uses Change Sun Color (built in event to change map lighting) to the specified color inside the array, and then changing the Fog Color to the same color, just a bit lighter to add depth to the scene. The Sub Script in the middle labeled DEFAULT is the legacy lighting system and is no longer being used. It was placed there as a fallback before I got around to making the Initialize Sun Color event in case the lighting value was 0.Skjermbilde 2017-07-05 21.51.23.png It was pretty bad, and would only update four times each day, instead of 24 like the new one.

Updating the lighting at runtime

That’s all for the code part of the system, but what about the implementation? Very simple! In a trigger on the player which is triggered whenever Hour is changed, this code is placed to update the lighting correctly.

Skjermbilde 2017-07-05 21.53.46.png

Benefits of this system

One of the biggest benefits of this system is that it allows for dynamic changing of the sun color, either on a regional or local level based on actions by the player. The sun/night sky could be different colors while the player is on a quest for example, or it could be contstant day all the time. The possibilities are endless.

That’s all for now, make sure to leave a comment, either on this post or Facebook telling me what you think or if you want to read more posts like these 🙂 It was a lot of fun to make, so thanks for reading!

 

Magic, Soundscapes and Interview

For this weeks post I want to talk a little more about how the magic system works, sound effects and an interview I did with the local newspaper. I also tried something new this week, recording a video for YouTube so you can get a better feel of the current state of combat. I haven’t spent as much time as I’ve wanted to lately and a lot of that comes from this new game you might have heard about, PLAYERUNKNOWN’S BATTLEGROUNDS. It’s so much fun, especially with friends. Higly recommended, despite being in Early Access. I was sceptic about it at first, but after playing a few hours I’m glad I purchased it.

Magic

Magic in Tales of Astya isn’t a big part of the world, but it still exists. The general population does not know how to cast spells, and not even the Ring of Wizards (mage faction) really knows how it works, only that it does. Casting spells is easy once you know how, and that can be learned at the Wizard Tower somewhere in the south of Uspya, if your character is smart enough.

Skjermbilde 2017-03-26 14.48.29

Learning area for new spells in the Wizard Tower. Still WIP, something will be placed in the side wings.

I’ve been working on some new spells of late, shown in this video right here. Sorry about the low quality, I’ll do my best to improve that in the future.

Soundscapes

Again, more sound stuff. This was my primary focus this week, working on mixing various sound effects to create richer soundscapes for cities, forest, caves and all the other environments found throughout the game, some with variations for night and day. They’re almost done and should be fully implemented by next week.

Interview with local paper

Right before writing the previous post, I finished a small interview with the local news paper about Tales. A journalist came over to my place, we played the game for a bit and he took some pictures while asking questions about the development, the game and the production pipeline. The article was published in last weeks weekend paper as a feature article, and the feedback has been great so far with a whopping double increase in page traffic the days after it was printed.

cof

Local paper, in norwegian.

Other changes/additions

  • More map refreshing with the transition from 3D to 2D trees.
  • Better colors for day and night. Nights are darker and days a little lighter.
  • Changes to AI in relation to entering their home
    • Some won’t go out if it rains
    • Specific hours for going outside
    • They would previously walk to their home, but this turned out to be too unreliable. NPC’s instead just spawn/despawn based on their home hours. Better than nothing at least.
  • Cleaning up the character sprites, removing strange pixels left over from the 3D rendering. Won’t be too noticeable, but it’s been irking me for a while.
  • Changes to overworld travelling time, now with different time passage between maps that makes more sense than the previous static 15 minutes.
  • Started work on player housing, allowing you to place one piece of furniture in each of your homes that gives various buffs and abilities.
  • The usual, more dialogue and typo fixes.
  • Completely revamped getting in to Stonehaven, the capital city. Now with less loading screens and more options to influence the guards at the gates.
  • Traveling merchants with rare items for sale. Only available at select locations, for a limited amount of time.

That’s all for this week. I’m gonna start making more of these videos showing various aspects of the game instead of just GIFs. Some things are just better with sound. Until then, have a good one.

Redesigns, factions & time flow

For the past week I’ve been working on a variety of things, primarily a small faction, changes to how time and quests work as well as interface redesigns.

Time

One of the changes to time is how it progresses. When the player walks from one edge of a map to another, time is currently advanced by 15 in game minutes to give a feeling of traveling a longer distance. It may change until release. Time also plays a role in some quests, requiring you to finish them within a certain amount of days. Some may also automatically fail if you take too long before starting/finding it, the dialogue of the quest giver can be different because no one helped them within a certain time frame or they may simply have moved on to somewhere else or died.

New Journal

In order to increase consistency of interfaces, I also made changes to the Journal, where you’ll now find your current quests and custom notes under proper categories. Creating custom notes requires you to have at least 1 piece of paper. Quest categories are also in, inspired by the Inventory screen. Below is a small example using placeholder quests. It still requires a bit of work, but it’s a proof of concept at least!

questlog3

The categories are as follow: All, Main, Misc, Treasure Hunts, Bounty Hunt, Faction and Custom Notes. The categories are easily switched between either by using gamepad bumpers or clicking with the mouse.

Treasure- and Bounty Hunt are two new quest types that can be found by either reading wanted posters or finding small maps/notes leading to greater loot. Bounty Hunts usually leads to a nice chunk of gold or some unique items, based on who placed the bounty.

New faction: Stargazers

The new faction is a small one and will not be joinable by the player. This new faction is called “Stargazers” and are  a small group of astronomers and munks. Their job is to look at the night sky and try to decipher what the alignment of the starry night sky mean and turn them into blessings for the people and the land. With a little bit of exploring, they may be the first faction the player will meet after starting a new game.

skjermbilde-2016-12-15-22-45-17

Their astronomy tower and living quarters. No lighting effects are applied in the screenshot.

As with all other shrines and sanctuaries, the player may give tribute to the altars found within to receive unique blessings by the gods or just make the faction like them more.

Camera lerping

I also added in some camera movement which can be toggled either on or off in the options menu.
cameralerp

That’s it for this week, until next week I hope to have applied the same changes as the Journal to the Factions screen as well as implementing more quests and fix at least a few bugs. Cya!