Too Long Away

Posted in general on November 21, 2008 by Tau

It’s been some time since I’ve written here, and indeed quite some time since I’ve done any work on the the game. I envy all those who can manage their time. I would say that I’ve been working on the storyline in my head, but that would probably be a lie. I have made a nice brain storm of it all, though.

I had been working on a simple message class, very akin to the dialogue classes, just without any interaction (other than pressing a button to get rid of it). I suppose I’ll have to write a “choice” class as well, which again will have most of the same code as the dialogue. In fact, the dialogue classes are prepared for a “gamekey” function, I just haven’t decided how that particular system is going to work.

Really, I’m going to get back to work on this.


Apache, MySQL and PHP

Posted in code with tags , , , on September 1, 2008 by Tau

It is my eventual goal that this blog, with additional elements, be hosted by myself as a fully functional website. As with the game itself, this comes not from a belief that the traffic will warrant it, but rather from a desire to know how it is done, and as a creative enterprise.

To that end I have been attempting to install and link together Apache, MySQL and PHP on my Mac. Now I know Macs come with this pre-installed, but I thought I may as well get the latest releases. Here began a labour of Hercules.

I was aware of the existence of packages like MAMP which bunble Apache, MySQL and PHP together, providing you with the directory htdocs and db for the MySQL databases, along with all the MySQL scripts. It comes with a nice GUI for turning the servers on and off and a web interface for creating SQL tables and the like. Well, I thought, that’s just for people who don’t know what they’re doing (people, it turns out, like me). So after downloading the latest releases I set about building them. Apache went quite smoothly, and I was running HTML documents on localhost through firefox in no-time. PHP took a little more time, as I ultimately had to amend Apache’s configuration document httpd.conf so it knew what to do with .php files. (Note: I really wish I could go through everything in detail, and I wished others had done during the many hours of googling, but I have of course forgotten).

MySQL just wouldn’t work. It constantly timed out due to some problem with the pid file, and despite plenty of modifying of my.cnf or changing of permissions, nothing seemed to work. Strangely, it did briefly. The server didn’t time out and I could run the mysql script, although it wouldn’t connect via PHP in a webpage. So I restarted my computer, and the nothing worked. Not MySQL, not PHP, not Apache.

Finally, after numerous re-installs and re-builds, I gave up and used MAMP, which runs perfectly. When I build a server to host a site for real, I’m sure I’ll deal with this again, but for the moment it’s simply about learning the tricks of the trade.

Isometric Solid Objects

Posted in code with tags , , , , , on August 24, 2008 by Tau

Now I had succeded in making the objects solid, although this worked only so long as said object was supposed to be a rectangle (because the method used the collide() function, checking to see whether the character’s and map object’s rectangles collided). However, with an isometric map the objects are far from recatngular; they’re rather pointy.

Now my plan to solve this is to create another type of input file, for each and every image. This would contain the name of the image file, plus a list of co-ordinates that map out the solid regions of the image. When the map loads, all of these could be fed into an array of solid areas, and the character’s position checked against these whenever it moves.

The code is nearly complete, although so far unchecked. I’ve found debugging tends to scale exponentially with lines of code.

Dialogue – On the Screen

Posted in code with tags , , , , on August 18, 2008 by Tau

Well, kind of. That which used to print in the terminal now appears as ugly text in an ugly blue box on the screen, and disappears when the conversation finishes. I moved the construction of the screen window to an external class that as a Get Screen function, which can be called by any other class, and thus drawn onto by any other class. It means all sorts of goodies can now be drawn whilst the main loop is running, such as dialogue, messages and menus. That said, my code is still ugly as sin.

I just need to create an image for the dialogue box to make it a little prettier, and it’ll be done, aside from writing the code for conversations generating gamekeys, by which I mean, for example, speaking with a NPC and getting some information from them allows you to proceed to a new area or whatever.

Next I think a few more events, such as finding items and attribute changes, and then really get going with the sprites, at least in order to finish this village and work towards some form of simple, wander around demo.

Dialogue Update

Posted in code with tags , , , , on August 17, 2008 by Tau

So I’m trying to get the dialogue to print out on the screen rather than in the terminal. Currently I’m doing this by sending the background all the way through a few functions to the dialogue class, where what is usually just printed is made into a new surface and blitted onto the background. This works fine.

However, the display won’t redraw in the dialogue class, only in the mainloop, meaning you see nothing until the conversation is over, and it all appears at once. Marvellous, if you’re psychic.

I really can’t see why this is. If the dialogue class can get information from he keyboard via pygame, and blit onto an existing surface, why can’t it simply redraw the screen? What’s so special about the main game loop? Is it because this is where the screen is created?

I wish I had a Magic 8 Ball.

Where now?

Posted in general with tags , , , on August 14, 2008 by Tau

I’ve done nothing on the game for a few days now. I have been busy, but also I guess I’ve reached a point where I’m not sure where to go next; obviously there’s a huge amount to do, not least continuing with making a sprite set. I think I should go back to working on the character development subroutines, ones that alter the basic characteristics or attributes of the character and are stored for later use. Perhaps also a save game function might be well implemented here.

I’d like to increase the number of Event functions there are to include non player-initiated ones, and also to finish up with the dialogue so that it prints in the screen, rather than in the terminal. Well, seems that’s what I’m doing then.

Creating Sprites (Part 2)

Posted in graphics with tags , , , , , , on August 9, 2008 by Tau

So I finished off the basic line drawing of the Church I was working on, and then added some simple colouring. Just to see how it would look within the program I switched off the sketch background, cropped and re-sized the image.

The additional sprites you can see below are purely for testing out the movement, drawing and event code. I will (very soon) only be using my own sprites. They were obtained from Charas Project Which is a great resource for Top-Down RPG Sprites. I believe it’s actually intended for RPG Maker, but just as useful for coded projects (NB I forget precisely from whom I took these few sprites, and I apologise. They will not be used in the completed game).

Once this image loaded I noticed some lag in the movement, and a whirly CPU fan. I suspect this is due to my usual memory intensive way of coding. I’ll go back through and stop making every single loop do so during the main While 1: loop.

On a slightly separate note, I’ve animated the main character during movement. Basically I just changed the sprite to the next in a flickbook type collection of sprites every 5th time the move() function is called.