-
Notifications
You must be signed in to change notification settings - Fork 8
game flow and logic
the user opens the program, he sees a menu, he writes a menus items number and press enter the menu changes or new text is shown, all that is the menu system.
the game logic goes through the game manager and the "game objects" class that are connected to the game manager
starts the game, pass turns , saves the game.
it holds the player, market. calls the event manager etc etc.
every menu and game object can access the game manager as it's in global scope (java calls it "static").
you may argue its bad design or whatever, but it works and it helps separate concerns and very ordered.
turn count is held in the game manager too.
it's the mediator that passes data between objects as it holds the player object.
it also allows menus to access player methods, as the player object instance is a static attribute of game manager.
holds all relevant player data as attributes, like the items he holds, events that he can run in the event menu, the amount of credits the player has, how much taxses he owes, bad events counters etc.
player methods manipulate the player's data, like paying taxes (the method will reduce taxes owed and stop taxes bad counter because you get fined if you don't pay taxes on time), buy and sell handle selling and buying items on the market. and a few other helper methods that are related to player data.
also has static methods to handle game events, it gets them from the event db and runs them if they are immediate events or adds them to player events so the player can run them (in events menu) in his turn.
random_events method runs at the pass_turn method (in game manager), becuse every turn new random evetnts happen.
there can be endless types of events with different logic, im planing o adding long-term events that happen in more than one turn and require multiple actions/decision making from the player (its a luxury feature I want to add).
this class handles the market logic and utility methods for getting item data from the items db.
an instance of this class is an attribute of game manger so it will be easy to acsess it in the market screen for doing market logic.
like displaying all items, getting an item price, updating an item price in the players items.
"supply_and_demend_gen" is called in pass_turn in game manager it changes the markets items prices and amount available for buying.
it's not a good simulation of supply and demand but its a good place holder untill i will make it more complex, for now its random.
its a "modal class" for holding and manipulating items data, it has no logic-based methods as it doesn't need them its only for holding data for now (and probably later too).