Sunday, July 18, 2010

Report: 7/18/10

These first steps I have been taking while programming are to discover ways to generate maps for players to imagine these global transactions. The technical goal is to make the maps display varying degrees of plains, mountains, forests, and an ocean coast with very random and semi realistic continental coastlines. These types of geography should also have the ability to be referenced (not merely a generated image but a selectable node of information). Conceptually the magnitude of the map should grant several illusions which can suggest that the map is large and epic, while not seeming too large to the point where the player questions where all of this land is coming from. The representations in the maps will be of a suggestive nature to make things appear above a local map, and below a world map.

Step 1: The matrix
I have been working in a matrix of squares which determine local settings on the map. For instance should I select some square, it will take me to a mountain scene, or a forest scene. This breakdown also quantifies the random elements to a much smaller number.

<---- On the left here is the first thing I made, an array in an array which creates rows and columns of squares to represent nodes, the shades of grays are randomized, so I have control in between each creation of square, and the blue squiggle below is a creation from a mouse click and drag function, so mouse actions are linked to this grid as well. I later added more values to the creation, editing hue, saturation, and brightness. These values will later be used to represent the different land masses, to draft up a finished map.

The difference between this picture, and the one just above, is that now all of the nodes are drawing themselves several times a second, this refresh makes “erasing” possible. Before it was like drawing on a chalk board, and drawing over things making it close to impossible to undo something, where now everything is almost getting animated on the screen several times, making it more flexible. Constantly animating, even static scenes allows for elements to appear to enter and exit the scene.

For example if you look carefully at the first picture above, there is a white node about in the middle of the upper right quadrant. This white square is programed to come up when you click on that square (like a selection). I coded it so if I click somewhere else, it lights that square up, and no longer lights up the one which was previously lit up. The picture directly to the left has a white square selected in direct center, this is because it refreshed all of the squares, without randomizing all the colors.

Step 2: Boundaries
For my next step I felt adamant to be able to generate the coastline (most likely the toughest challenge). For starters I wanted to generate a limit, which makes it impossible for the ocean to creep into the land any more. At first I came up with this simple diamond generation. After some thought though I felt its rigid construction might reflect on the continent making things far too angular. So I quickly went to attempt the creation of a circle in the center.

This is harder then it seems because having constrained myself to the matrix, I cant use any of the built in circle shapes or any of the such because it doest relate to the grid (and there are no overlap functions which I know of, and to create on might slow up the program). So I racked my brain and tried to conjure up my lost learnings of High school math. After several sketches I figured out a way to use the Pythagorean theorem to determine the number of blue green squared needed to be drawn at each line in the center in order to make it seem flowing.

Math stuff: The 2 constants I had were the radius of the circle (a random number), and which row I was in. Then I just pulled off the reverse Pythagorean, B squared = C squared - A squared. This new value is the distance across the circle at any relative row. (The diagram on the bottom is something I made for me as a reference.)

MOVING FORWARD: I’m working on my approach for how to generate water, I am now thinking of ways perhaps where water is negative space, and land is positive space (meaning I program the land spreading out, as opposed to the water spreading in. I will be lucky if I can get peninsulas to form and gulfs, which are tough to form in a linear creation pattern.