• Advertisement
Sign in to follow this  
  • entries
    16
  • comments
    20
  • views
    4988

Entries in this blog

Sick

I've been dead with a flu/fever recently, and have been spending countless hours asleep in various rooms of my house. My head is spinning and pounding, and it's been impossible to get any work done.

I have, however, purchased a book on AI, and am attempting to read it between migraines. Hopefully I'll finish it soon. I just want to get back to programming again.
CivEdit has transcended to complete, while basic, functionality. This landmark is halled with the sigil 'beta' instead of alpha, and has been been moved to version 0.3.

Whereas previous screenshots were carefully captured to display maximum potential and minimum bugs, I now present you a screenshot of the editor that acts exactly the way it looks like it acts.



Visually, little difference can be discerned from earlier builds. However, major additions have been coded to the structure of the objects, and what information those objects hold. As well, the manner in which tiles are 'painted' on by the user to create landscapes has been drastically altered for maximum intuitiveness. I will now officially begin work on the AI, while simultaneously updating code to the editor. For example, I still plan on implementing a minimap to both CivEdit and CivSim.

Everything is going according to the plans which I never drew. Excellent.

Almost done.

At this moment, I am wrapping up the few loose ends with CivEdit. When I am done, I will draw out a large, detailed map in the editor, and begin work on the actual program. Here's to a crazy ride down the road of AI.
This week has wreaked havok on my brain. I've had a migraine that has refused to succomb to the terrible power of advil and tylenol. Work on CivEdit is coming along slowly, since it's becoming increasingly difficult to think.

I do, however, have good news. Despite the achingly slow rate of development, I have managed to plan out the completion of the first version of the editor. As of now, I am writing the heap of additions and alterations which will result in said version. Areas of development include more code optimization, including object-orienting the code more clearly, as well as coding the final data structures contained by each map element in the array. There is no definitive area of importance, and so I cannot give a clear idea of what is left, without going into long-winded lists.

Edit: To make issues clear, there is no visual difference in the project yet. Thus, screenshots do not apply to this journal entry.
As now it is the weekend, and I have resolved to return to work on the project come the weekend, my conscience will rest easy knowing that I have, indeed, accomplished my goal.

Such efforts have lead to the completion of my Object-Oriented conversion of my editor. Visually, difference can be noted in the fact that you can now drag around the different elements of the editor, positioning them wherever is most convenient.

Next up the line is saving and loading multiple map files. I have given myself a deadline of the end of Sunday to complete this section.

For the time being, here is a screenshot of the result of another day's work:



I am approaching the point in the editor where I may call it complete. If I don't have any more good ideas to add to it, I will name it Version 1.0b, and begin development of the actual simulator agents. If anyone has any good ideas for the editor, please comment, and I will decide whether they should or should not be implemented. Please note when suggesting ideas that the editor is merely an interface designer, meant to supply the 'world' in which the simulated agents will interact. Thus, no additions involving realtime modifications will be needed, such as: scripting engine, weather patterns, animation, etc. This is a static world editor whose sole purpose is to ease the development of 'maps' to be used, instead of manually writing them in a text editor.

Regardless, good idea or bad, I thank you in advance for your input.

Moved out!

Finally, I've packed and moved all of my belongings into my new house, set up the computer, set up the 'net, and had a bit of a rest after a long day's work.

I'll be back programming this weekend.
As of today (since it's AM now), I am officially in the middle of a massive move from one residence to another. As such, I will probably not be properly situated until monday.

The interesting thing is, my job begins monday. I have had the greater fraction of every day to spend on coding, and now that dedicated time has come to an end.

Development time isn't abolished, yet merely cut into 1/4 of the original. However, that does not mean that I'll spend every moment in the workplace putting my mind to finding solutions to algorithms I would have merely sat in front of the monitor and pondered. This won't eliminate all of the down-time, but it should help with quite a bit.

I will not give up on this project just because immediate issues are clogging the arteries of my digital practice.

Edit: As an update on progess so far, I have successfully converted many logical concepts in my program to Object-Oriented algorithms. I can now drag around the map, and will add that 'draggable' functionality to the tile-view (4x4 tileset to choose your bush from), the brush-preview (the brush surrounded by a black square. It's the current brush you have), and the brush buttons (the type and size buttons that show gray when unselected, and red when selected)

Screenshots will come soon.

It's morphin' time!

Up until now, my program has been compile-time scaleable. That is to say, I've written a header file of #defines, and written my code with those defines in mind, so that I could change some, and have the code compile perfectly with the new settings.

These settings included changes to resolution, spacers between the window components, number of tiles on the x and y axis in my tileset.bmp file, etc.

This algorithm will be no more. Today, I will convert absolutely everything into an object, and truncate variables where the defines once stood. Arrays will also be redefined as vectors.

This means that the map's size, the window's size, and everything else that was once compile-time scaleable will now be run-time scaleable, and you will be able to do things like drag windows around, resize the map, add tilesets, etc.

Thus, I close the file for another day's work.

Success!

Oh Lord, for thou art the weilder of thy hammer, thou shalt forge me in thy toil, and toil shall I become.

But, work does pay off damnit.



Three cheers for less-blocky graphics!
If there's anything that fatigues me more than any else, it's pixel art. However, I have a few tilesets ready to go, and will now begin the coding process of making the appropriate tile index drawn to the screen. When I fell asleep, I actually dreamt of an algorithm that will work better than the original one I had planned.

Lesson of the day for me: Whenever I have a #define doing a calculation, ENCOMPASS THAT DAMN CALCULATION IN BRACKETS! Man oh man, was I kept up for too long trying to figure out why a supposed 16 * 16 was displaying 1024.

On a lighter note, I got a job yesterday. I will be slaughtering helpless little animals, and gutting and cutting their carcasses up.

Okay, maybe that wasn't so 'light'.

(Screenshots coming soon to a journal near you)

Progress makes perfect.

A job isn't going to get done unless you work on it. Well, I've been plugging away at my editor yesterday night, and a bit this morning, and have completed a little more of the functionality.

It isn't much, but I keep reminding myself that little bits add up after time. Here's another screenshot of current progress.



Now you can draw with several-sized brushes of either square or circular shape. As well, I created a little 'preview' tile to show you which brush you're currently using.

What you don't see here is that there are actually many more tiles than are shown. They're just different orientations of the tile, which I'm going to use to eliminate a lot of the blockiness you see before you.

Next up for coding is just that: whenever a tile is drawn to the screen, it's going to check all eight tiles surrounding it, and redraw those tiles, as well as the center tile, in orientations of their respective tiles that will better graphically represent the 'edge' of the tile.

Wish me luck.

Footnote: I'm going for a job interview today. If I get the job, I will have many hours of coding time forced away from me. However, that neither means I will abandon work on the projoct, nor hope that I don't get the job!

Footnote2: I am an employed man.
I let the whole of yesterday pass by without any screenshots taken of current progress in CivSim. Well, I'm going to finish up a few things in the editor today, and post a screenshot of it. Know in advance, though, that this is simply the culmination of ~3 days of work on the thing.

It isn't pretty, but it's starting to become a little bit functional.

AND HERE IT IS, PATRONS! (Previous comment is emphasized)



The editor takes the brush that you choose by clicking on a tile to the left, and 'paints' it into the array which represents the map. All you need to do is click in the viewable area (which can be scrolled around per-pixel, since the map is larger than the edit window) and drag your mouse around to paint tiles inside.

I'm currently working on creating brush types and sizes. Thus, you can paint tile-by-tile, or a 2x2, 4x4, 8x8, or 16x16 'square' or 'circle' of tiles at a time.

Edit: Most of today's work went into code optimizations. This is essentially how I code in general. I can break my coding time down like so:

20% - Write the base code, make sure it works properly.
60% - Optimize a large chunk of code that has nothing to do with what I'm working on at the time being. These optimizations just pop in my head while I'm coding, and I immediately stop what I'm working on, and make the changes, so I don't forget later on.
10% - Idiot-proof the code, so nothing can go wrong. I've become so used to thinking about coding this way that it's drastically reduced in coding time, since I now just naturally think of the possible errors first before coding. This has made life easier.
10% - Throw in some 'glitter' code, which is essentially little ideas that usually form the foundation of a new 'base code'.

Working away.. phew!

Whether it's training in the art of thrust and parry in the ages where kingdoms warred each other, or studying the mathematical art of coding a game, one truth stands its ground: nobody said learning is easy.

I've spent the better end of yesterday perfecting the display of the map in what I now call 'CivSim'. Basically all it does is take values in an integer array, reference those values to a bitmap, and display it to the screen. Needless to say, that was the easy part.

What I wanted to do is be able to have a very large map where you can scroll using the arrow keys. And I wanted it done not per-tile, but per-pixel. Obviously, I needed to mipmap the edges of each tile on the edge of the screen that weren't displayed. That definitely proved to be more code and logic than originally anticipated, since I had to account for any humanly imaginable resolution (the window will be able to be any size by any size). It's done now, however, and life is good, so rejoice!

I will definitely post some screenshots as soon as I've completed the map editor. Since this is my first time coding anything other than example programs from a C++ book, I am proud to announce that I have, as well, properly implemented reading and writing to files so far, so I may store the maps. It feels great when such simple victories hold so much value.

Edit: Thank you, Rob, for your helpful comment. Your tutorial site looks quite intriguing.
Chalk one up for the small guy. I've dug myself into the glorious hole of graphical API, and I don't plan on finding my way out anytime soon.

SDL is my little pawn for the time being, until I get a good hold on more advanced topics, and finish my little pet project. I've already coded a Tetris clone using the help of several tutorials, so I'm going head-on with this project all by myself. When I've completed this, and utterly polished it to perfection, I will continue my journey by reading the book 'Programming Role Playing Games with DirectX - 2nd Edition' by Jim Adams.

My to-do list has thus been revamped and updated:

***API***
SDL - Learning
DirectX - Next to learn
OpenGL - Final study

***Project***
Civilization simulation - In progress*

---
As you can see, I'm actually working on things, and not letting 'life' get in the way. This is life, and life is good :)

* Working on drawing tiles to the screen via a bitmap and an array of integers defining each tile on the map. When the code is clean and working properly, I'm going to work on loading the information into the array from a file or files. Finally, I'll create a map editor. After that's done, I'll think about what to do next, and update here.

PS: On a final note, I would like to thank those who commented on my first entry. Thanks for the warm welcome, my brilliant peers!
Sign in to follow this  
  • Advertisement