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.

Sprite Creation

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

Or Why I really wish I owned a tablet. Bring on the MacBook Touch, that’s what I say. It’s especially painful as I don’t even have my Wireless Mighty Mouse anymore, so it’s all with the trackpad until I can get to an Apple Store. Now, the process has so far gone like this:

I quickly sketched out an idea for a small town, took a photo of it and loaded it into Gimp. This forms a bottom layer over which I draw the isometric image.

I use the grid to map out the isometricness of it.

This is all the east bit. The parts I’m not sure about are the textures and colours of all the sprites. I haven’t Gimped enough to be confident in this. But, like everything else, I’ll learn as I go along. To be continued…

RPG Statistics

Posted in games with tags , , , , on August 4, 2008 by Tau

Perhaps the defining feature of any Role Playing Game is the representation of human characteristics as an integer value that can be increased, decreased and compared. Now the question arises for the construction of a new RPG, and one that hopefully won’t simply fall in line, is what attributes do we choose to represent, and how?

HP, MP, Str, Def, Exp all are classics that we choose to include for continuation’s sake, but what else? Compassion, Arrogance, Altruism might be included. And what if they weren’t stored as integers, but as vectors, or points within a multi-dimensional phase space; what if they weren’t incremented but subject to a matrix operator? Leveling up would be a thing of the past as your character’s future depended on far more complicated conditions. And now I rant….

Read more »

Solid Map Objects

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

The last thing left on my list before being happy with the movement drawing was the characters interaction with the map objects. Previously, the Character Sprite was drawn after the Map Objects and so would run straight over them. Not Good. So what I’ve done is added another attribute to the input file “Solid”, if this is the case, and if a movement in a given direction would cause the character’s Rect would collide with the Map Object’s Rect, the movement function isn’t called. Thus making the object appear solid.

canmove = True
if movekey[K_LEFT]:
for image in self.thismap.grids:
if image.getSolid():
if image.rect.collidepoint(self.char.rect.centerx – 10,            self.char.rect.centery):
canmove = False
if canmove:
self.char.move(“left”)
self.Scrolling(“left”)
self.drawMap()

Next, I think, I’d like to develop the Character. It may just be a matter of an arbitrary event that gives +10 HP or whatever, and stores for further use.

I’ve also renamed the main file from gametest to nsf0.1, and will keep versions from now on. I’m tempted to use CVS, but it’s just another thing to learn, and my learning list is a little full right now.

Scrolling

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

I’d wanted the screen to scroll when the character moves to regions not defined on screen, as it’s much nicer to look at, and more natural, than printing a new map. After initially trying to do it in a really stupid way, I settled on using the rect class in Pygame. This contains the physical positions of the sprite in the screen’s co-ordinate system, so it’s then just a matter of adding to or subtracting from the MapObjects’ positions when the character’s rect gets close to the edge of the screen.

However, I’ve found that the MapObjects and the Events move at different rates, meaning they’re no longer in the same location. It just means I’ll have to do something I should’ve done from the start and make them one and the same.

Oh, I also put in a few lines to stop the character annoyingly moving off the edge of the screen. Looks like the movement based drawing is nearly there :)

How I do things (Part 2)

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

I wanted to draw the information for the maps from an external file – one that would be much easier to create and modify that code. So rather than have huge streams of code saying thisimage.draw(here) and thatimage.draw(there) I could just have a text file that said (x, y, image) and a few lines of code would read and draw everything. Read more »

If only I lived in Dark Angel world

Posted in games, story with tags , , , , on July 30, 2008 by Tau

I haven’t done any coding today (at least in Python) but I have been thinking about some of the game elements. Way back when I first wanted to do something like this, which was probably about 10 years ago, one of the things that struck me was the slum layout in FF7. I’ve also just finished watching the pilot episode of Dark Angel, and it’s brought back my fondness for post-apocalyptic slums. An idea I had was to imagine that an entire continent had been urbanised, mainly by slums, and then to translate this into a game. Instead of randomly generated dungeons, we have randomly generated villages, forming a much larger city. They wouldn’t form any part of the story (well, some would) but the rest would be for general exploration. Features, locations, items, even the origin of sub-quests could be written into the random generation. My intent isn’t to have the whole world map like this, just one of the cities.

Whilst I like HP based battle systems, I dislike grinding. I hate grinding. What I would like to see is a battle system that combines the traditional methods with one that requires the player, and not just the character, to improve in order to defeat more challenging opponents. This is all.

Next on the code objectives: Solid map objects & Map objects that move