Thursday, 25 July 2013

Day and Night Picture Mechanics (Set: Room Picture tip)

So far some basic testing I think the scheduler is fully working now. However today I'm going to talk about something else first.

For added game emersion I've requested help with getting Day & Night photos of locations, so that there feels like a real sense of time progression. Currently I'm just setting a variable to "Day" between 6am and 6pm and "Night" all other hours - however I'll probably use variables to define the "Daylight hours" so season change can be "felt" as well by different Day Night Cycles. Afterall, I do have plans of using Day Night Cycles for some game mechanics later on ;)

So back on topic - to show the difference between Day and Night, the obvious choice is to set the Room's Picture to the Day pic or Night pic dynamically based on time of day.

Now since I always go by code efficiency path of thinking - <<Player On Enter>> became the obvious choice of setting the Room picture. But actually that doesn't make any sense at all - as time can progress even when player's stationary and performing certain actions. So, I need a turn based Timer to do this.

I could set a condition to check whether the room picture needs updating, but the effort that'd go into checking it probably throws out the benefits of avoiding to set an image unnecessarily - so the code instead becomes:

Condition: Multimedia: In Group: [v:Time_DayOrNight]-[room.name].jpg
Room: Set Picture: : [v:Time_DayOrNight]-[room.name].jpg

Let's see what happens:

So turns out there's a "bug" in RAGS that means room data aren't updated if you change them (Room Display Name, Room Picture) while you're inside the room. If you leave the room and return however, you'll find the changes made.

I started by adding a couple of commands to throw the player into a temporary room and returning them immediately, which fixes the image problem, but comes at the cost of another bigger problem:

Since my player has actually moved rooms, all the "on enter notifications" appears in the text window - it is as though the player is seeing double, and it's not even 8 o'clock yet! The bigger challenge is also the fact that I have on player enter and on player leave commands (calculating time progression for a start), so it's not the best solution.

While considering other options, I accidentally come across the other Room command:

Out of curiousity I tried out the command, and funny enough:

So it seems that while Steve was building RAGS, he considered the need to update the room's picture when the game updates the layered picture, and refreshes the room picture immediately. Unfortunately having tested it, the refresh was only localised to the room picture, rather than an interface refresh - as I tried updating the Room Display Name and THEN set the layered picture, and only the picture got changed.

I've requested the bug to be squashed, so hopefully we can do things like renaming rooms from "House" to "Living Room" on enter to make the transistion into buildings more.... emersive.

No comments:

Post a Comment