Following up from an earlier blog post about being interviewed by Good Game, I've been cut from the episode to air.
Saturday, 26 March 2011
I'm not finding a huge amount of time to program at the moment, but plenty of time to write - it's easier when you're building information with sentences instead of data structures if you get frequently interrupted.
Tuesday, 8 March 2011
So I've got a data structure I want to initialize for a game map, for example:
// A grid is a collection of cells. It is initialized to the default contents.
function Grid(rows, cols, default)
this.rows = rows;
this.cols = cols;
this.cells = new Array(cols);
for(x = 0; x < cols; x++)
this.cells[x] = new Array(rows);
for(y = 0; y < rows; y++)
this.cells[x][y] = default;
Now, my question is given I want to have default represent a particular terrain type at a location, plus unit types, plus improvements etc. I can see 2 ways of approaching this:
1. Have multiple grids, each of which points to a different thing e.g. TerrainGrid, UnitGrid etc. where a thing might be an integer value, string, head of a linked list and so on.
2. Have a single grid, MapGrid, which points to a Cell object which contains information about these multiple things.
Now the complication is of course, I want multiple view ports pointing at possibly different lists of grids for e.g. multiple players, isometric views, overhead views, different map projections, so I also need a ViewPort object which contains a list of (possibly non-rectangular) cells. (Technically, a view port should always be a rectangular projection, so maybe call it MapProjection instead).
Now, here's the naive question. How do I ensure that I only have a single instance of each cell in my ViewPorts? My approach would be the view port contains a list of (x,y) coordinates of the cells in the view, but is there any advantage to directly pointing at the Cell objects, assuming I go with a single Cell object in a single Grid as opposed to multiple grids. If I do, how do I ensure that I'm using a reference to a cell (and not a copy) and that if I destroy a ViewPort I don't delete the underlying cells. What about concurrency issues, where I have two players acting on the same underlying cell object through different ViewPorts?
These are terribly naive questions which because of the elegant design of C, never really enter the picture when I'm working on Unangband.
I can see how people get paralyzed trying to develop in so-called higher level languages.
Sunday, 6 March 2011
Get the latest copy of Xcode supported for Tiger (Xcode 2.5):
sudo port -v selfupdate
sudo port install git +svn
Wednesday, 2 March 2011
In lieu of anything interesting to say, I'll just point you in the direction of a couple of PCG blogs I have been enjoying: nullpointer, and Procedural World. Feel free to mention more in the comments.
 The closest I've come to being 'interesting' of late is realizing my fractured schedule was ideal for Facebook gaming, and signing up for Brenda Braithwaite's Ravenwood Fair. I got as close as opening the game once - but was luckily saved at the last minute by the fact it refused to sync correctly. Close call.