Wednesday, October 22, 2008

Minor update

Just a minor update before I forget about it. I've got 4 exams and 4 projects due in the next 8 days, so I'll likely (or shouldn't) get much done on this. I have, however, successfully figured out how to connect the gameplay loop to an event timer so that after the passage of X amount of time, the geoscape clock automatically updates. A few bugs surfaced though... in that it's possible for the forced refresh of the zoom to interfere with the forced refresh of the time update... (which makes for some interesting things as it's rendering the ascii matrix) I've got a few ideas how to fix this. Also, I've got an invisible variable properly moving the horizon, now I just need to modify the rendering methods so that they access this variable to see if it should render the element in question as day, dawn/dusk, or night. That's about it. I'm pretty sure that this project will go on hiatus for a month in November as I direct my extra time towards the NANOWRIMO. (National Novel Writing Month) I'll likely post on here about my progress with that, and at the very least, have a link to my progress bar as I slog through 50K (or more) words in 30 days.

Saturday, October 18, 2008

More Geoscape

So, as you can see, I've done a bit more work with the geoscape. I've added the time/date window, which properly increments through arbitrary amounts of time and such (except it doesn't yet correct for leap year, as if that really matters) Also, I've added the 'controls' though, none of them do anything yet. However, I HAVE added zoom in and zoom out functions, though the x,y coords of the view screen don't change when you zoom in/out. (I'd like the zoom to focurs on whatever is in the center of the screen. Perhaps I'll fix that later. A few more lines of code and this will actually progress through time with the user being able to change how quickly time progresses. I currently have the capability for the world map to include differing colors, textures (IE, desert, arctic, etc) I just haven't gone in and changed any of the #s to something else. Once I get the time progressing, I'll add in the night/day progression when you can actually see where night and day are on the world map, then I'll add the layer(s) which will let me see where the (if any) bases are, and cities perhaps. (though I doubt I'll put in any cities right now, at least, not more than 2 or three, just enough to make sure it works. I think I'll have the cities be asterixes or something on the world map, and the ASCII characters will be followed by a sequence of city names, in the order that the asterixes were found in the map file. I could do the same the countries, except that I don't know how I would define country borders, through the map. I could make it a bit more simple, and just have a country's capital/center of mass or something be labeled and connected to it's starting pay amount... and anytime there is any activity that would cause a country to increase/decease its payout, the location where said thing happened will be calculated for its distance from the nearby countries. Or something... but I might not do that.

Wednesday, October 15, 2008

Just a bit.

I fiddled around with my code and fixed the color output for the geoscape window. I also changed it so that scrolling makes it jump 5 sqaures at a time and shift-scrolling takes it to ten. I fixed a weird bug that caused the bounds-checking when moving to get borked. The fix is just a hack though, until I figure out where I got X and Y values crossed. But, out of this, I have the basic framework for all of the file-parsing (I assume that I'll have rooms and components of levels saved as editable text files) functionality. Next, I'll implement a zoom (which will basically print every other unit in the array (though, will arbitrarily place 'important' units nearest where they actually are, IE, Bases and the like.)

Tuesday, October 14, 2008


I've just been fiddling with the Geoscape, which appears once you select a difficulty. This is what I have so far. (It loads the world map from a text file when the game is started) and yes, that is a scrollable window, using the w-a-s-d keys. The colors are off for some reason, but I'll have to figure that out later. Also, I'll need to streamline things because the scrolling isn't as smooth as I'd like it to be.

Monday, October 13, 2008

I guess I could start with the beginnig

So, I've been cobbling things together, building stuff, writing LOTS of method stumps and stuff. I'm slowly plodding through, trying to implement things... allow myself to implement things in the future, etc. When the code is executed, this first window appears first. (It'll likely follow a nifty ASCII graphic image in the future)

Selecting "New game" causes the next image to appear, and from there, a WorldManager object is created with the proper difficulty level.
I find that as I do things, I write code in one method until I have a chunk of it that seems to go beyond what that method was meant to do, so I cut it out and put it in its own method. I don't know if this is the normal way of doing things; I've never programmed anything this large before.

I still have all of the tactical code that I wrote before, (only a fraction of what I'll eventually have) but it's just floating around in unacessable methods. Next I've got to build the 'geoscape' setup and get some of its functionality working. This is quite good fun, and once again, I should be doing Calculus 2.

Friday, October 10, 2008

Multiple windows goodness, less cumbersome data structures!

Nothing too fancy; I've just reorganized some things so that they make more sense and follow encapsulation rules better. Also, I made a message window which will receive any/and all messages such as "out of time units" and the like. I should really be working on my Calculus 2 homework.

Monday, October 6, 2008

Just a little further

There! I have expanded my color/background choices so that for each color option, there are four levels of background darkness... you know, to help make the atmosphere correct... you know, for the night missions.

I've got an ad-hoc setup right now that allows the display manager to access the character and information representing the color scheme. I might change it, but I'll have to think about which things I want in which places. Mostly, I just wanted to see if it could work.

Beginning of the redesign

After doing more thought and planning (of which I still need to do much more) I realized that I didn't have any way to easily change the color of the characters I was printing to the screen. I just started to rewrite my display manager class and I have a working proof-of-concept for this. each aspect of a world map/etc will be a 2 dimensional(or three dimensional once I implement different layers/levels) array that will store an object in each array index that will have two things: a character (to be displayed) and a short integer that will be plugged into an array which holds SimpleAttributeSets. I'm sure that this isn't the best way to do this, but it works. I'll leave it alone for now. I'm not sure if I want to have the array with characters and style attributes completely separate from the world array (which would hold linkedList objects to show which things are in a specific square), or if these would be one-and-the-same... and there would just be a public method in the world class that the display class can access (which will return an object with the character and style data)

Saturday, October 4, 2008

Kneeling, changing the look direction

Well, I have implementing the toggling of standing and kneeling. Also, when you move a direction, you also end up facing that direction once the move has completed. (and you have the option of just changing the unit's look-direction without first moving)

But... I don't think I'll add any more features until I finish a reorganizing of my data structures and stuff... It's getting cumbersome quite quickly. To the flowcharts!!!

Wednesday, October 1, 2008

Yay for KeyEvents!

So, I've got a working Java frame with working KeyListeners. It's kind of nice, because it's easier now to issue commands.

Tuesday, September 30, 2008


Well, I haven't added any new features really, but I have managed a crude implementation that outputs the game to a JTextPane. It's a bit silly and is set to autoscroll, (I haven't quite figured out how to clear the stupid thing each round), but the use of these frames and such allowed me to implement KeyListeners, which I am VERY excited about. I now can just hit keys quickly and it updates from my commands. No more using "keyboard.nextInt()" and having to hit enter after each command. If anyone knows an easy way to clear a JScrollPane with a TextPane inside of it, please let me know.

Monday, September 29, 2008

Due to an entire weekend of relatively unplanned apartment-moving, I've not done much with the code. I have, however, set it up such that if a unit is moved off of the screen, the screen will center on it. I plan to change this, once I implement LOS, this will govern when the screen gets recentered.

Friday, September 26, 2008

A little bit more exciting

So, I fiddled around with it a bit and I now have it to the point where tabbing through squad members changes the focus... the vieport snaps to wherever that unit is (and tries to center on it), also, whatever unit is active shows up as a different character. Also, it now costs time units to move around... to move up/down, left/right costs 4 and to move diagonally costs 5 (which is less than the square root of 32, you know, Pythagoras, etc.) The TUs get depleted as each unit moves around and once the TUs are gone, the unit is frozen.

Thursday, September 25, 2008

So, slightly more exciting. I've got it generating a variable number of player characters. They also now properly move around (under user control) and you can tab between then. I've realized that my data structure is quite cumbersome, so I'll probably re-impliment part of it over the weekend using a better structure and such... it works fine now, but it's a big pile of spaghetti... which will easily become unmanageable as I add more things to it. Also, I need to learn how to set up some sort of CVS system or something. Also, you can't tell from this screen, but I have a variable-sized view-port that properly scrolls around (with prompting, of course) such that the level map could be something like 200*200 and the view-port only 25*25, and you could scroll around to see whatever parts of the level you wanted.

Only midly exciting

So, nothing too exciting yet. I'm in the middle of incrementing some very rudimentary things. Here's a simple screen shot of my progress so far. Hopefully by tonight, I'll have multiple units that can each be moved and also tabbed-through (picture playing X-Com and tabbing through your squad members)

Wednesday, September 24, 2008


I was just experimenting a bit and I wrote my first few lines of code. I now have a few classes, (Main, Display, and World) basically, World keeps track of a char[][] array that contains some randomly generated characters. Display keeps track of the view-port location, which can scroll freely around to view the char grid using some simple input commands. (the size of the view-port and World array can both be adjusted, for example, I had a 25X25 World array with a view-port of only 10x10, which meant that if I 'scrolled' around, i could only see a 10x10 square portion of the entire world at one time. Nothing big, just a fun bit of experimentation. :-)

Seriously... an X-Com Rogue Like.

Oh, I'm writing this in Java using Eclipse... which I know won't be as powerful if I were to write it in c++ or some-such, but, I'm the most comfortable with Java, so, this is what you/we/I get.


So, I'm an undergraduate computer science senior at Eastern Michigan University. I hope to use this place to post about my various personal projects; most of which will be programming related. Hopefully, some people will stumble across this and offer input and insight into the things I am doing.

Some things that I've been thinking about recently:
1. a Rogue-like game based heavily on Micropose's X-Com Ufo Defense
2. a terrain simulator, including such things as water and wind erosion, weather, fluids, tectonic stress, etc. (which could be used to generate and evolve interesting landscapes for various uses)

I have a livejournal page at Livejournal and my personal web page at my university.
I'm also on Facebook and AIM. Message me if you wish to contact me at either place.