Categories
Game Development Personal Development

Oracle’s Eye Development: The Room

I believe I already mentioned how unproductive it is when I try to design the code to Oracle’s Eye. When I was last working on the project, I was able to move some functionality from one class to another. It basically cleaned up my code and made it easier to work on additional functionality.

Still, it didn’t really seem like a lot of progress. I want to make it possible to load a complete Room. When I started this most recent programming session, I had hardcoded some Tiles and had the Player moving about. They didn’t interact, which was fine. I’ll work on that functionality later.

In the last few weeks, I found that I was spinning my wheels trying to figure out which class should own what objects. At one point, I realized that I don’t have anywhere near the experience required to make the decision about how the game hierarchy should be designed. As much as I didn’t want to do so, I think hacking out a solution would be better than not implementing one at all. Once I have something, I can always fix it or refactor it. Nothing has to be permanent, and I don’t need to worry about destroying my progress so far because Subversion has all of my changes. So, I dove in.

I actually decided to create a GameWorldFactory class. I’m not terribly familiar with design patterns, but I wanted a class that would be responsible for creating objects of different types and make them ready-to-use. Well, to do so I figured that I would need the GameWorldFactory to know about the current Kyra Engine. PlayState currently owns the instance of it in a private pointer called engine_, and I decided that I would just have the GameWorldFactory constructor take the engine pointer as an argument. Maybe later I’ll decide that the GameWorld should own the KrEngine, but for now, I just want to get something accomplished. I don’t know enough at this point in time whether it results in a bad design. I have a feeling it is wrong and that there is a better way, but I can fix it later.

It wasn’t that hard to create the factory. The code to create the Player wasn’t too different from what I already had in PlayState. Since I didn’t really have much in the way of a Room, I had to do a bit more work, but again it was fairly simple to implement.

In the end, I managed to accomplish my goal for the evening and make a Room. GameWorldFactory hardcodes the default 10 x 4 Room, but I also plan to make a createRoom() that takes a file as an argument. Naturally it would be used to load levels of some sort. Perhaps I’ll also make one take a vector as an argument so that levels can be loaded from memory instead of from the hard drive. I’ll deal with that issue when I need to do so.

Here’s a scaled down image of the stick figure Player in a portion of the Room.

In reality, the Player is on top of the Tile sprites, and they currently know nothing about each other. I’ll work on putting the Tiles and Player in the right hierarchy so it is easier to do hit detection. For instance, the game should keep the Player from walking outside of the Room by making sure that the Player can’t walk through Walls.

Now for admitting something: I came home not wanting to work on this project even though I dedicated the evening to doing so. I was really tempted to play a game or watch television. I don’t know if it just seemed overwhelming to start or if it was just that I didn’t anticipate it to be enjoyable. Something was nagging at me not to work on Oracle’s Eye, but I decided not to listen to it.

I told myself that if I could just start and work on it for an hour, I’ll give myself permission to play Empire Earth or do whatever else I may decide to do.

Hours later, I was putting the finishing touches on the hardcoded createRoom() function so that I could get a nice 10 x 4 Room lined with Walls and filled with Floor tiles. It’s almost midnight as I write this post. I love being productive, even if it is weird that I could trick myself into doing it. B-)

2 replies on “Oracle’s Eye Development: The Room”

Well, I suppose that’s OK tricking yourself into some hard work.
After all, that would be unnatural for a human being not to procrastinate. 🙂

Yeah, I’m still surprised at how strong the desire to quit is. I remember that while I was working last night I had the thought that I am not going to be able to make a game of high quality. Ever.

Dismissing such thoughts is getting easier. I mean, every time I persevere and finish a session, I find that I get a significant amount accomplished. I quickly point out to myself that if I don’t actually try to do work, I end up with the same amount finished as I had left it the last time. Why not at least try to do something, since the worst that can happen is the same as the best that can happen if I don’t do anything?

Even if I find that the changes I made are bad and the code is reverted back to the last good version, I’m still better off because I now know one way that doesn’t work.

Comments are closed.