Mods and bug fixes
from
JoeUser Forums
I've been working on stuff for 1.2 this week as well as bug fixing and helping out with support. First, let's start out with the shiny new mods browse dialog! I don't get to post screenshots very often.
By default, the mods folder is in My Documents\My Games\GalCiv2\Mods. This folder and all its subfolders are created when GalCiv2 runs for the first time. Several versions ago, I added an option to the prefs.ini file so that modders could change the location of this folder, but we didn't have an interface for it. In the Options Menu, under Game Options, I added a control that lists the current Mods folder and a button to change it.
When you click on that button, this dialog appears:
We were going to do a regular Windows Browse dialog so that you'd have all the functionality of a normal Windows Browse dialog, but it's not fully supported by all video cards, so we decided to make our own version.
A tree dialog would have been tricky to do well, and probably would have caused performance issues. So I decided that we should just list the full path in the entry field at the top, and then just list the subfolders of the current folder. The little + button will attempt to create the directory if you edit the string at the top. The button with the up arrow takes you up to the next level. When you go up past the C drive, it will list available hard drives so that you can change the hard drive where you store your mods. There's also a button to restore the mods directory to the default. I'm getting close to finishing my guide to modding. I wrote the basic text for it and now I'm creating an html doc so that you can use the contents to skip around the doc, and it'll be easier to keep updated.
So maybe the mods dialog isn't that exciting, but I'll bet you get excited about this: I have the Auto-Focus option working. I put in code so that when the Auto Focus option is OFF, the camera will not move to center on a ship unless the ship select message has been sent by something initiated by the user. The ship is still selected, so you can hit the C key to center on it if you want to change its orders. This will also let you use the goto button to set its destination. I found this useful because I could center on a rallypoint waiting for my ships to arrive so that I could form them into fleets, and just assign ships whose destination was cancelled to be rallypoint I was watching. If I've missed the point of your grievances, I'm sure you'll let me know, but be nice about it ok? It should be possible to add a function to not auto-select ships as well, but that will take more work and it seemed to me that the major complaint was that the camera got moved all over the place.
I found a bug in the save game code that would only happen if it failed to open a shipcfg file so that it could copy it into the save game data, but I'm not sure why it would fail. Evidently, it has, because some people are getting corrupt save games. I've been suggesting that people who get this bug clear out their ships folders and design new ships but I'll see if I can find a better way to prevent it. I fixed the bug so that it shouldn't corrupt save games anymore, but if the game can't find a shipcfg file for a ship, you won't be able to build it.
I've been trying to figure out why some games suddenly don't know that they are metaverse games. I fixed a bug where CTRL+N could have started a normal game after starting a metaverse game (or a loaded game) several versions ago. I fixed a bug where the game mode was being set to 'end game mode' when the game was finished, which would cause it to fail the IsMetaverseGame check in 1.11, and that seemed to help some people. Or maybe not: it's not a consistent bug. So far I've only gotten one support e-mail about this with 1.11, but there could be other e-mails in the bug database that I haven't gotten to yet. I added code that will print messages to debug.err when the game is being saved or loaded about what kind of game it thinks it is (normal, campaign, or metaverse), so that might help me track it down. I've also added code to try and detect if it should be a metaverse game and recover if it thinks that it isn't one. I would prefer to know why it stops thinking it's a metaverse game, though!
It turns out that the AI was giving away freighters that were supposed to be on trade routes. This was causing all sorts of interesting crashes. This should be fixed in the next update.
I believe that I've also fixed a crash caused by the random event that gives you a free ranger or corvettes. There were two ship designs with the class name Ranger, which was causing one ship design to overwrite the other. I'm not sure how it was ever possible to build a ranger let alone get one in this event. To be extra sure that this random event wouldn't cause a crash, I put in checks to make sure that a valid ship was created.
Oh, and another bug fix that will be in 1.2: tiles that are partially highlighted by the starbase's circle of influence will now receive the starbase bonus. This was caused by the code that calculated the Euclidean distance (straight line distance) always rounded up for the number of tiles. This meant that a distance of 8.1 tiles got rounded up to 9, even though the tile looked like it should have gotten the starbase bonus. We talked about making it round up or down based on the percentage of colored area in the tile, but since the "half full" tiles could be argued to go either way, we decided to err on the side of generosity because that generally results in less ranting.
Anyway, have a great weekend and try not to burn down the forums. It looks it is going to be sunny and beautiful this weekend in Southeast Michigan.
By default, the mods folder is in My Documents\My Games\GalCiv2\Mods. This folder and all its subfolders are created when GalCiv2 runs for the first time. Several versions ago, I added an option to the prefs.ini file so that modders could change the location of this folder, but we didn't have an interface for it. In the Options Menu, under Game Options, I added a control that lists the current Mods folder and a button to change it.
When you click on that button, this dialog appears:
We were going to do a regular Windows Browse dialog so that you'd have all the functionality of a normal Windows Browse dialog, but it's not fully supported by all video cards, so we decided to make our own version.
A tree dialog would have been tricky to do well, and probably would have caused performance issues. So I decided that we should just list the full path in the entry field at the top, and then just list the subfolders of the current folder. The little + button will attempt to create the directory if you edit the string at the top. The button with the up arrow takes you up to the next level. When you go up past the C drive, it will list available hard drives so that you can change the hard drive where you store your mods. There's also a button to restore the mods directory to the default. I'm getting close to finishing my guide to modding. I wrote the basic text for it and now I'm creating an html doc so that you can use the contents to skip around the doc, and it'll be easier to keep updated.
So maybe the mods dialog isn't that exciting, but I'll bet you get excited about this: I have the Auto-Focus option working. I put in code so that when the Auto Focus option is OFF, the camera will not move to center on a ship unless the ship select message has been sent by something initiated by the user. The ship is still selected, so you can hit the C key to center on it if you want to change its orders. This will also let you use the goto button to set its destination. I found this useful because I could center on a rallypoint waiting for my ships to arrive so that I could form them into fleets, and just assign ships whose destination was cancelled to be rallypoint I was watching. If I've missed the point of your grievances, I'm sure you'll let me know, but be nice about it ok? It should be possible to add a function to not auto-select ships as well, but that will take more work and it seemed to me that the major complaint was that the camera got moved all over the place.
I found a bug in the save game code that would only happen if it failed to open a shipcfg file so that it could copy it into the save game data, but I'm not sure why it would fail. Evidently, it has, because some people are getting corrupt save games. I've been suggesting that people who get this bug clear out their ships folders and design new ships but I'll see if I can find a better way to prevent it. I fixed the bug so that it shouldn't corrupt save games anymore, but if the game can't find a shipcfg file for a ship, you won't be able to build it.
I've been trying to figure out why some games suddenly don't know that they are metaverse games. I fixed a bug where CTRL+N could have started a normal game after starting a metaverse game (or a loaded game) several versions ago. I fixed a bug where the game mode was being set to 'end game mode' when the game was finished, which would cause it to fail the IsMetaverseGame check in 1.11, and that seemed to help some people. Or maybe not: it's not a consistent bug. So far I've only gotten one support e-mail about this with 1.11, but there could be other e-mails in the bug database that I haven't gotten to yet. I added code that will print messages to debug.err when the game is being saved or loaded about what kind of game it thinks it is (normal, campaign, or metaverse), so that might help me track it down. I've also added code to try and detect if it should be a metaverse game and recover if it thinks that it isn't one. I would prefer to know why it stops thinking it's a metaverse game, though!
It turns out that the AI was giving away freighters that were supposed to be on trade routes. This was causing all sorts of interesting crashes. This should be fixed in the next update.
I believe that I've also fixed a crash caused by the random event that gives you a free ranger or corvettes. There were two ship designs with the class name Ranger, which was causing one ship design to overwrite the other. I'm not sure how it was ever possible to build a ranger let alone get one in this event. To be extra sure that this random event wouldn't cause a crash, I put in checks to make sure that a valid ship was created.
Oh, and another bug fix that will be in 1.2: tiles that are partially highlighted by the starbase's circle of influence will now receive the starbase bonus. This was caused by the code that calculated the Euclidean distance (straight line distance) always rounded up for the number of tiles. This meant that a distance of 8.1 tiles got rounded up to 9, even though the tile looked like it should have gotten the starbase bonus. We talked about making it round up or down based on the percentage of colored area in the tile, but since the "half full" tiles could be argued to go either way, we decided to err on the side of generosity because that generally results in less ranting.
Anyway, have a great weekend and try not to burn down the forums. It looks it is going to be sunny and beautiful this weekend in Southeast Michigan.