I whipped up the beginnings of a game editor today. I know its not traditional for roguelikes to have editors, but I have felt the requirement in terms of building special rooms (prefabs), testing layouts, lighting, etc.
It’s not much yet. All I can do is draw tiles on the map, but it’s a start.
I envisage the editor to allow me to configure dungeon layouts, light sources, skills, races, etc. Basically it should become the editor for all the customisable content in my game.
I had to jump through some hoops to get it to work with XNA, but in the end it wasn’t too hard. There are some nice articles on rendering XNA output onto a panel as seen above. The grid lines were also quite tricky. I basically ended up drawing a 1×1 pixel texture across the render window to form the grid lines. (yes there is no native 2D line drawing support).
I envisage the design to use a Model-View Presenter architecture (MVP) with the actual editor form making updates to the model through a presenter class. My XNA main loop will render the model in whatever state it is. No decisions will be made in the XNA portion of the code. I find it helps me to separate the rendering of game graphics from the actual game data.