Showing posts with label Restaurant. Show all posts
Showing posts with label Restaurant. Show all posts

Tuesday, 11 November 2014

Implementing graphics

Working on my Sim tonight has been a trial. The graphics setup that I have been using is heavily based on the Game Programming videos by TheCherno on You tube. Up until now I have been able to add graphics for the Tables in my gym using a simple render method, but tonight I set out to add a background array of tiles to represent the ground and walls. At first I wanted to figure some of it out on my own based on the memory of implementing this method previously. It turns out I wasn't as prepared to work through the code as I'd like. Revisiting the video tutorials I started to write down and analyze the code a little better. Working out the way that each design decision fed into another, I was able (with a little tweaking) to get my code running and bring up a simple grid of tiles.

The next step involved creating a "map" from pixels, where the colors represented tiles of different types that the program could read in and create the full map from. Using hexadecimal colors and a small (64px X 64px) "map", I was able to feed this into the level loader and move around the screen with the avatar. Lining my tables up was a second issue which meant I had to rethink and refactor my code to take the tables from an Array and build an Arraylist instead. Once the level loader read my map and encountered a "table" tile, it added a new Table instance to my ArrayList and set its x and y variables to match the tile.

Here the dark lines represent walls and the orange pixels are Tables

The next task will be to work on collision so that solid objects will be impassable. I will later add features for the sprites so that the level loader will determine if a table has adjacent tables and extending the length and capacity of the table accordingly. This will also involve some new sprites and logic to determine orientation, waiter interaction points etc. Once I get around to AI, I hope that the tile grid based system will work in my favor!

I imagine that in the final version of this program, the levels will be generated and packed before release rather than having the program read from the image files. Perhaps creating the initialized level and serializing it so that it can be read into memory, preventing tampering. If my final implementation also includes using a bitmap style mapping system, it may open up the door for creating my own modding tools or level editor, placing walls, computers, tables and other features that are checked by the program for compatibility against a set of game rules.

Larger level with Waiter star icon as placeholder. All tables occupied by debug mode options

Smaller level with pixel map overlay. Green pixel represents the Waiter starting position

Monday, 3 November 2014

Working with the Hostess, queues and delta time

So ive got a small gym running for my program, a set of tables with placeholder art to show states and a non-viewable 'hostess' controller.
The hostess consists of a set of queues, which are offered a group of random guest size at random intervals. The hostess offers the group to a queue of matching description (those waiting for a table of 3 go into the queue for 3's and 4's) etc, using a best fit approach.
While the tables dont show any difference for max seating yet, eventually i will create different sprites for tables of various sizes and shapes.
Implementing the "arrival" of guests could lead to a more detailed look at the state of the performance, time of day and use of marketing strategies. Looking back at rct and its publicity options for gaining more guests, i may be able to add these kinds of features later on once the core gameplay is set.
At the moment the Hostess class is not intended to be a child of Staff, and is instead simply a controller of the flow of guests. If i later decide to have the option of a graphic representation, i would be able to give it a limited set of information and control to simulate human behaviour. (For instance, StaffHostess could have only limited view of the tables availability, and have to check around regularly to find which tables are taken.)
The Table class is currently maintaining itself by running update and incrementig a counter variable if the table isOccupied. Future implementations will take into account timed intervals for each state based on the guests and check against delta time for a change. (For instance, 4 guests will finish 2 shared meals quicker than 2 guests habing a meal each.)
My next step is to add StaffWaiter and a Computer to take orders and deliver Consumables to the table.

4/8 Tables Sat in various states