Space in Lockdown

Graftgold Memories

Battle Of Britain
This was one of the Graftgold games that nearly was developed but was canned when we were given a contract that was just unacceptable. When I tried to negotiate I was told this was a new standard contract that cannot be changed. It basically allowed the publisher to decide if they wanted to discontinue a project and the developer would have to repay all advances. This would be impossible to do as advances are used to develop the product. Thus we would become insolvent at a stroke if the project was cancelled. Fair enough if there is due cause but that was left entirely at the publishers discretion. Then another clause said that if we went insolvent the publisher got to own the product completely. Put all this together and it meant the publisher could just take over the product whenever they wanted. Of course I did not agree to this and we parted ways.  The product was a forerunner of Realms and was going to be Graftgold's first big team game.

The game was to be a strategy game with arcade sub games.  It gave various screens of view of the battle which were to be very graphical with click on objects such as phones to lead to other screens. An overall control map was available and also sector maps which were the main strategic elements. I took photos of the control room at Duxford so we could get an authentic look. The maps were to be updated in real time showing raids develop and squadrons could be ordered into different states of readiness or action by clicking on their status displays. Similar to Realms the actual dogfights were going to be displayed in arcade style and the player would lead a flight into action  rather like 1942. This was just an optional sub game, the real game was at the sector level where the player acted like the sector commander and could see the attacks develop and had to decide how to respond.
One of the many photos I took at Duxford researching for Battle Of Britain

We worked up stills of most of the screens to show the look of the game. We took the design to Activision but unfortunately they already had a team working on a Battle Of Britain game so the deign was changed to a fantasy wargame. That was fairly easy to do as the  very first iteration of the design was called Rome and we had already worked up  designs for the equivalent screens. Rome was shelved as it drew little interest from publishers. The Total War team showed that the idea could have been very commercially successful. It was just so hard to get publishers interested in game ideas they had not seen hit the year before. All the effort was not wasted though , each iteration of the design made it a tighter design.

Deepest Blue Progress

With the lockdown in place my wife decided she had better isolate with her disabled mum so she was not at risk from carers calling 4 times a day. That left me all alone, I just had to do the shopping and deliver it once a week. So I had plenty of time on my hands to program. I was determined to make some progress and break the back of the issues that had been slowing me down.  

I rebuilt the solution file to get rid of the corruption of the intellisense file. Now I could see lists of function names and use find all references and searches with confidence. The searches got to a stage of telling me there were no instances of the use of a variable or function. I remove It and immediately get a compile error so have to put it back.  I later found that I did not need to rebuild the solution file. Merely renaming it did the trick. I logged the bug with Microsoft but could get no useful information. I wanted to know what files the intellisense used so I could delete them. It is so frustrating when all you get is stock answers like " submit and sample project with the error". I spent ages making a sample that was small that showed the error to them. It was when I renamed this I discovered the easy way to fix it. I told them this and that just downgraded the issue. Programming is hard enough without having to continually fight the dev system. Still most debug session end with the edit and continue telling me I have changed a structure or global variable when I haven't. It wastes hours of my time.

While I am having a rant I must mention (again) the stupid Windows search window that appears about fifty times a day over the top of my work. I am sure it is something to do with the touch pad but I cant make it appear when I try. My big complaint is that it is not a Windows compliant window: it has no X in the corner to get rid of it. I have to click on the Windows icon to open yet another Window and then X out of that.  Some days it happens so often just when I am trying to type a complicated bit of code I resort to telling it in no uncertain terms where to go, but it doesn't help.

Yes I have had a trying day, it is good to get it out of your system. On your own you have no one to moan at or blame.  That was the good thing working with Andrew, when things got on top of one of us we had each other to rant to. Andrew had a frustration brick of foam rubber that  often was thrown at the screen or each other. We had a way of seeing the funny side of things that kept us going. Oh haha my machine has just crashed so I have to retype all that code.

So back to the plot... the biggest issue in the game at the moment is that after a while most activity dies down. It is like all the ships get tired and do not want to work anymore. I look at the mission list and it is empty. That should not happen. The AI is meant to be constantly creating mission to meet its needs. Bases need resource so create resource missions. Resource needs mining and transporting  so needs ships. Ships need shipyards which need more resources.  As any of this grows it should create mission to expand the weakest link.  

So I started to go back to basics and test out the basic parts of the process.  
Ships being built and delivered.
Scout ships going on scout missions to find new sectors, resource and sites to build bases.
Mining ships performing mining missions and delivering to processing plants.
Processing plants converting resource into usable products.
Also for resource not yet available home ships delivering from Earth and returning with expensive resource that pays for the whole process.

I found a few issues such as miners having a small chance of not homing on an asteroid and circling forever. I thought I had cracked the homing routine last time. I need to slow the ships more if they had to turn. I thought I had the formula right but its not just a matter of ships speeds and turn speeds. I had not taken into account the different acceleration and angular acceleration amounts which affect the time to turn a certain angle or stop at a particular distance. 

I found scouts had a chance of missing a warp point when scanning a new sector. That meant after a few sectors links had been missed so the game did not open up and the critical paths between Seiddab and Terran forces were not found.

The game at least had been very stable but opening up routes to the enemy started producing controlled crashed caused by assertions I had placed in the code. These trap circumstances that should not happen at the earliest moment before they cause more trouble. The new ones that were occurring were caused by ships blowing up and new code being executed. It is complex to clean up after a ship is destroyed. It may be part of a squad, in the middle of a mission, carrying freight or base parts or Asteroid chunks. All these need resetting properly.

I tried putting big ships back in the game. I tried them out on the test scenario but the turrets had lost their autofire. I had disturbed the logic putting in the gunsights and associated player control of the guns. It is frustrating when regression bugs occur. There is just no quick way to test all the functionality I so do not spot things immediately. That is why I added the test screen. I can test combat immediately. I am thinking about expanding this principal to give a "trainer2 mode for other actions so I can test them quickly. I use the AI mode to test things. I set all my ships on different mission and just monitor all of them until something strange happens.

Battle between capital ships

I realised I still needed to connect the ship design screen to the game properly so you can reorder a blown up ship, buy a new ship or upgrade and existing ship. That turned out to be more difficult than I imagined. If a player customises a design that has to be published to all linked players. I am trying to code everything to work on a network game. So I had to pack the ship design and send it to the game.  I had to add the money side of buying ships and then for new ships create an order so the ship is built by a base in the game. I got that all working then found when I use the ship design form in development mode it no longer worked so had to put in a few tests. Many game objects are not created when I use the ship design screen to design the games ships and bases.

So the big test after all this, leave the game cooking , go back after an hour and see what has happened.   Well things have improved but the game is still stagnating, which means there are issues that are not obvious  I need to fix. I noticed home ships were not flying. These are a critical part in the early game o of bases get destroyed as they allow resource to be delivered from Earth. I found they only flew of there were goods to collect. However in order to get to that stage they need to deliver resource so the goodies like diamonds can be extracted from crushed asteroids.

I realised I had not programmed the request a repair mission so added that and also added a repair ship class.  The repair is carried out by a special weapon that is like a 3d printer. 

I also retested the economy to see that bases were trading correctly. I found a shortage of freighters and adjusted that,

I tried being naughty and blowing up my own factions ships to test the process of being ejecting from a faction. It didn't end well so I spent a few hours revising that code and adding some messages. I still have to work out how to make AI pilots get into criminal activity. I have an underground faction called Dark Light that is pretty lawless. I need a mechanism to tempt AI and player ships into illicit activities such as piracy or smuggling. When you are carrying freight you can get stopped by a patrol to be scanned. You might be lucky and get away with it or be discovered. Like all missions players can perform the patrols and scans.
For a bit of light relief I sorted out the profile display that gives the player a visual display of the ships capabilities, rather like a "Top Trumps" card. It was a nice change to work on some straightforward code that did not involve 3d maths of complicated processing. I already had a bar chart control to use but I had only used and tested the vertical mode used to show the market trends for resources. That meant I had a few bugs to correct. I had to think a bit about what to display. In the end I decided to use the ratio of thrust to mass which shows the agility of the ship, stealth, hull strength, firepower and the ratio of energy production to energy use. I had to think about to get sensible ranges for these as the difference between large and small ships is huge.
So bit by bit I am getting there although it feels like an uphill slog whereby at each expected summit another looms in front. Each bug resolution is opening up the game a bit more and exposing new issues.  The big issue of stagnation is still there I am hoping I will discover something fundamental I have missed rather than it be the result of many little contributory factors. Maybe its like the great depression and I need to pump up the economy a bit, that's worth a check to see if factions are not running out of cash. I use a simple economy to act as a game control to hold back excessive development. I found out that the mechanism to say that a resource is needed is not working. Some resources like valuables such as Gold should always be needed. That is meant to drive the plants to crate mission to collect asteroids. All Ai systems are driven by the needs or prime requirements. Then they have to prioritise and work out a plan of how to meet those goals which gives sub goals or individual tasks.  My AI system is driven by the basic resource needs of the home planet and then as bases are built the needs of each base.  This is translated into tasks by way of a mission list which ships access. Each mission is made up of stages which are made up of Ai states. It is a bit like a work flow processor.

So the plan is to put in some reporting of the needs requesting process so I can see where it is going wrong and with any luck the game system will continue to grow instead of wilting like a flower that has not been watered.  I also want to map out and check the resource cycle. Each resource has to be useful and needed by the home planet or by one or the processes converting resources. Each home planet has different prime needs. Seiddab do not want things like gold and diamonds, they value things like water or steel, anything that they can expand with. 

Programming Tips.

It is really difficult to debug a world with loads of interacting objects. If you put a breakpoint in a routine it stops on every object that is using that routine. What you need to do is to break for a specific object.   The way I do this is to add code that tests whether the object is the current object  the player ship has targeted. That way I can fly around looking at the ships buzzing about like bees collecting their pollen. Whenever I see something strange happening I just target that ship and set the breakpoint in the test code to stop the Ai engine at the start of the ai cycle for that object. This starts with a vectored call to the particular Ai pattern for the activity the object is undertaking. The activity is a simple state processor that has a switch to jump to the active states process. So In a couple of lines I have traced into the objects activity and the actual step that it is doing for this cycle.   I also display the activity and step on the HUD in a shorthand as it is useful to get a dynamic view of how the state engine is cycling though states.

The other thing I do is to print on a log every time a ship changes action or state I put the ships id. I use this to figure out how a ship got into a particular state.

Its all very well to have a programmed series of actions and sub actions but this is war and ships get interrupted by enemy action all the time. So the ships actions are layered so they can  put aside what they are meant to do if they need to undertake a priority action such as avoid something, fight something or run away. The trick is to get them to be able to resume what they were doing. They return to the original workflow after an interruption and the state is kept intact so they can continue. The actions have to be programmed with resilience as even though the state is preserved the ship will be in a different place and situation. My game has the horrible complication that the player can take over or relinquish control in any of the actions. So the AI has to be able to take over assess the situation and continue the mission. I do this by running the player through the same workflow as the AI. It just does not take any control action , leaving that to the player. It took a few attempts to get that right , makes me wonder how AI cars are going to do it.      



Popular Posts