Saturday 6 September 2014

Taking A Break

As the title says, I will be taking a break from working on Crucible for a little while. I've got a lot on my plate preparing for uni in two weeks and I'd like to enjoy my freedom! I will still be adding bits and writing code as and when I feel like it, and hopefully by the time I do return I will have done a not-too insignificant amount of work. But don't worry, I'm not giving up on the project!

Friday 29 August 2014

Crucible XXVIII 29/08/2014

This post will probably end up being shorter than usual. I spent the start of the week rewriting and fixing the code related to the hero invasion screens and how the various actions heroes can perform actually work. The middle of the week was spent re-writing and optimising both the map generation code, and the code I use to detect and change any connections that are not suitable for the map (eg. if connections between systems overlap). The end of the week was spent fixing bugs and optimising other parts of the code (a lot of this involved converting class to static classes- tedious!). The result of this is that the game can now support many more systems at one time, and the collision detection algorithm can be run in real-time with minimal performance impact. At the moment I'm getting between 70 and 100 FPS when I run the game in a standalone window with the largest map size (90 systems). I will need some serious play testing to test the performance of the improvement algorithms that calculate the resource modifiers, but I'm confident that everything is running nicely. I guess being at a stage where I am spending serious time optimising code means that the game is getting steadily closer to release.

Aside from that I also put in a picture of the milky way to get an idea of how the map should look on release. Unfortunately I don't know if it is a stock image, but would love to credit whoever created it. Also in the screenshot below you should be able to see the map generator working better than it ever has before! Map shapes are interesting and varied and there are enough connections between the right systems to prevent the maps from being too plain or too complex.

Beginning to look really nice!

On running the game in fullscreen I have discovered that the UI is faaaarrr too small. These things are all being noted and I'll fix them closer to release. Next week I will probably work on finishing up the features that are currently in the game, and then get to work on the empire research. Hopefully if I can get the research finished soon, I'll be able to get the other races in the game and work on the AI for some kind of free beta release. Until then, have a good week and thanks for reading!

Friday 22 August 2014

Crucible XXVII 22/08/2014

This week had a number of surprises in store. I updated the version of NGUI I was using, which resulted in the project being broken for 2 days whilst I fixed it (I did have other things to do so the time wasn't completely wasted), and Unity 4.6 Beta has been released which has all the new UI features in it! Although I will be sticking with NGUI to save time, I am quite excited about the new UI things in 4.6. I'm also prepping for uni in 5 weeks, so when I leave there will probably be a lack of updates for a while whilst I'm settling in and doing my coursework, but I will still be working on this!

This week I spent some time working on and fleshing out the hero skills and how they fit with the gameplay style of the hero classes. I mentioned a while ago that I have slimmed it down to 3 basic heroes, each fitting a different method of playing. These are Infiltrator (Being sneaky and Spike Damage), Soldier (Not being sneaky, territory control, being a tank), and Diplomat (being a little bit sneaky, changing the diplomatic relations between players, condition damage). All the classes have their own traits and technologies (as well as some generic technologies), and they all have 3 unique abilities to be used in game. The abilities are available to be used as soon as the hero is purchased, and can be augmented by using various technology. The abilities and their corresponding in-game symbols are listed here.

  • Infiltrators can:
    • Spy on enemy systems. The owner of the system is unaware that the enemy hero is in the system. The hero can have a look at the improvements and output of a system, and can plant bombs on planets. They can only spend a limited amount of time in the system before the owner is alerted to their presence. (Symbol 7)
    • Teleport to escape enemies. This allows the hero to teleport to the nearest friendly system if it is in trouble. This can be augmented to allow the hero to teleport anywhere! (No Symbol yet!)
    • Attack an enemy hero. The infiltrator will chase the enemy hero, do a significant amount of damage to it, and (hopefully) run away before the enemy hero can retaliate. This does affect your relations with the enemy player, and is on a cool-down timer. (Symbol 8)
  • Soldiers can:
    • Invade enemy systems. This is pretty clear- the hero can enter a system and start to attack planets. There are some nuances to it but this is the simple explanation. Soldiers are tanky so they are the only really suitable class for this task (especially against powerful systems). (Symbol 5)
    • Guard systems. They can bolster the defences of systems if they are located within them. The soldier will take a minimal amount of damage from this, but is not directly involved in the battle (passive ability). (Symbol 4)
    • Claim unowned systems. If a system is unowned the hero can claim it, preventing all other players from colonising the system before you. The hero must be present in the system for this to occur. It can have negative diplomatic effects, and the hero is very vulnerable during this time. (Symbol 1)
  • Diplomats can:
    • Enter enemy systems. This has no diplomatic effects and will not automatically trigger war with the system. Diplomats are the only heroes that can passively look at the improvements and output of systems. However diplomats are unable to enter systems that are set to auto attack intruders. (Symbol 3)
    • Promote systems. This increases the resource output of the system, and when performed on enemy systems, will improve the diplomatic relations with that player. (Symbol 6)
    • Embargo systems. This prevents the system from producing resources. It will impact poorly on diplomatic relations with that player. (Symbol 2)
 In game symbols for hero ablities

In addition to all that I improved the workings of the hero pathfinding algorithm, and some associated scripts. If you have a hero selected, and you mouse over another system, the path that the hero would take to get there is now highlighted. This is not only nice to look at, but will also help to identify systems the hero cannot pass through for whatever reason. In the gif below you can see the algorithm in action (and you can also see that my map generation algorithm isn't working again!).

Pathfinding with style

That's it for this week. Hopefully I can get some of these problems fixed by next week and have some nicer hero stuff to show. My plan is to complete the heroes, then get the empire technology finished, and finally get working making the AI nice and polished. After that I'll be free to polish it up, add some new races, add the win conditions and generally make it a bit more fun to play. See you next time!

Friday 15 August 2014

Crucible XXVI 15/08/2014

Oh yeah, I can totally keep doing roman numerals in my post titles (those of you not reading on my blog won't see this). So I am back from my THIRD holiday this year. It was great, thanks. I have indeed done some work on the game this week. After working for so long on the headache that is the voronoi generator, I decided to work on something a bit different- improvements. My goal was really just to re-write the code that is responsible for calculating the modifiers that are created by the improvements. This was in order to both make the code faster, and also to give me greater control over how the improvements work. Systems now have their own modifiers (with names such as systemPowerModifier or systemGrowthModifier), whilst the planets in the system also have a modifier (with equally imaginative names like planetPowerModifer, and planetGrowthModifer). I made a couple of little diagrams to help explain what the modifiers are and how the are calculated.

This diagram explains the difference between improvements with system wide effects and those with planet-wide effects.

This diagram explains how the modifiers are calculated for each planet.

The modifiers are nothing arcane, they are simply a value that is multiplied to the base resource production value. For example the Power modifier is multiplied with the base Power output of a planet (say 4 Power with a modifier of 2) to produce a final Power output of 8. There are modifiers for almost every kind of resource in the game- Power, Knowledge, Wealth, Maximum Population, Population Growth, Improvement Slots, Amber production etc.

I had a major issue with github which resulted in started a new repository for my code. The result of this is that the current code version number is now 1.4. For some strange reason I did return to the voronoi code, and with fresh eyes, I think I have made some improvements. It does occasionally break still, but the frequency of this appears to have decreased.

That's it for this week, see you next time! 

Saturday 19 July 2014

Crucible XXV 19/07/2014

So sorry for the lack of an update yesterday. I was very close to finishing off my current task so I thought it would be worth the wait. I've 'finished' the Voronoi diagram generation! I can't speak much of it's efficiency, and there are still a couple of bugs that need ironing out, but I'll be sure to improve it in the future. I've included a few screenshots of it in game at a number of different map sizes. The smallest shown is a 30 star map that generates in 2-3 seconds (including the time Unity takes to start up- which is a similar time). Next is a 60 star map that takes around 6 seconds to generate. Finally I have included a 90 star map (the largest map) which takes a whopping 15 seconds to generate. However I can't say that the Voronoi generation is responsible much for the longer loading time since the 90 star system has always taken a fair while to generate, and I suspect it is more to do with the map constructor code (line intersections are expensive on that scale!).

 30 Star System. Placeholder graphics just to show off the regions

60 Star System. Region shape becomes more interesting and smaller.

90 Star System, many, many regions!

This week I'll be bugfixing and doing minor changes. I'm on holiday for two weeks afterwards with the family. And then back for the final 2 months before uni! Exciting times!

Friday 11 July 2014

Crucible XXIV 11/07/2014

Back from my holiday! Feeling thoroughly relaxed and ready for work. This week I've just been working on the Voronoi diagram for the empire map and all the issues associated with it. Happily it has also resulted in some good optimisation of the map generator and geometry related methods. On the other hand it has turned out to be quite complicated. There are 3 main steps to the process- Triangulation of the map of star systems, turning the Triangulation into a Delaunay Triangulation (writing a straight up Delaunay Triangulation algorithm is HARD), and then turning the Delaunay Triangulation into a Voronoi Diagram. The last two steps are easy, but the initial triangulation is proving to be rather complicated (but I reckon I'm close to success). Anyway I've provided a quick overview of how this works;


Step 1: Create a Delaunay Triangulation of the points. In this case I have just provided the triangulation of the stars near Nephthys.


Step 2: Create Circumcircles for each triangle. These are circles that pass through all three points of a triangle.


Step 3: Create a polygon by linking up all the centres of the Circumcircles. This creates the Voronoi cell, with the system as the central points. All locations within the cell are closed to Nephthys than any other system.


Step 4: Roughly how the final cell would look. In-game this will be seen by zooming the map out. It will allow the player to see all the territory they own, and the territory controlled by each star system. All the cells in a Voronoi diagram link up like a jigsaw, so the map will have no holes in it (unless I want it to!).

As I said I am having trouble with the initial triangulation, but as soon as I crack that problem I can put up some real screenshots and move onto some other aspect of the game (probably go back to invasions and finish that up). See you next week!



Friday 27 June 2014

Quick Update

Only a little update this week. Spent a good deal of time working on the invasion mechanics and the UI, and I can say it's working pretty nicely at the moment. I'd estimate it's about 75% complete so hopefully I can get a working demo up soon. I've also been working on creating a map composed of the regions of space that each system controls. This is mostly a visual feature, but it should make the game look a bit more interesting and make it easier to see what territory is owned by you and the enemy. I'm implementing this using Voronoi diagrams, and the code for that is pretty complex so don't expect to see that any time soon! The map has been slightly jigged to fit onto a 50*50 square grid. This doesn't really affect how the game looks but helps with map generation since systems can no longer be closer than a certain distance.

Next week I am off on holiday, so the next update should be the week after. I will also have free weekends at that point so development should pick up again (and it's summer finally!). Sorry for the brief post, but I'll be back soon!