Sunday 16 November 2014

Mouse Input and UI Ideas

Today I managed to finish implementing a simple mouse tracker for my game. It takes the location of the mouse on the game window, applies the offset made by the "player" movement, and adjusts for the scale of the game (since the game is a small scale and scaled up into a larger window).

An issue I was having was that as the update method for each table is run at 60 Updates per second, the actions taken when the mouse is clicked were also happening 60 times. To avoid this I added a clickLock, which disables a table from being clicked again for a second. The update method then decreases the lock each cycle until it hits zero.

           if(Mouse.getButton() == 1 && clickLock <= 0){  
if(Mouse.getX() + Screen.getxOffset() >= x
&& Mouse.getX() + Screen.getxOffset() < x + sprite.SIZE
&& Mouse.getY() + Screen.getyOffset() >= y
&& Mouse.getY() + Screen.getyOffset() < y + sprite.SIZE){
timer += 300;
clickLock += 60;
}
}

This snippet is my way of debug adding a state change to the table that is clicked. At the moment the tables update based on an increment per update and switched based on time passed in this manner. In future the tables cycle will update state based on the time and the personal preferences of the guests.
Each guest will be created with a set of randomly generated times such as how long it takes them to make an order, to eat and any "sitting and chilling" time after the service ends. These numbers will create some variation between tables as they will not all sit and end in a predictable pattern. If your group consists of two guests and one takes longer to order, they will both have to wait for an order to be placed. If you have a table of four people and they all decide quickly, the amount of time before an order can be made could be much shorter. In many games based on "cafe" or "restaurant" settings, the guests are very copy paste and fall into guest "types". I would rather have a guest be defined by their own set of preferences and also variables such as cash on hand and time available. A guest who is trying to get a quick bite should be seen to be ordering, eating and leaving quicker than a guest who is in for a social meal.

My noteboook, ideas on UI and button themes
My first notebook page was taken up by some brief ideas on how to add buttons to my UI. I had been playing around with MouseListener and when I hit a bump (NOO! Don't run that code nine thousand times a second!) I took some time off to doodle down some ideas. I hadn't given much thought to the buttons layout yet since I started this project off wanting to make an android app with touch controls (and notably smaller screen space for UI). When I began to narrow down what my influences for the game were, I thought about the way those games handled buttons. The left column of my notes tackle how I can keep a status bar accessible at all times for the player to see general information. Things like a clock and a rating, a countdown timer for timed goals, maybe even an income target and percentage to target bar. While some information is useful in all views, I had the idea that it could present slightly tailored information depending on the object or actor in focus. For example, if I click a manager, or a bartender, or a guest I should see different information that relates to their role and state. If i have nothing selected, a rating bar could show my overall rating, for a waiter, their individual performance rating for the day/week/month, and for a guest perhaps a rating on their experience so far.

Keeping this information in the lower left will keep it away from the main action in center screen but not out of the way enough to be a hindrance to glance at. Keeping status related, non-interactive information at the base of the screen should be natural for many users, while any modifiable or quick changing status on the upper portion of the screen.

The right side of the page was a few ideas I had about button types(management, lists, menu edits etc), while the next doodle was an idea I had about using Aura Buttons such as in World of Warcraft and other RPG games to switch between styles of play. For example a moving around mode, an inspection and statistics mode or simply a way to switch between controls relating to staff, management and logistics. This may add a way to switch input without having to find and select certain actor types, and instead control the game as a whole. An example of this could be that in "waiter" mode, you are able to click on flagged tables and service stations to prompt a staff member to act sooner on that task, while in management mode you are able to dish out morale or efficiency buffs to staff and boost the happiness of a group of guests with some fun product knowledge.

No comments:

Post a Comment