I now have another question, related to window managers: If a bunch of things happen during the turn logic (which would be triggered by keypresses going to the pane showing the game world) that require updating the screen, e.g. displaying text messages, or an explosion appears, or something -- should one mix calls to the window manager's redraw function with the logic like that, or handle that separately, like by passing events to the window manager to be handled later in some main message/event loop where all getting of input and redraws are centralized? If separate, then how does one preserve the ordering and sequentiality of those things?[/quote]
If you are not using real-time rendering, then a change to the game state should inform a window that it needs to redraw (nothing else will!). In real-time rendering, the window is either checking the game state each frame to see if it needs to redraw, or it waits to receive incoming events and redraws.
Each window just reads the state of the game and draws that information in a way that is pertinent to that particular window (status bars, maps, text notifications- etc). You either need to tell a window to update or have the window always updating.
Note that just having an event queue with "redraw events" added to it wouldn't seem to work, since the windows' states would be changing, which means that by the time that queue is finally handled after the logic completes, the windows have changed state several times and the redraws would only redraw to their last state at the time control returns to the event loop.
You don't need an event queue. You simply tell a window when it is dirty and that it needs to redraw.
I suppose this ties in with the "separating render and logic" concern I mentioned in another thread here, but am curious as to how it's done in the context of this window manager-based system.
Separation of rendering and logic has more to do with calling drawing instructions within the logic of the game. Telling a graphical object to redraw is fine. The purpose of keeping them separate is so that we can rewrite either one without effecting the other.
In real-time games, it's common to update the rendering at 60 HZ and update the logic a little faster, say, 100 HZ. The idea is that the logic is always updating slightly faster than rendering, so that you get a more fluid visual experience. If logic updated slower, objects would appear to move in a choppy manner. To optimize render and logical updates, their code needs to be in separate places. The Logical side of the application acts upon the game state, modifying and updating it in various ways, contingent upon input. The Rendering side reads the game state, in an agnostic way, and prints the output. This is a basic I/O relationship.
In a roguelike, this is a complete non-issue, but I think the example may help to illustrate why you want to keep it separate. After all, in the text messages, we need to send explicit information to the text message window (game log). That means calling something like "tmWindow.log(myEnum.combat,combatInfo,whatever)" for each game interaction that occurs. The Window does the drawing, but the logic tells it what to draw. The main point is that the Logic isn't deciding how that information is drawn.