Devblog:


26th December 2008:
Hooked up accept button, custom races seem to be working. Also made ships display and manually inputted all frigate variations for red, yellow and green along with the first for white banner colour. I'll have to do the rest later. I went on to add scroll buttons for fleets with over 15 ships and a text notification of number of pages of ships in the fleet. I then hooked up the select all toggle button, individually togglable ship selection and background graphics for selected ships in the fleet. Next, I made a system for naming individual fleets and display the name on the fleet menu. Then I made individual ship types and names appear on mouseover.

Finally, I implemented fleet splitting so that when you don't have all of a fleet selected when you make it move, it splits the unselected ships into a new fleet left at the planet. When a fleet reaches a planet that its owner already has one at, the fleets now merge. This was tricky to get to work correctly but it now works.

Further goals are:
- Make it impossible to fly to the planet you're already at.
- Allow fleets to be selected en-route to be viewed.
- Fleets en-route will display red text stating they are in hyperspace and cannot be redirected.
- When a fleet is selected, it should immediately blank the previous highlighted system.
- Figure out why the ETA can read 2 turns but there be only 1 turn left. Borderline extremely rare case. Save 4.
- Fix load game, seems to crash with a nullpointer. Make sure loading format is consistent with saving format.

Screenshots

25th December 2008:
Finished the custom race screen completely.

Further goals are:
- Hook up the accept button, test that custom race works.
- Display ships in the fleet window.


24th December 2008:
Was getting bored stiff over christmas and decided to work a bit more on the project. I refactored some of the code to make it easier to deal with, fixed a few bugs and created the custom race screen. The screen currently does not have selectable buttons and doesn't customise the race, but the correct information is displayed and the correct highlighing takes place. The next step is to implement the mousehandler portion, which shouldn't take long at all.

Immediate goals for further development are:
- Put in the score multiplier thing.
- Implement custom race name changing.
- Implement custom race clicky buttons and verify that it works correctly.
- Put in any new rules needed e.g. food bonus and lithovore being mutually exclusive.
- Display ships in the fleet window.

Screenshots



13th September 2008:
Fixed the fleet fly method, they now fly toward their destination at their selected speed and note when they arrive. I developed a system to tell fleets to fly to certain star systems and once they arrive, they plant themselves there. Up to 10 fleets can be at the same planet (technically only 8 ever can be but the system supports 10 if needed) and they're displayed at different places around the star. Also implemented the ETA timer and it appears to be accurate upon testing.

I made the fleet window appear when a fleet is clicked but made my own fleet window instead of using the standard one. This was just so I could reuse the code for dragging the system view window around.

Immediate goals for further development are:
- Display ships in fleet in this window. Add scout icon to test.



10th September 2008:
I tested clicking on fleets after teleporting them around, which works fine.

Immediate goals for further development are:
- Fix fleet fly() method.
- Make clicking on fleets bring up the little fleet window.
- Display ships in fleet in this window. Add scout icon to test.
- Make larger fleet window show for larger fleets, add scroll pane.
- Fix that bug where not all systems show or inappropriate systems are given homeworld status. No idea what causes this one.


09th September 2008:
I'm nearing one month of actual work on the project. That's not a full month of hours, it's just 30 separate days that have been spent working with 2-10 hours per day (average 4-5). That's about 100-140 hours spent working on it so far. I think it's coming along nicely for that kind of time spent on it. I'm trying to get a lot done now since university is about to start again and I'll be left with less time to work on it.

Today I made colonies unable to go below 1 colonist as planned but I think later I will change this to allow colonies to drop below 1 colonist because the idea of a colony being turned into a ghost town that can be plundered is desirable. Fixed a bug with starvation where planets wouldn't stop starving once normal food levels were restored. Also fixed a bug where races with a farming bonus were able to farm barren environments. I went on to create a running production total on planets and make it so that buildings will build when complete. Also created a running total of RP but have not implented the actual researching yet.

Next I put in images for each of the space monsters and made them display on the map and systemview. I've only actually incorporated four space monsters, three that are old and one I made up. Space dragons, amoeba and crystal still exist as they're the iconic space monsters but I removed the hydra and eel. I may put the eel back in for a random event but for now it's out. I added a new space monster which is an orbital defense platform left over from a previous civilisation. Each monster "likes" a specific type of planet, which means systems with those monsters will be given one special planet matching what the monster likes.
I then made the building that is currently being produced appear in the colony view with the number of turns remaining. And finally, I went on to develop a basic fleet system. Fleets exist at planets currently and little icons are displayed correctly next to the stars. Clicking on fleets also works (currently just prints out test output) :D.

Immediate goals for further development are:
- Make clicking on fleets bring up the little fleet window.
- Test clicking on fleets after teleporting them around (not at planets any more).
- Display ships in fleet in this window. Add scout icon to test.
- Make larger fleet window show for larger fleets, add scroll pane.
- Fix that bug where not all systems show or inappropriate systems are given homeworld status. No idea what causes this one.




06th September 2008:
I finished inputting all the race data in and have made it so that all of the picks are taken into account. Aquatic, tolerant and production/farming/science bonuses are all working correctly, as are large homeworld, rich homeworld, artifacts world, highg and lowg. I went on to the end of turn mechanics. First I completed the planetary growth and starvation mechanics. If total food minus total food usage is under 0, a list of colonies is created and ordered by lowest total food output (food - food requirements). This list is run through in order until enough population units have been starved to satisfy the total food deficit. Each starved population unit decreases the growth rate by a flat 25k currently, I'll worry about balancing it later.

Immediate goals for further development are:
- Make it so that population can't decrease below 1.
- Create running production total on planets and update at end of turn.
- Make it so that buildings complete when prod total > buildcost of buildqueue[0].
- Create running research point total and add to it each turn.
- Make graphics for each space monster, place at planets.




27th August 2008:
Finished map generation algorithms and homeworld placement. Homeworlds are never placed near each other and start with four planets. The home planet is medium terran abundant and the remaining three are strictly controlled. One is small and rich, another is medium abundant and the final one is large and poor. All three of these planets are between radiated and swamp class.

Immediate goals for further development are:
- Complete race stats
- End of Turn mechanics




19th August 2008:
Finished the game load and save features and hooked up the UI for them, which looks quite good. Also added the autosave and quickload (continue button) features. Autosave saves every 20 minutes and when a new game is created. I also changed map generation to dispose of grids after using them (small background optimisation that was annoying me). I made a method that draws text in a given font and colour with a black one pixel border because I found myself repeatedly doing this throughout the code and it should clean up the code a little.

Immediate goals for further development are:
- Re-examine map generation algorithms

Screenshots



18th August 2008:
Completed most of the remaining development goals. Games can now be created via the new game menu and the enemies are randomly selected with no duplicate races or colours. Custom races are not in yet but they can wait. The game menu is in and the new game, return and quit buttons all work on it. All that remains is to create the save and load windows and to implement save and load methods.

Immediate goals for further development are:
- Create Game Save window. Have it save all of the game's details to a file.
- Create Game load window. Hook into main menu too. Have it reset all varables, load game details from file and refresh screen.
- Hook up quit option on the main menu
- Change map generation method to create, use, then dispose of grids rather than keeping them around after they're used.
- Re-examine map generation algorithms

Screenshots



16th August 2008:
Got some more work done. I created the main menu screen and hooked up the first option to autogenerate the map for testing purposes. I created the New game screen and hooked it into the main menu screen. The player can select variables such as number of opponents, galaxy age etc just as in MOO2. Clicking Accept proceeds to the race selection screen, which I also made. The mouseovers on the race selection screen work and the next step is to add the text info on mouseover and clicking to select a race (a very simple task).

Immediate goals for further development are:
- Finish race selection screen mouseovers with text about the race.
- Select race on click.
- Implement flag colour select screen. Change player colours to match flags.
- Implement "Game" menu on screen 1 with save, load, new game and quit buttons.
- Hook in return button and escape command for "Game" menu on screen 1.
- Create Game Save window. Have it save all of the game's details to a file.
- Create Game load window. Hook into main menu too. Have it reset all varables, load game details from file and refresh screen.

That lot should keep me going for a good while. After that I can re-examine map generation.
Screenshots



15th August 2008:
Technically it just passed midnight when I wrote the last devblog so it's the 15th now. I spent the wee hours of the morning implementing the blank Fleet screen and the Races screen. I plan to make a new system for spying where agents are placed on individual planets so I haven't bothered filling in that area of the races screen yet. The race pictures, colours and names are displaying correctly and the hostility ranking from -100 (least hostile) to +100 (most hostile) is working fine too. Treaty detail text will have to wait until I'm completing the mechanics behind them.

Immediate goals for further development are:
- Create Main menu (intro) screen. This will be the new first screen displayed. Game will no longer generate map on start.
- Hook up "continue" button on main menu to generate universe as it is currently done for quick testing.
- Create New game screen and hook it into the main menu screen. Allow selection of variables (galaxy age etc). Generate game based on those variables. Randomise enemies.
- Create Race selection Screen and hook it into the new game screen.
- Implement "Game" menu on screen 1 with save, load, new game and quit buttons.
- Hook in return button and escape command for "Game" menu on screen 1.
- Create Game Save window. Have it save all of the game's details to a file.
- Create Game load window. Hook into main menu too. Have it reset all varables, load game details from file and refresh screen.

That lot should keep me going for a good while. After that I can re-examine map generation.
Screenshots



14th August 2008:
I completed all of the previous development goals (only took about 30 minutes, I probably should have come up with more) except the last one. I can't be bothered fiddling around with images right now and will come back to that some other time. With the colonies screen complete, I moved on to the Planets screen. I completed the entire planets screen, including the sort priorities, list scrolling and display restrictions. The next step I have listed is the fleet screen. However, I've decided to do something a little different with fleets. This screen will be for creating proper fleets with formations and a flag ship. The flag ship would get defensive bonuses to keep it alive for longer in a firefight. I have also come up with a system to make mixed size class fleets desirable and effective.


This is a diagram of how the interference system is proposed to work for fleets. In this example, we have a fleet of 3 battleships against a fleet of 1 battleship, 2 cruisers and 2 frigates (I'm pretending destroyers don't exist for the moment). A battleship attacking another battleship uses 100% of its beam attack. A battleship attacking a cruiser uses 50% of its beam attack. Dropping another size class, a battleship attacking a frigate would use 25% of its normal beam attack. Conversely, a cruiser shooting a battleship would get its attack bonus doubled to 200% and a frigate doubled again to 400% (may reduce this if it proves to be too much). Note that these values will be for to-hit chances only and I don't think I'll make beam attack affect damage.

The white arrows indicate interference links that must be from a ship to another ship one size class larger, with a maximum of two links applied to each ship. With two frigates running interference on it, the enemy's attack rating used when hitting the cruiser is universally halved. In this case, the enemy battleship attacking it has his bonus halved due to size differences and again due to interference, causing him to use a final value of 25% of his actual beam attack. Likewise, with the two cruisers running interference on the battleship, the enemy battleships only use 50% of their attack bonus.

In this example, the fleet on the right is more effective and cheaper than the fleet on the left. This system is designed to encourage fleets using all size classes of ship. The interference links will be set up via the fleet screen, will not be changeable during combat and will be automatically applied in-combat. Large distance between ships may cause links to disengage to prevent people flying their frigates far from the battle.

Rather than invent the new fleet UI now, I will just do a quick blank screen with an exit button and skip on to the next screen. I have elected to skip the leaders screen as well for now since I do not know how I will handle leaders. I like the idea of leaders arising within my empire rather than being hired and will explore the idea later. Next up is the Races screen, which should be relatively straightforward.

Immediate goals for further development are:
- Create blank fleet screen with exit button.
- Create Races screen.
- Create Intro screen.
Screenshots



9th August 2008:
Got a little more done. Food and RP are now totalled across the empire and that total is displayed correctly. I implemented a basic end-of-turn method too and income/rp/food totals are recalculated both at the end of turn and when a population unit is picked up or put down into a new job.Picking up population and placing it into other jobs is now possible on the colonies screen. Unfortunately, it is possible to move people between colonies this way for free and population limits are not enforced. These oversights will be corrected next. I have implemented the ordering of colonies and linked that ordering to the clickybuttons. I need to put the images for the active clickybuttons in next.

Immediate goals for further development are:
- On the single colony screen, return colonists to where they previously were if Escape is pressed or the screen is exited.
- On the colonies screen, cache the colony people are being taken from. Compare to the one they're being put in and deny cross-colony movements not within the same solar system.
- For cross-colony movements, ensure that population limits are taken into account.
- Implement brightblue clickybuttons for active mode. Default is order by name.



7th August 2008:
Getting up at 6AM is really starting to help the time I have left for programming. Tomorrow I expect to spend less time programming so I can finish up an article or two for massively.com. Today I hooked up the return button on the colonies screen and opening of a colony's build queue by clicking on the building area. Also made it open the colony view when clicking on the colony name area. Finally, I implemented the displaying of colony stats on mouseover (see screenshot).

Got more done than I expected so I completed a few additional development points. I made an escape key command that returns to the previous screen or closes the last opened window. This is a standard mechanic that naturally fits into games today. I also implemented scrolling in the colony screen window using the up and down arrows on the screen.

Immediate goals for further development are:
- Implement picking up population on this screen and placing them into other jobs. Placing population onto another planet will not need to work for now.
- Implement ordering of list by Name, population, food etc.
- Link ordering of list to clickybuttons, implement brightblue clickybuttons for active mode. Default is order by name.
- Write a thing to calculate the total RP and food across the empire.
- Add food to the bottomright empire stats window in the colonies screen.
Screenshots



6th August 2008:
I got a lot of necessary stuff done on the Knights project and decided to spend some time on MOO2.5 for a change of pace. I decided to delay the build list ordering algorithm as it is not essential. I'm also not going to do all the grunt work I had planned, because it'll all be replaced eventually and grunt work has put me off returning to the project. I completed the remaining two development goals from last time (and it only took about five minutes O_o). The cancel button in the build screen is now active and the build queue is restored from a backup if it's clicked.

With the build screen mostly complete, I moved on to the colonies screen. Colonies are correctly listed, along with what they're building and a visual representation of their population units and the jobs they're in. The number of turns remaining for buildings in production will have to wait until I'm working on the end-of-turn mechanics but I've left space for it.

Immediate goals for further development are:
- Implement picking up population on this screen and placing them into other jobs. Placing population onto another planet will not need to work for now.
- Open build queue of a colony upon clicking the building name.
- Open colony view upon clicking the colony name.
- Hook up the return button.
- Implement mouseovers of colonies to display stats in the bottom windows.
- Implement ordering of list by Name, population, food etc.
Screenshots





4th May 2008:
Spent a few hours on the project in the early hours of the morning. I completed all previous immediate goals from testing the build screens with incomplete lists of owned tech to displaying the item build cost etc. This screen is slowly starting to take shape. I'm not sure if I will even include the autobuild function as I intend to eventually replace it with a more easily controlled build policy system. The next things to do are mostly grunt-work, manually grabbing data from the game and sticking it into my game.

Immediate goals for further development are:
- Write algorithm to order build list
- Capture better building icons and put them in.
- Make the game back up the build queue on opening the build screen.
- Restore the build queue from backup if the cancel button is clicked to exit screen.
- Manually import the actual tech descriptions for buildings from the game.

Screenshots



3rd May 2008:
I'm probably not the only person who's idea of procrastination is coding. Today I escaped writing revision notes on artificial intelligence by working on the MOO2.5 project some more. I completed the colony-base build check, which checks how many colonisable planets are availible in the system and then compares it to the number of colony bases in that planet's build queue. Just like in MOO2, you could feasibly have two planets in a system building a colony base at the same time with only one colonisable planet left. This problem will be handled when writing the code to deal with completing construction at end-of-turn in the same way that MOO2 handles it - check all build queues for invalid colony bases and remove them.

I have been a little demotivated due to my messy implementations of how buildings, tech lists and building images are handled and the bugs that have been cropping up. Today I eliminated that problem by completely gutting the old system and producing a new one. One side-effect is that the left hand side buildings list is no longer in alphabetical order but instead is in the same order that the images are. This is something that I can correct by writing an algorithm to order the list after constructing it. The actual implementation is now much more sound.

Immediate goals for further development are:
- Test build screen with incomplete lists of owned technology.
- Write descriptions of all the buildings.
- Import build costs of buildings from the game.
- Implement maintenance costs of buildings.
- Import maintenance costs from the game.
- Calculate build time at this colony.
- Display item name, build cost, maint cost and time to build on mouseover.

And then if I get time:
- Write algorithm to order build list
- Capture better building icons and put them in - Make the game back up the build queue on opening the build screen.
- Restore the build queue from backup if the cancel button is clicked to exit screen.

Screenshots



1st May 2008:
Uni lectures just ended, along with the project I've been working on so hard. I spent a few hours bugfixing today and adding features

The following goals haven't been met yet

- Complete colony base build possiblity check.
- Display build cost and time to build on mouseover.
- Test build screen with incomplete lists of owned technology.




8th March 2008:
Yesterday was Rag Day in University, so there were no lectures and I used the time to work on the project again. I'm finding that leaving myself a list of immediate future goals after a development session is very important for overcoming the general apathy for working on it I get from time to time. In previous projects I would spend an entire hour or more per session looking over my code, running the program and seeing where I had gotten to before I could continue. Not only that but if I was forced to take a break for an entire month due to exams or heavy university workload, refamiliarising myself with the code becomes a long and annoying goal that must be accomplished before any real progress can be made. By specifying immediate goals, I can jump straight back into development weeks later and know what I was doing when I left.

Today I completed everything in the previous entry's further development goal list. The change and OK buttons are working. Technology is now represented by a class which also contains a boolean noting if it is a building or not. Each planet has its own build queue and the build screen displays a scrollable list of buildings on the left hand side. Items on the left hand side can be clicked to add them to the build queue and they will not add if the queue is full or if the building is already in the queue. Items on the right hand side are those special case items which can be built more than once such as freighter fleets and spies.

Goals for further short-term development:
- Display building icons on mouseover.
- Display right hand side icons and descriptions on mouseover.
- Implement deleting items from the build queue.
- Implement light colour check for build list items which are in the build queue.
- Complete colony base build possiblity check.
- Display build cost and time to build on mouseover.
- Test build screen with incomplete lists of owned technology.

Screenshot



27th Feb 2008:
Today I was not in University since I had an optional practical class that I could do faster and cheaper at home (it costs me £3.20 and 3 hours travel to get in and out of uni). I put that time to good use by working on MOO2.5 again. I added some finishing touches to the planetary UI screen by implementing the leftover bits that I discussed in yesterday's devblog. The topleft box now shows planetary ownership and also allows a player to move to a planet they own by clicking on it in the topleft box.

I then went on to implement the building UI screen. This is the screen that appears when you're at a colony and enter the building window by clicking the "Change" button. I have yet to hook the buttons up but that is a trivial matter that I can do tomorrow if I have time. You can see in the screenshot that this window has translucent areas that allow you to see the colony through them. This is a holdover from the original MOO2 to make the game feel more like the original and was actually quite tricky to code. I spent all day fiddling about with WritableRaster and ColorModel objects but finally found an adequate solution.

This screen works by rendering the colony to a BufferedImage in one pass, then sending that Image to a function that makes it look how it does here, then drawing the metallic areas of the UI on top of that. The function mentioned above runs some pixel operations on the image to modify the brightness, contrast and RGB colour balance and this function is also responsible for the darker and lighter interleaved row effect. You have no idea how annoying it was trying to coax RBG values out of the Java classes I'm using. Then the only way I could find to actually put the pixel back in required me to pack the RBG values back up into an appropriate hexadecimal integer and thinking in base 16 wasn't very fun. I am quite pleased with the results, though.

Interestingly, this screen uses less CPU than the colony screen. Because of the intense nature of running a pixel operation on an 800*600 image several times per second and because the background to this screen never changes, I decided instead to run the background image with the planet and buildings through the function only once when the screen is opened. I may see if I can do something similar with the planetary UI screen since many parts of the image don't change while you're actually at the screen but since there are no major operations occuring like we have with the blue tinting function, I don't think I'd see much actual CPU use benefit. Every little helps when you're working with java, though.

Goals for further short-term development when I get the time are:
- Hook the Change button up on the plantary UI.
- Hook the OK button up on the building UI. (leave cancel for later, will require saving colony buildstate).
- Draw the various pieces of text onto the building screen like colony name
- Implement technology list in Player class.
- Make new class to keep info on all buildings (production required to build, maint cost etc).
- Make the building screen display all buildings you have the technology for in the left hand side panel (scrollable list, maybe?).
- Make the buildings in the list clickable and glow when mouseover.
- Make it display info on the tech in the topmiddle areas when mouseovered.
- Implement build queue that buildings are added to when clicked.
- Display build queue in the bottom-middle area of the building screen.

Screenshot



26th Feb 2008:
Over the past few days I got a few hours of work in. This let me almost finish off the planetary UI screen by showing the planets in a system in the topleft box. It also displays their gravity status and mineral density. When the mouse is moved over it, the text glows slowly from its normal colour to a brighter one and back again repeatedly. This is an effect calculated by a function I wrote which takes in a dark colour, a bright colour and a number of steps in the glow process (indicative of the frequency that the glow will pulse at) and returns a colour somewhere in between the two based on the modulus of the game's internal framecounter.

I'm quite pleased with the glowing colour function and I can use it for any glowing text in the game that I need to. What I haven't implemented yet is showing planet ownership in the topleft box and moving to the planet by clicking on it but those should be trivial to do. After that, I'll move onto designing another screen.
Screenshot



24th Feb 2008:
Today I drew out some designs to get my head around the diamond shape of the buildings layout in the original MOO2. Compared to my previous rhombus shape, this would look a lot better. I calculated the percentage sizes for each row based on a requirement that the image in front be 100% size, the image at the far back be 50% size and the gradient in between is smooth. After a lot of annoying manual work, I sucessfully made a nice diamond shape that I'm quite pleased with.
Screenshot