Showing posts with label Design. Show all posts
Showing posts with label Design. Show all posts

Sunday, May 9, 2010

Design update !!

Hey, I told you all that I would take my time and post something eventually. Well now is the time !

I have been working on the way my main form looks like. I had a few problems: 
First I wanted to get rid of the ugly conversation panel I have. The idea of a form popping whenever you talk to someone is crap, and having to close it again and again is a pain sometimes. I wanted to have some kind of control that would show messages for me. I have recently learned to make my own custom controls and found the idea of having a portable "messages & communication" box quite good. And here is the control and the code: 

The images speaks for themselves. The messagebar has a sub named addMSG() used to send messages to the textbox. The textbox is readonly to prevent the user disturbing the text and because the keys I use to move are the arrow keys I have made a sub to replace the caret (the little horizontal line standing where you clicked) every time a key is pressed. That way you cannot scroll through the textbox inadvertently when moving, only with the scroll bar. 

I have also begun to look into the code involved in moving around. The same 4 subs ( one for each direction) are both used to move and initiate a transition and I think this is a flawed way of getting around since the complexity is very case-by-case and thus need a lot of if's to verify stupid stuff. Due to the complexity of the overhaul this could take some time but I am still working on other parts while I'm digging around for a better solution. 

I have downloaded some tiles on a website because I don't really have *that* much time on my hand for designing .jpegs, time that could be better used somewhere else. They look good and I plan to make use of them someday to showoff a better version of the game. 

The game now looks thus: 



As you see I have made some subs to handle conversation. Now every sprite has an NPC class that is used to store conversation and other relevant stuff. I'll explain it in a later post. On this note see you all at the next post !


Wednesday, March 3, 2010

Design UPDATE !

Yes, an update already. I've been messing around with my IDE and decided to give a go to the design of the game. What I did here was to generate the grid of the game window. As you know in earlier RPG's, the world was a series of tiles aligned in a matrix pattern ( Meaning for example: a 16x16 grid, showing 256 tiles total ) and your character and anything in the game world occupied a single tile. I made a few samples to give me a better idea of what I wanted my game grid to look like.


I had a choice between placing each individual tile on the form, or programatically add them after the form loads. The advantage in adding them after the form has loaded is that your form can be easily modified. As well as giving a greater number of design tweaks. I tried both method thought, placing them manually and automatically. And here are my results:


The one on the left is the automatic, right now is manual.

I chose the colors at random just to give me an idea on the output. Not a lot of difference you might say ? Well when you look at my design form, you can see it is a lot less cluttered. 

Automatic generation yields a much cleaner form designer.


The one on the left is the auto-generated window, the one on the left is the one I added every single tile by hand ( with the help of CTRL+V of course ). You can see the absence of picture boxes on the one on the left because there is currently no tile alive yet. They have yet to be created. Also, the code for autogeneration is MUCH smaller than the manually added at start. 

Let me explain why: When placing controls on the form, even thought you cannot see the related code, some is still created. For a single picture-box, is looks like that
      Me.PictureBox195.Location = New System.Drawing.Point(288, 372)
        Me.PictureBox195.Name = "PictureBox195"
        Me.PictureBox195.Size = New System.Drawing.Size(32, 32)
        Me.PictureBox195.TabIndex = 213
        Me.PictureBox195.TabStop = False
Multiply that by 256 times, and you get quite a big file to load already at start. Meanwhile, when adding them automatically when the form loads, they are added one by one with much cleaner code thus making your source code smaller and lighter. The code I used for both forms is thus:

The first one is for the auto-generate, and the second one is manual. You can see on the second image that the only code running is the color-chooser, thats be cause there IS NO code needed on the main() procedure for showing all the picture boxes. But when you compare the first to the second, one simple method is much cleaner than 265 chunks of designer data.


All in all, auto-generation is a much better choice for the purpose of making game because the grid is not static. As we move to the edge of the screen I have to be able to change the map very quickly and efficiently .