Bacon Mod

Please post here for questions and discussion about scenario, art and sound modding and the game editor for Distant Worlds.

Moderators: Icemania, elliotg

RogerBacon
Posts: 724
Joined: Wed May 17, 2000 8:00 am
Location: Miami, Florida, U.S.A.

RE: "Hyping" my forthcoming mod (pun intended)

Post by RogerBacon »

A few more hotkeys

I've had these for a couple of weeks but forgot to mention them.

Alt-semicolon, Alt-single quote
These keys cycle (backward/forward) through all ships of the currently selected ship type. So, if you have a supply ship selected you can cycle through all of your supply ships. If you have a fighter selected it will cycle through all of the fighters from the same carrier/base.

Alt-slash
If you have a fighter selected hitting this key will select the parent carrier / base.

BTC 14UURmC4rD762RStsufKmaUjfXQrBvahU1
ETH 0x7c65139BC82A0BDC5b11F92001D5c5a112219f08
Sparviero
Posts: 39
Joined: Thu May 31, 2012 8:05 am

RE: "Hyping" my forthcoming mod (pun intended)

Post by Sparviero »

Love alt-slash feature.
RogerBacon
Posts: 724
Joined: Wed May 17, 2000 8:00 am
Location: Miami, Florida, U.S.A.

RE: "Hyping" my forthcoming mod (pun intended)

Post by RogerBacon »

Square peg. Meet round hole.
OK, so this whole mod is basically trying to pound a square peg into a round hole. I feel I've been pretty successful at that effort, however nothing is perfect. There are some bugs I've squashed, or mostly mitigated along the way. Even the most common one occurs less that 1% of the time now. I want to list them though so that you will be aware of them. Don't be overly concerned. As I said they are mostly fixed and don't distract from the mod in my opinion. I'll list them in order of severity. I believe they all have their root cause in a ship thinking it is about to enter hyper jump or is actually in hyper jump when it really isn't.

Ship stuck in an endless loop
This one is the most irritating. A ship will move forward for a few seconds and then blink back to its starting location. To fix this problem, just give the ship any command. This occurs less that 1% of the time but it is still present.

Ship reaches destination and circles endlessly
I put in something to fix this and I'm 99.9% sure its gone.

Ship doesn't update target's position
Normally when a ship will hyper jump to a target it doesn't need to update the target's position because it will only take a few seconds. With gravity wells it may that several minutes to reach the target, during which tiem the target may move quite a distance. I put something it to force update the position of the target and it works fine so this bug should be fixed.

Ship can maneuver at warp speed
This one is super rare. Sometimes a ship will be traveling at hyperjump speed but the game thinks it is not in in hyperjump so it can still maneuver. Its not too bad because it will instantly drop to normal speed if it tries to interact with anything (like attacking). Just consider it a crazy engineer that did something to the ship's engine. It's very rare. You might see it once or twice every 10-20 game years.

(not a bug) SHips exit hyperjump and pop to a new location
In Vanilla DWU the hyperjump inaccuracy is small. The travel vector drawn on the map shows the expectd exit point but that is them modified by a random distance. When that distance is small you don't notice it unless you are zoomed in very close. When the distance is greater, such as recommended in this mod, you will see the ship exit and then jump to the random location. Its normal but if you don't know what to expect it can look weird.

To mitigate these bugs it is important that you press any key as soon as your saved game loads (or as soon as a new game finishes the setup phase for new games. The reason for this is that the settings for the mod are not actually loaded until the first time a key is pressed. I have gotten in the habit of pressing the space bar to pause and unpause the game but any key will work.
BTC 14UURmC4rD762RStsufKmaUjfXQrBvahU1
ETH 0x7c65139BC82A0BDC5b11F92001D5c5a112219f08
RogerBacon
Posts: 724
Joined: Wed May 17, 2000 8:00 am
Location: Miami, Florida, U.S.A.

RE: "Hyping" my forthcoming mod (pun intended)

Post by RogerBacon »

The mod is released.

https://www.dropbox.com/s/bq84qowtpgj6q ... e.zip?dl=0

Let the inevitable error reports and questions commence.
BTC 14UURmC4rD762RStsufKmaUjfXQrBvahU1
ETH 0x7c65139BC82A0BDC5b11F92001D5c5a112219f08
User avatar
rjord2021
Posts: 2019
Joined: Fri Jun 14, 2013 2:47 am
Location: Sydney, Australia

RE: "Hyping" my forthcoming mod (pun intended)

Post by rjord2021 »

Looking forward to getting home in a few hours and trying your mod.
Overlord015
Posts: 55
Joined: Tue Jan 20, 2015 8:08 pm

RE: "Hyping" my forthcoming mod (pun intended)

Post by Overlord015 »

I'm crying tears of joy right now, I'll give some feedback as soon as I can get into it (and cram it into my personal franken-mod-mod-mod).
User avatar
Hattori Hanzo
Posts: 735
Joined: Mon Mar 21, 2011 12:40 pm
Location: Okinawa
Contact:

RE: "Hyping" my forthcoming mod (pun intended)

Post by Hattori Hanzo »

I will download it immediately [X(]
User avatar
rjord2021
Posts: 2019
Joined: Fri Jun 14, 2013 2:47 am
Location: Sydney, Australia

RE: "Hyping" my forthcoming mod (pun intended)

Post by rjord2021 »

I have not had a chance to try your mod yet..... may not get a chance till next week..... will let you know when I do get to try it out.
Sparviero
Posts: 39
Joined: Thu May 31, 2012 8:05 am

RE: "Hyping" my forthcoming mod (pun intended)

Post by Sparviero »

[&o]
Downloading!
User avatar
Uncle Lumpy
Posts: 165
Joined: Fri Jul 01, 2005 8:55 pm

RE: "Hyping" my forthcoming mod (pun intended)

Post by Uncle Lumpy »

As soon as I complete my current game (too much fun to give up now), I'll fire up your mod. I'm excited to see how gravity works, and for having a bit more control over various aspects of the game.

I admit I'm a real nob when it comes to mods and such. So, for clarification, you mean to back up the original Distant Worlds.exe and save a copy of it, because your Distant World.exe will over-write the original, correct?
I once heard there was a garage, which some said was air tight.
RogerBacon
Posts: 724
Joined: Wed May 17, 2000 8:00 am
Location: Miami, Florida, U.S.A.

RE: "Hyping" my forthcoming mod (pun intended)

Post by RogerBacon »

ORIGINAL: Uncle Lumpy

I admit I'm a real nob when it comes to mods and such. So, for clarification, you mean to back up the original Distant Worlds.exe and save a copy of it, because your Distant World.exe will over-write the original, correct?

That's correct.
BTC 14UURmC4rD762RStsufKmaUjfXQrBvahU1
ETH 0x7c65139BC82A0BDC5b11F92001D5c5a112219f08
User avatar
Uncle Lumpy
Posts: 165
Joined: Fri Jul 01, 2005 8:55 pm

RE: "Hyping" my forthcoming mod (pun intended)

Post by Uncle Lumpy »

Thanks!
I once heard there was a garage, which some said was air tight.
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: "Hyping" my forthcoming mod (pun intended)

Post by Sabranan »

Hi Bacon,

While I love the tools your mod provides, I do have some issues.

First, when viewing the research tree the screen tends to "flash". This is a minor thing really but it does make it kind of hard to see what you're doing.

If you've selected a location and there's a build or colonise event waiting to happen (such as when you select a planet and there's a colony ship on the way), the black font is near unreadable.

But the most annoying thing is within an hour of play I'm getting out of memory errors when I try to save, or when autosave kicks in. This breaks it completely because it goes straight back to the main menu once you acknowledge the error. The exact message (might be the longest I've ever got in a dialogue box) is:

"---------------------------
Cannot save game
---------------------------
Distant Worlds could not save this game.

Error:

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

at System.Runtime.Serialization.ObjectToIdCache.Rehash()

at System.Runtime.Serialization.ObjectToIdCache.GetId(Object obj, Boolean& newId)

at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.OnHandleReference(XmlWriterDelegator xmlWriter, Object obj, Boolean canContainCyclicReference)

at WriteArrayOfHabitatToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )

at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)

at WriteArrayOfHabitatToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )

at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)

at WriteGalaxyToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )

at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)

at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)

at WriteGameToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )

at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)

at System.Runtime.Serialization.NetDataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContract contract, Hashtable surrogateDataContracts)

at System.Runtime.Serialization.NetDataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph)

at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectContentHandleExceptions(XmlWriterDelegator writer, Object graph)

at System.Runtime.Serialization.NetDataContractSerializer.WriteObjectContent(XmlDictionaryWriter writer, Object graph)

at DistantWorlds.CompactSerializer.WriteObjectContent(XmlDictionaryWriter writer, Object graph)

at DistantWorlds.CompactSerializer.WriteObject(XmlDictionaryWriter writer, Object graph)

at DistantWorlds.Main.method_359(Stream stream_0, String string_30)

at DistantWorlds.Main.FjJumqgwNe(Object object_7)

Working Set: 1134465024 bytes
---------------------------
OK
---------------------------
"
RogerBacon
Posts: 724
Joined: Wed May 17, 2000 8:00 am
Location: Miami, Florida, U.S.A.

RE: "Hyping" my forthcoming mod (pun intended)

Post by RogerBacon »

ORIGINAL: Sabranan

Hi Bacon,

While I love the tools your mod provides, I do have some issues.

First, when viewing the research tree the screen tends to "flash". This is a minor thing really but it does make it kind of hard to see what you're doing.

If you've selected a location and there's a build or colonise event waiting to happen (such as when you select a planet and there's a colony ship on the way), the black font is near unreadable.

But the most annoying thing is within an hour of play I'm getting out of memory errors when I try to save, or when autosave kicks in. This breaks it completely because it goes straight back to the main menu once you acknowledge the error. The exact message (might be the longest I've ever got in a dialogue box) is:

Hi,

Yes, the black text is bad. I noticed that right before release. However, the text never says anything useful. It just says that a ship is scheduled to build there. So, if you can see any text then you will already know what it means.

The flashing research is a symptom of the out of memory error I believe. I used to get those many months ago and posted in the technical support forum but they just said there was nothing that could be done with out of memory errors. I haven't seen it in a long time but I usually play on small maps. I also have auto save turned off.
How long into the game were you when it happened? Has it happened more than once?
BTC 14UURmC4rD762RStsufKmaUjfXQrBvahU1
ETH 0x7c65139BC82A0BDC5b11F92001D5c5a112219f08
Overlord015
Posts: 55
Joined: Tue Jan 20, 2015 8:08 pm

RE: "Hyping" my forthcoming mod (pun intended)

Post by Overlord015 »

ORIGINAL: RogerBacon

The flashing research is a symptom of the out of memory error I believe. I used to get those many months ago and posted in the technical support forum but they just said there was nothing that could be done with out of memory errors. I haven't seen it in a long time but I usually play on small maps. I also have auto save turned off.
How long into the game were you when it happened? Has it happened more than once?
If I'm not mistaken DW is a 32bit application, yes? There are applications out there that allow for the .exe to be modified to be large address aware, like: https://www.techpowerup.com/forums/thre ... re.112556/. Maybe this could resolve your memory issues guys? And maybe even also allow you to play in larger maps Bacon?

Do be warned, while I've done this to some of my other games, I've not used this on DW, so I'm not responsible for your villages getting ravaged by any marauding hordes in the event that trying this goes wrong. I haven't had memory problems so far (with vanilla or any of my personal mods), although I might try applying this myself if this mod happens to cause memory issues (did you have memory problems in the vanilla game as well Bacon?).
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: "Hyping" my forthcoming mod (pun intended)

Post by Sabranan »

It takes a while and I usually play mostly at 4x speed, on very large galaxies. But it's consistently happening with the mod within an hour of play from a new game.

That said, I've just tried the tool Overlord015 suggested and touch wood, it seems to be working!
RogerBacon
Posts: 724
Joined: Wed May 17, 2000 8:00 am
Location: Miami, Florida, U.S.A.

RE: "Hyping" my forthcoming mod (pun intended)

Post by RogerBacon »

ORIGINAL: Overlord015

(did you have memory problems in the vanilla game as well Bacon?).

Overlord, thanks for the tip on that program. Yes, I believe I have always had this error. I posed about it in Tech Support forum back on 2016-08-06 and I had been having it for some time before that. However, if Sabranan just started seeing it after playing my mod I may have to face to possibility that its something I did. I will look into it but I can't imagine what it could be because the stack trace doesn't even touch my code. Every method I injected has the word "Bacon" in it. If you ever see one of those in a crash's stack dump let me know right away.
ORIGINAL: Sabranan

That said, I've just tried the tool Overlord015 suggested and touch wood, it seems to be working!

That is great news to hear.

Here's what I've done over the past year to minimize these out of memory crashes.
1 Disable autosave
2 Save to two or more slots and alternate between them because a crash while saving will corrupt the save slot.
3 Zoom in the map and pause the game before saving. The game saves extra information for any object that is visible onscreen.
4 Check the tech screen before saving. If it is flashing then the game will crash on save. Instead of saving, keep playing and check again in 10-15 minutes. Memory is freed up all the time as threads exit. It can fix itself.

using the above steps I have had only one crash while saving in the past 3 months. Hopefully Overlord015's solution makes the above steps unnecessary.
BTC 14UURmC4rD762RStsufKmaUjfXQrBvahU1
ETH 0x7c65139BC82A0BDC5b11F92001D5c5a112219f08
Overlord015
Posts: 55
Joined: Tue Jan 20, 2015 8:08 pm

RE: "Hyping" my forthcoming mod (pun intended)

Post by Overlord015 »

ORIGINAL: RogerBacon

Overlord, thanks for the tip on that program. Yes, I believe I have always had this error. I posed about it in Tech Support forum back on 2016-08-06 and I had been having it for some time before that. However, if Sabranan just started seeing it after playing my mod I may have to face to possibility that its something I did. I will look into it but I can't imagine what it could be because the stack trace doesn't even touch my code. Every method I injected has the word "Bacon" in it. If you ever see one of those in a crash's stack dump let me know right away.

Here's what I've done over the past year to minimize these out of memory crashes.
1 Disable autosave
2 Save to two or more slots and alternate between them because a crash while saving will corrupt the save slot.
3 Zoom in the map and pause the game before saving. The game saves extra information for any object that is visible onscreen.
4 Check the tech screen before saving. If it is flashing then the game will crash on save. Instead of saving, keep playing and check again in 10-15 minutes. Memory is freed up all the time as threads exit. It can fix itself.

using the above steps I have had only one crash while saving in the past 3 months. Hopefully Overlord015's solution makes the above steps unnecessary.
If my memory isn't failing me, the devs fixed a couple of memory leaks early in the game's days, maybe they missed one? From what you're describing, I think that rather than your changes directly knocking something over, its more like its probably interacting with some preexisting issue that ends up in a possible memory leak. Although, I'm no expert on the subject matter, so slap me if I'm just making half-assed assumptions. If it isn't too rude to ask, what are your specs Bacon?

Also, thanks for the hints, going to use them to boost my game performance (have suffered from corrupted saves in some long-running games a couple of times).

And finally, separate question/subject, would you be willing to go into how you created this mod (through PM if you'd rather not publicize)?
RogerBacon
Posts: 724
Joined: Wed May 17, 2000 8:00 am
Location: Miami, Florida, U.S.A.

RE: "Hyping" my forthcoming mod (pun intended)

Post by RogerBacon »

ORIGINAL: Overlord015

If my memory isn't failing me, the devs fixed a couple of memory leaks early in the game's days, maybe they missed one? From what you're describing, I think that rather than your changes directly knocking something over, its more like its probably interacting with some preexisting issue that ends up in a possible memory leak. Although, I'm no expert on the subject matter, so slap me if I'm just making half-assed assumptions. If it isn't too rude to ask, what are your specs Bacon?

Also, thanks for the hints, going to use them to boost my game performance (have suffered from corrupted saves in some long-running games a couple of times).

There is definitely a save-related memory leak. I just took a saved game I have and saved over and over about 15 times. I watched my memory usage for Distant Worlds grow from about 550MB to over 900MB. That's one good reason to turn off auto-save right there.

From Sabranan's stack trace (identical to mine from last August) the issue is not total memory used but the working set for the saveGame thread. Distant Worlds fires up a separate thread to save the game. It allocates 8 MB to that thread. That's not the limit on the size of your saved game file but it is the limit of how big an object it can process at one time. Actually, its really only half of that because one method in the save process does an array copy and you have to have twice the size of the object when you do an array copy. Not surprisingly, that is the exact method where the crash occurs as you can see from his post above.

I've just made a change to my game and allocated 32MB of memory to the save game thread. That means 24MB less for the game itself to use but that shouldn't be a factor since it can still use 2+ GB like any other 32-bit application (or more with Overlord015's trick). I'll test some large map games run for awhile and see if I get a crash.

In addition to the save game crash, DW can always run out of memory like any other 32-bit game. This is exasperated by the aforementioned memory leak when saving. The solution there is just to monitor your memory usage and exit and restart DW every few hours.
And finally, separate question/subject, would you be willing to go into how you created this mod (through PM if you'd rather not publicize)?
I think if we ever hope to see a mod like this for DW2 I'll have to keep it at "No comment". Sorry.
BTC 14UURmC4rD762RStsufKmaUjfXQrBvahU1
ETH 0x7c65139BC82A0BDC5b11F92001D5c5a112219f08
Overlord015
Posts: 55
Joined: Tue Jan 20, 2015 8:08 pm

RE: "Hyping" my forthcoming mod (pun intended)

Post by Overlord015 »

There is definitely a save-related memory leak.

I've just made a change to my game and allocated 32MB of memory to the save game thread. That means 24MB less for the game itself to use but that shouldn't be a factor since it can still use 2+ GB like any other 32-bit application (or more with Overlord015's trick). I'll test some large map games run for awhile and see if I get a crash.

If it works, will you be updating the uploaded files with the changes? It might also be a good idea if one of us gathers up these findings and posts up a report over at tech support.
I think if we ever hope to see a mod like this for DW2 I'll have to keep it at "No comment". Sorry.
No worries, I understand.
Post Reply

Return to “Design and Modding”