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!

 

NPC Mailing and Player Housing

It’s been a while since the last post, primarily because of vacations and me taking a small break from gamedev to avoid going insane. But now the break is over, and development is continuing once again. Some interesting new stuff this week, so keep on reading!

Mail system

The biggest new feature is the mail system. This allows NPC’s to send the player mail in game, which may contain gold, items or both. Or none at all, as it could also be spam or advertisements(not real ones, obviously). Your mail can be checked in any mailbox throughout the game, either at that regions Post Office, or at your house if it has a mailbox outside. Some of the letters can be worth following up, even if they look a bit shady. You never know what you might find.

mailBoxes

Small GIF showing off the interface and how it works.

Letters can also be configured to take several days to arrive, or on the same day they’re sent, as well as being randomly generated from time to time. This randomization mostly applies to spam being sent to the player, but others can be as well.

Player Housing improvements

Since very early in the project, the player has been able to purchase property where they get access to a bed for sleeping, which provides some extra bonuses when waking up. That was as far as the housing system went, and it felt kinda underwhelming. You own the property after all, why wouldn’t you be able to change it more to your liking? Well, now that’s possible. Each of the houses purchased has one or two “slots” where you can put a furniture of your choice to provide services and/or buffs to your abilities. If your character is an alchemist, place down a alchemist table. Or maybe you favor cooking delicious food? Place a oven instead. There’s not a huge variety of furniture just yet, but it’s easily added. Furniture can be purchased at various furniture stores throughout, the first one being in Stonehaven.

Other changes/additions

  • Started work on ships sailing around the world, landing at docks and offering the player rides for a sum of gold.
  • Added uniforms/outfits allowing the player to dress up as servants etc to sneak in to locations they’re not supposed to be.
  • Added various furniture items for placing in player houses
  • Cleaned up various maps and dungeons.

Not much to write this week, sadly. But it’s better than nothing at least! See you again soon, I’m hoping to have more by then.

The big interface cleanup

For the past two weeks I’ve been working mostly on questlines and redesigning some of the interfaces in the game. The inventory, trading, map, character/party and spellbook interfaces have all received a new design to make them easier to navigate and give information more clearly. Also, Temporal Turmoil ended up getting first place in the GameMaker Jam! Without further ado, let’s jump in to the changes.

Trading changes

The trading interface has seen a small change in design, adding in a new button; Haggle. This allows you to change the price of items either higher or lower, based on your Cunning skill. Please note the GIF below is a work in progress, so it might change.shopHaggle.gifThe inventory screen looks more or less the same, except that the Haggle button instead says Drop Item. I’ve also removed item icons from the list view on the left side to a single one that changes when you hover an item(see the apple in the GIF above?) for performance reasons. Below the item icon the item type graphic is displayed. The number next to the item name is how many you are currently carrying of that item.

Party and Character management

The player/party screen has seen a face lift too, as noted at the top. It used to be a single screen with all the information showing, but only for the player character. Not any more! The party screen has been “updated” to use the tabs as well, allowing you to see each characters individual stats, equipment, background information and some gameplay stats related to that character.

charScreen2.gif

New character/party screen

charscreen

Old character screen, very old. I should’ve taken a screenshot before redesigning it.

Party members will appear in a list below the button that says Player Name, allowing you to click them and see their stats and all that. You currently can’t give party members items and equipment to carry for you, but I might add it if enough people want it. Having party members is fully optional, even in quests that tell you that you should take one or two with you, because you’re the best around and nothing will ever keep you down.

Speaking of party members, I’m working on the ability to hire mercenaries and other followers that’ll help you fight if things should get too hard. Most party members are predefined though. Talking with them is in many cases context sensitive, aka being in a cave or out in the field can trigger different dialogue options.

New map screen

The map screen has received a complete overhaul, now including tabs for all the regions, filters, location descriptions and redone icons for the various locations. Here’s a comparison of old/new.

The new map allows you to mark custom locations by clicking tiles you have discovered. Hovering over a map tile will bring up a basic description of the location along with its name. The green tile is your current location, which can also be toggled off. Quest locations do not appear, both because it would require a redo of the current quest system and making you actually read the quest descriptions to find out where to go.

Spellbook

This has been the interface I’ve paid the least attention to while working on Tales, as I wasn’t completely sure what type of spells should be possible and their categories. Now it’s fairly complete, the remaining task is to create icons for the spells and particle effects when using them. The number next to the spell name is the mana cost when casting that spell.

spellbook

Same as always, tabs up top to change the category of spells you want to view. The to rightmost buttons are Alchemy Recipes and Cooking Recipes. Not fully done yet, I expect to have them done by next week along with more information about how magic works and some more spells.

Other changes/additions

  • Added a variety of teas that give different bonuses if drank before sleeping. EG more health when waking up, bonus experience for a small time and so forth. Tea can be crafted either on stoves or on a campfire (requires a teapot)
  • Lighting and audio improvements
  • Blood splatter effects when fighting enemies, if they have any blood to shed. It even spreads on the walls if you’re close enough. Enemies wearing heavy armor will spill less blood, and those with light armor, more.bloodeffects
    • Blood and gory effects can be turned off in the settings if you want
  • Started planning a short trailer, hopefully coming out in a few weeks if all goes according to plan.
  • Imported two new music tracks for dungeons and the swamp. Delicious!
  • Music dynamically changing to combat music when aggroing enemies.
  • New sound effects

That’s all for this week, cya all in the next one! Feel free to leave a comment with thoughts about what you just read, it’s greatly appreciated.

So much new stuff!

Even though it has been three months since the last post, Tales of Astya is still well and alive. Over the past three months a lot has been added or changed, so let’s go through them step by step. Mobile readers beware of lots of screenshots.

Day & Night System

We’re starting with one of the biggest additions, the day and night system. Time now advances properly with transitions between night, dusk, dawn, morning and midday lighting.

The time of day affect various things, such as the open state of stores and what beasts will spawn in the wild. NPC’s also change their dialogue based on the current time.

Weather System

Alongside the new day and night system is also a revamped weather system with rain and thunderstorms. During rainstorms the maps get darker and the fog more intense, making it harder to see properly. All the overworld maps also have their own unique chance of rain and thunder happening. During thunder all characters in the current map have a chance of being struck, dealing extra damage. Damage and chance is increased further by walking in water.

Crafting & Gathering

Crafting is also in! It wouldn’t be a open world game without it, right? Brew your own potions and alcoholic drinks as well as cooking delicious food. The things you are able to craft is based on your Intelligence attribute and what recipes you have learned. New recipes are found in cook books, notes and through talking with people around the world. Ingredients can either be bought from stores or gathered in the wild. If you’re trying to craft a potion or alcohol, you’ll also need something to store it in, such as a bottle or a vial. These can be bought or found throughout the game.

gatheringIn the GIF above you can see the action icon(those flowers) for gathering a crafting reagent as well as the small sprite change for each type of reagent. The icon will probably be changed sometime during further development.

Separate interior mapsinteriormap

With the addition of the day/night system and new weather effects, a big change in map design had to be introduced. Previously, houses were open and you could see inside because there were no roof tiles. Now however, interiors are their own separate maps. This allows for them to have a much greater level of detail, as well as improving the performance of exterior maps.

That was pretty much what I wanted to share for this post. I’ll do my best to have another one ready next week, talking about more features and changes as they’re implemented. Until then, take care!