← All Workshops

MudEngine Part 8: Inventory & Chat

Step 9 / 14

Make it responsive

The fixed player list and the side-by-side flex rows work on wide monitors, but in a narrow window — or when the browser is zoomed in — the 3×3 map can collapse to nothing and the chat panel slides over it, swallowing clicks.

Append a small responsive block to main.css so the map always keeps a usable width and the panels stack instead of overlapping.

mud-engine/assets/main.css
/* ── Responsive layout ── */
@media (max-width: 1150px) {
    /* Shrink the fixed roster instead of covering the map */
    .floating-player-list {
        width: 180px;
    }

    /* Reserve only as much right margin as the panel now needs */
    .game-layout {
        margin-right: 190px;
    }

    /* Keep the 3×3 map usable while the panels share the row */
    .grid-area {
        min-width: 250px;
    }

    /* Give the chat its own line so it never gets squeezed to a sliver */
    .chat-panel {
        flex: 1 1 100%;
    }

    /* Let chat/controls/inventory wrap instead of sliding under the roster */
    .bottom-area {
        flex-wrap: wrap;
    }
}

@media (max-width: 930px) {
    /* Only below this width do we stack the map above the panels */
    .game-layout {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    /* No room for the roster on phone-sized windows */
    .floating-player-list {
        display: none;
    }

    .game-layout {
        margin-right: 0;
    }
}
💡 What's happening
  • Down to 1150px the fixed roster narrows to 180px and its reserved margin drops to 190px, so the map and panels keep more room.
  • Down to 930px the map and the chat/controls/inventory row still sit side by side; the map holds a 250px minimum so it never collapses.
  • Only below 930px do the panels stack under the map, and below 480px the roster is hidden entirely — nothing overlaps at any window size.
Step 9 / 14