Purchases

Posted in general with tags , on June 18, 2009 by Tau

Today I bought a Wacom tablet. It’s my first venture into the world of tablets but I’ve been thinking of buying one for a long time – using a mouse to draw things is a pathetic way of doing things. I’ve only bought low-spec model, to get used to things and see if it’s something I want to take on seriously. However, upon installation I’ve encountered a problem.

I use GIMP for my graphics and run OSX 10.4 on my Mac. As GIMP uses X11, it needs to get the tablet information through X11, and the latest version of X11 available for OSX 10.4 does not support the full features of tablets. In fact, it treats them as a regular mouse. It would seem that one requires Leopard to get the full features from X11 and hence GIMP. I cannot therefore use my new tablet with GIMP, and as that is all I have, not at all, really. It looks like I’ll have to purchase something, as long as its cheaper than upgrading to Leopard (which I had not intention of upgrading to, being perfectly happy with Tiger).

I’ll try and see if I can find some way around it, but I don’t know.

Compromises

Posted in story with tags , , , on May 25, 2009 by Tau

I’ve decided to (possibly temporarily, possibly permanently) move away from an isometric view to a top down view. This is because of the dramatic increase in data filed entries, and the time to write them, that it would take for the isometric images. For a rectangular image, it’s a simple affair to decide whether a point (eg. the player) lies within a region which may be solid. If this region becomes a triangle of arbitrary shape and size, as it would be in an isometric case, the points of all of the triangles which make up the region must be stored, and deciding if a point lies with them becomes much more complicated.

This isn’t an unsurmountable problem, just one I feel is not worth tackling at the moment, especially when more efficient advances can be made. With the current code, and assuming a grid like layout of the maps, everything is ready for designing multiple linked maps. Along with the message and conversation classes, a simple, static demo could be written.

So that’s my plan, maybe finishing off the automation classes, and also writing something to make non-player characters move around the map. Then I can have something to show for my work.

Automating Game Events

Posted in code with tags , , , , on May 19, 2009 by Tau

One of the major things that’s been bothering me about the code as I look it over is the amount of hardcoded strings, and the requirement for data files to have a certain format. Previously, the events listed in the maps had to have two arguments because when the list of events was created in memory, both arg1 and arg2 had to be set (there would be an error that the input array was out of range without them) which lead to lots of NULLs in the map files.

I’ve altered this. Now the arguments for game events are filled into an array, rather than private variables, so that any number of arguments may be given. This is also advantageous as future event classes may need more than two arguments.

This being an RPG, there’s going to be a need to automate events; those wonderful parts of the game where the story runs off and the player has to do nothing but press ‘continue’ when they’ve finished reading. So I’ve started a class to manage this. All it does is execute an event, and then wait a given time before executing the next one. This is done with the pygame.time.delay() function. Something like:

for i in range(len(events)):
execute(event[i])
pygame.time.delay(times[i])

Although, it’s not finished yet. All the current events have player cancelling built in (like a conversation won’t end until you press ‘q’) which I’ll keep for the time being. Some people read slower than others..

I expect some form of this will be used for the non-player movement on screen eg. village people wandering around. That may be the next area of work for me, although I have started to think about the battle handling. Clearly though, an intensive graphics session is needed.

Isometric Solid Objects – Part 2

Posted in graphics with tags , , , , , on May 5, 2009 by Tau

Returning to the task of making the objects in the map semi-solid. The problem is that I want to draw the sprites as a whole, but define only certain regions as solid. This means I either have to make lots of sub-sprites and combine them, or define a list of regions that are and aren’t solid within each sprite/map object.

More text files to read in, or at least, longer ones.

Each Map Object now references another file which is the image file, this contains a link to the sprite and a list of co-ordinates which are the solid regions within the local co-ordinate system of the map object. These are then scaled to the global (screen) co-ordinates.

So far, all this is read in and the objects created, although they currently aren’t called in anyway. I haven’t gotten my head around how one decides if a given point (i.e the character) lies within a triangular region of undefined shape. Yes, it really shouldn’t be that difficult, I just haven’t got the envelope out to do it yet.

Story Ideas

Posted in Characters, story with tags , , , , on February 21, 2009 by Tau

I’ve been keeping my thoughts on story and characters at the back of my mind for some time, reluctant to write anything down through fear of trivialising the ideas, and because coding is a risk free alternative, which is to say, I can see then and there whether or not my code works; creative attempts can be judged much more subjectively, and can lead to disappointment.

I’ve been thinking about the protagonist, who will, of course, undergo some journey without a defined end, and be forced through trials along the way. Such is the RPG I intended  to make. Why does he/she do all this? It can be Fate, which is an easy way out, or coincidence, that they have some relationship with the events unfolding.

I like the idea that our protagonist is as much like a regular person as can be within the context of the game. They simply get swept along, and are incapable, whether physical or through conscience, to back out.

It is my intention to set the game against the backdrop of a political war between two human nations, a religious war between factions of the main character’s race, and further smaller conflicts. The other playable characters won’t be constant – they will come and go as they follow their own stories, which may themselves be occasionally playable.

Yet, I don’t want to think out loud too much here..

Returning to Work

Posted in graphics with tags , , , , on February 15, 2009 by Tau

Well,  I’ve said a few times over the past couple months that I would be working on this again after a hiatus, and I hope that this time it’s for real. I think the best place to start is to sum up what I’ve done so far (for my own benefit as much as anything else) and post some screenshots of all the features I’ve coded.

Below is how the program starts up after typing python nsf.py into the command line. Yeah, I know, extremely bland. I’m sure I’d feel better about myself if I added some grass or something.

Opening Screen as of 15/02/09

Opening Screen as of 15/02/09

And how the dialogue prints out. I think the 1st thing to do is make that ugly blue box, well, not. Something with a border I think.

Sample of dialogue printing as of 15/02/09

Sample of dialogue printing as of 15/02/09

The basic message printing. Actually looks better than the dialogue, but still needs a proper border. I’ll use the same one for both I think.

Message Printing as of 15/02/09

Message Printing as of 15/02/09

That’s about it that you can see. I should work on some sprites, for morale as much as anything.. hope I can find the time.

Screen Messages

Posted in code with tags , , , , , on December 21, 2008 by Tau

I’ve just finished the classes for printing messages onto the screen. It’s basically the same as the dialogue classes, but requiring fewer variables: the text is read in from a file given as the argument of the event type “message” and blitted to screen.

Coming back to the code after quite a while has made me realise how much I shouldve commented the first time around. I’m going to go through all the files and properly document them, drawing up a diagram of where all the classes and functions lead.

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.