I was working on an UNO game as part of a project and had a few questions. I would also appreciate if you all could kind of provide a basic guiding framework as to how to organize the code. This game requires GUI and is acting as a "referee" between 4 players with no AI.
Q #1) What is a "game-state" and what purpose does it present in the overall game? We are required to have a game-state and i do not understand.
Q #2) Can I have one JPanel and put everything on it or have multiple and which one is better?
The game state is a combination of all the data in use by the game, including position and motion of all the players at a particular time.
Don't consider how many panels to use at this stage; that is a display problem which you can work out when you have the game's logic working properly.
posted 1 week ago
Going on your previous advice, I finished my game's logic completely, and my Uno Game right now is a fully-fledged text based game on the IDE Console. But right now, I have no idea how to start crafting a GUI for the game or where to even start at all. And I cannot figure out whether I let my game play out in the background as text game while the Graphics window overlays it or whether I must change code to modify those print statements?
A natural thing that happens as code evolves is to embed your user interface code in your business/game logic. (I'm making some assumptions about your code here.) So, if I'm correct, then the next step would be to pull out all your text based interactions with your game logic into its own class or classes. This would leave you pure game logic class(es) with an API that can be evoked from either a text based interface or a GUI. The game logic should not need to know which flavor of user interface is involved. Then the next step would be to design your GUI.