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.

Break time is over

For the week I’ve taken a small break from gamedev, instead focusing more of my time on actually playing games and doing some other things instead of spending the usual 3-5 daily hours working on Tales of Astya. Now I’m back for full, refreshed and ready for new challenges. I’ve mostly been playing Rainbow Six Siege and some Watch Dogs 2 in between. The new map and DLC operators are really awesome! If you haven’t played Siege yet, I absolutely recommend you try it out, it’s grown so much since it’s initial launch. Watch Dogs 2 turned out to be a much more enjoyable game than I initially thought it would be judging from gameplay trailers released before the game came out. Good stuff, Ubisoft!

I started working again fully this monday, fixing various bugs that testers have sent me and adding new features to Tales. These are some of the new things;

  • Barber shop, with custom RGB hair color editing and new hair styles
  • Animal husbandry
    • Sheep that can be sheared
    • Chickens that lay eggs
    • Basic animal AI (grazing and walking around)
    • Placeholders for sounds
  • More recipes to cooking and alchemy
    • Wine and beer brewing
    • Small food dishes
    • All potions that can be purchased can now be crafted (except quest/unique ones)
  • New ingredients to go along with the new recipes
  • Made the full world map (not just the region the current game takes place in)
  • Merchant prices based on the player and merchant Cunning statistic
  • New factions that can be joined
  • More unique dialogue for NPC’s that better fit their personalities
  • Thieves and highwaymen trying to rob the player
  • Shields

And as usual, here’s some screenshots and GIF’s

skjermbilde-2016-11-02-15-06-48

An oratory

skjermbilde-2016-11-03-14-35-46

Small personal library

skjermbilde-2016-11-23-08-03-18

Barber shop interface

chickenpeck

Chickens

sheep

Sheep

shields

Shields

 

That’s all for now, more will follow soon-ish! Cheers.