Space 4X Strategy Game - Devember 2019

DAY 8:

Today involved finishing up the other half of the new UI elements. By ‘Finish’ I mean getting it in place and feeding the data in to it. It took quite a bit of time to do what seems like so little :slight_smile:.

Next steps will be to add the components that actually allow managing the planet, buying structures, managing taxes / happiness, building a star base, and eventually transferring cargo to ships in orbit.

Updates should start to get a little more interesting again now that most of the heavy lifting with the UI is out of the way.


DAY 9:

Began today by getting the controls set up for managing the Planet. Can build structures, Sell excess supplies for Credits, and Tax your population(s) for fun and profit. That is great, but rather useless until I add the last remaining glob of glue to connect everything up.


What is needed now is some type of Turn class/struct to hold the data for each turn. Will have a Previous Turn which will be the calculated results of the last turn that the Player is currently working from, and a Current Turn, which will be everything the Player has done during this turn towards those values. I may need to re-think my approach on it, but seems like a reasonable direction to head in for now.


DAY 10:

Continuing work on the Turn system. Needing to re-work how the Player class handles the information it knows about the galaxy to properly construct/handle the Turn data.

Currently the Player is just storing a direct reference to each Planet. What is needed instead is some type of individual instance of each Planet. With that type of configuration each Player will have a ‘memory’ of what they have seen. Will also need some way to keep track of the actions that were performed per a planet. In an attempt to not bloat up the Planet class and clog up memory with a bunch of instances of a Planet, will instead make a new class that will hold all the relevant data. The Player class can have a List that maps from a Planet ID to their personal PlanetData class.

This can be used for:

  • if it has been visited
  • can store / update planetary values each time it is seen.
  • can store each action that is performed. (building, selling, adjusting tax)

That should be all that is needed to perform a Turn. Manually set 2nd Planet and Last Planet to visited for testing purposes. Need to update where all the UI gets its data from and should be able to test out the ‘End Turn’ button.

Several minor things that I have tweaked or fixed during testing.

  • Have the camera start centered / looking at player Home World.
  • Fixed zooming. It was going up and down only, now it goes forward / back from where the camera is looking at.

DAY 11:

Mostly just a rest day. Took my hour to go over what has been written up to this point. Cleaning what needs to be cleaned and checking to make sure there is nothing silly going on. Starting to think about and plan for how to move forward with Star Bases and Ships.

DAY 12 - On the 12th day of Devember, my compiler gave to me:

Today would like to start getting Ships implemented. First thing I will need is the Ship class.

Bare minimum needed to work.

  • Reference to a Tile it is in.
  • Owner (if any)
  • Destination Tile (if any)
  • Speed

Other things that I know it will need later.

  • Engines (Tech Level and Amount)
  • Weapons (if equipable, Tech Level and Amount)
  • Fighters (if equipable, Amount)
  • Cargo Capacity
  • Fuel Capacity
  • Crew

I will also create a separate class for each Player to store unique information about each Ship, similar to the PlanetData class. This is not completely necessary due to the way the Ships will work, but should make integrating them in to the Turn system a little easier while also keeping things consistent.

Got to the point of placing the Ships in the Galaxy for today.


DAY 13:

Main task for today is to get the Ships integrated in to the UI system. Being able to select them and see their information. This is going involve finishing the TileView section of the UI. Right now it just just shows the currently selected object (Planet), what needs to be done is to go through all the Ships and dynamically add them to the TileView. This is going to be a rather involved step, since Unity3D’s UI system is really not meant to be used programmatically (probably why I dislike it so much). The plan is to create some type of prefab that I can pop in to the TileView for each object, and check for clicks to select a different object on that Tile.

while (true) {
	steps += 1;
	steps -= 2;
	steps += 3;

Well, did not make as much progress as I was hoping to make and learned a few more ways how to NOT make something work :). I have some more free time later in the evening and may tinker around some more with it to be in a better position for tomorrow.

After coming back to it for a little bit, was actually a lot closer to having it working than I thought. Currently got a very simple box that switches from the Planet to the Ship and back again. It is hard coded for now, but should be fairly quick to add a loop tomorrow to add things that are on the Tile.


Man, those stats. This seems like an insane amount of work. Are you having fun at least? :slight_smile:


When it comes to programming, I am almost always losing my mind having fun. :slight_smile:


DAY 14:

Making progress with the Ship UI interface.

  • Got it so everything on a Tile will be listed and can switch between owned objects.
  • Getting the relevant data added to the Ship Management portion of the UI.
  • Started to get the system in place for assigning a destination.


You are depressing me… I barely make variable transferring between 4 objects and stuff, and here you are making entire galaxies and stuff…
Just joking, keep it up. But you are still depressing me :smiley:


Dude, okay. I’ve been following this all month so far. I honestly thought you bit off waaaaayyyyy more than you can chew, but holy shit, this is coming along really fast and really well.


I think he is cheating… He may be doing a bit more than an hour a day :stuck_out_tongue:


I think it says “at least”

Back when I did it, it would be 2-3 hours a day for me.


I think my total hours so far is around 18-20. Had a few days with some extra time and motivation. :slight_smile:


Dis u rn fam

1 Like

DAY 15 - Beware the Ides of Devember:

Today I wanted to get the ships to actually move. I had some of the initial things set up from yesterday, but needed to finish off the ShipData class for each Player to handle Ships and to tie in to the Turn system correctly. After that it was just a matter of checking for clicks while having a Ship selected (can also shift click to add way points). Can now send Ships off in to the void with no fuel and default warp speed of 5.

Currently there is a bug feature that trying to set a point on the opposite side of the galactic center will break things a bit. Will need to tinker around with how to handle that. Might do a quick check to see if it crosses the galactic center and if it does then do some simple path finding (Dijkstra most likely) to plot a proper course around. Could also just have Ships be destroyed if sent in :smiley: . I’ll have to put some thought into it, for now just wont send them across.

Also, been fighting with my terrible internet connection so have not uploaded the latest build to my server in a while. Trying to do so this evening.


DAY 16:

For today, want to get the cargo system developed, being able to transfer goods between Planets/Ships/Star Bases. I know this is going to need 2 systems in place to work.

  1. A way to select a transfer target.
  2. The actual transfer interface.

My primary focus is going to be on the Transfer UI and I will hard code in the transfer target values for now. For testing will have Planet target first Ship, and Ship will target Planet. Afterwards can feed in the appropriate source/target which will be generated from the Transfer Target UI.

Got most of the Transfer UI in place, but ran out of time to add any functionality to it.


DAY 17 - Snow Storm 2, Electric Boog-a-loo:

Continuing work on the cargo transfer system. Slow going, but getting all the data connected to the UI elements. Started getting the buttons to transfer the amounts. Still need to add in the amount checking to make sure the values do not exceed capacity, but the transfer system is basically implemented at this point.


Holy shit… this is coming along so nicely.

Congrats OP!!! Will be watching!


DAY 18:

Want to get to get the Transfer Target UI in place today.

  1. This will allow me to remove the hard coded values and clean up a little.
  2. Can make sure things are working correctly when dynamically set.

Although the Cargo Transfer system still needs some finishing up, getting this done will allow me to make sure there are no issues before writing any more code for it. I should be able to re-use some of the code/logic from the Tile View to collect all the transfer targets, so most of the work will be just adding in the UI for it.

Should hopefully have most of the cargo work done tomorrow. Got some very cold nights for the next couple days, so may be able to get some extra done with the late nights of keeping the fire going.


DAY 19:

Putting all the finishing touches on the Cargo Transfer system. Calculating all the correct values and only allowing transfers if goods are available and not exceeding capacity. Fairly boring update for today, but making progress.

Also took some time to make some notes about areas in the code I would like to clean up or separate in to smaller files/objects. The Selected Object UI is the biggest file at the moment at about 1,300 lines, could break it down into 3 or 4 specialized pieces. Will likely do this at some point in the near future.

Tonight/Tomorrow will either start on Star Bases, or being able to Colonize other planets. Leaning more towards colonizing at the moment, that way can start to put the cargo system to use and see the results of past several days. :slight_smile: