Sunday, July 27, 2008

6-2-08

Rotten liar I turned out to be. Wax all poetic and then do nothing for 3 months. Well, not quite nothing – I did finish my classes for the Spring, and I got A’s. Plus, I finished the engine. It’s done and feature complete for the most part. The only thing it doesn’t have now is to be updated with the new ThiefEd tools.

-What, ThiefEd tools you say?! Yes, that’s right. I’ve been working on the ThiefEd program for the last Month, and now the Needs list is almost squashed. To wit:

1- it draws rectangles on the screen.

2- it lets me modify said rectangles using HotKeys and Tabbies.

3- it makes cute little grab rectangles – at the correct sizes.

4- The Moving Rectangles work, and the system lets you set limits.

5- You can decide if the Rectangles go up or sideways with the editor, and it draws the right limit lines.

6- You can Save the level you are on in a Project File, which has individual stages. Here’s how that worked out: On a basic level, I really wanted to include some variation of ThiefEd with the game. As it stood, I could name my files whatever the hells I wanted, since I could fiddle with the code and make it all line up. However, I would have no way to control what other people might call their crap and hard code that into the game. So, the idea that I had was to consider the whole bloody thing to be a Project File. The Project File would have 9 Stages in it. Each Stage would then have 144 cells or Levels in it, arranged like a 12 X 12 grid. I could then name these Cells numerically. So, 90101 is on Stage 9 and is the first Level (Cell) in the first column.

So, when someone loads their editor, they get 5 Stages to play with or (quick calculator stuff) 720 screens to use. Now, since I have the ability to make a Portal Rectangle go to anywhere in the whole game (I could make 10101 go right to 91212). The levels need not link together in any reasonable way. So with some clever mapping work, the TheifEd editor would be able to use the 5 stages given and make something that could be far larger than my own game – since I do plan to lay the stages out sequentially (like a map) so they flow logically from one to the next.

After I built this bit and worked out how to save it occurred to me that I need to update the LevelLoad function in the engine, but I’ve been busy.

7 – The buttons are dynamic and tell you if you’re using that rectangle, what the dimensions are and I don’t have a third thing…

8… oh, and the automatically selects that one again if you pick it. In other words, build a rectangle, then select a different one, then select the first, and it won’t erase it.

9- It rounds everything to the nearest 10th pixel. This will be cool later when I tile images in it (See big deal below).

-The big deal that I worked out, is how the next project is going to work. It was supposed to be Knight, and use a modified Thief engine, but I ran across a better idea for the engine that is really, really pro. It happened as I worked out the Map (for the Stages and the level load system). The Map is a series of 144 rectangles that all work when you click on them. The first thought that I had was a nightmare – 144 rectangles that I have to build functions for – like the buttons. Then it occurred to me that the information contained in the buttons, what just a number. It wasn’t a funny alpha-numeric variable that I couldn’t generate with an equation. So, the thought was : “What if I ran the numbers, and then built a rectangle at the spot they should be. In other words, 0101 would be on the first row and in position 1 (say 0,0). 0102 would be in the first row in position 2. If they are all the same size, I could do this. Draw Rectangle at 0+(50 x Position). So it would be drawn at the second spot, then the third would be drawn at the third and so on. The specific code looks like this:

Rect 6 + (54*RowLoop), 80 + (20*ColumnLoop), 54, 20, 0

Text 6 + (54*RowLoop), 80 + (20*ColumnLoop), ""+LevelLoop+"

This is all fine and good, but the real money came after that. I thought, you know, for giggle, what would happen if I asked what would happen when you the mouse overlapped the rectangle listed above. I mean, in no real sense does the rectangle ever exist – it’s a fluke of the math really, it exists long enough to provide the evidence that it was there once. What happened was magic. Every time the screen updated at 30 frames per second, it would highlight the rectangle that I was over, just it, and nothing else. It let me select and act on an object that wasn’t there at the time I wanted it. So, with some playing, I found that if I clicked on one of them, it gave me the value that the rectangle represented. Somehow, I would click, it would draw everything to keep up, and then see what overlapped and where.

So what you say. Great, way to get all existential on us you say. Ah, but here’s the trick and the reason that the Knight Engine will be awesome. I could use the same trick to create tiles and a collision system. So instead of a Map screen that uses odd shapes like 54 x 20, I could use, say, 16 x 16. I could then also keep track of value in each. Say, if the tile triggers collision (which would give me Specific value – not a relative one), or death, or is icy, or anything else I can think of and want to do.

So, yeah. I’m happy with the progress that I made. So happy that I feel an odd urge just to work on it, and this is why the Diary hasn’t been updated in a while. Free Time goes into ThiefEd. Anyhow, almost done with it, and then I can get started on the Content. Yes, the C word (um, the other C word, that you can say in company). Then I can get the game to play and be, well, cool.

No comments: