More mod compability please

Replaces resource spawning system, so that the distances between resources are much bigger. Railway is needed then.

Moderators: orzelek, Dark

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

More mod compability please

Post by Bilka »

Currently when RSO gets the map generation settings it always uses the map generation settings from the nauvis surface. It would be nice if I was able to tell RSO which surface to use for the map gen settings. This could be achieved by changing the regenConfig remote function. Currently the code is

Code: Select all

	regenConfig = function()
		local surface = game.surfaces['nauvis']
		build_config_data(surface)
	end,
changing it to

Code: Select all

	regenConfig = function(surface)
		if surface then
			build_config_data(surface)
		else
			local surface = game.surfaces['nauvis']
			build_config_data(surface)
		end
	end,
should make it possible for me to call that function to use the map gen settings of the surface I create, while also not breaking other mods using the remote function.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

I'm sorry but multiple surfaces are not supported at this point.

And it's a lot more work that only change to this function - base logic of mod doesn't support multiple surface generation. There is no per surface tracking of generated resources currently and there is also only one configuration.
Changing those (especially some way to have multiple configurations per surface that can be separately defined) would require a lot of work (mostly in testing and keeping the support of this further on).

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

That's sad to hear, this means that I will have to disable RSO on my surface and force the user to use vanilla generation. I hope that you will consider multiple surface support in the future.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

Until now there was no requests to do it. There is a remote interface to ignore surface in RSO thats used by factorissimo.
I think that actual reason for full independent surfaces to work in parallel would be when game would actually support multithreading them.
Also with RSO active you won't get vanilla ores on second surface since they have no autoplace controls at all. It might be that your mod will not be compatible with RSO due to that.

Making RSO able to separately generate ores on two surfaces is not that difficult I think (assuming starting locations are on Nauvis still). Making separate configurations for each surface would require a lot more work.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

I mainly care about the map gen settings getting taken from the surface the chunks are getting generated on. My mod tries to achieve a "new game+" experience. For that I make a new surface, teleport the player(s) there and delete all chunks on nauvis (since I can't actually delete that surface..) The user can customize the map gen settings for that surface; however those have no effect on your mod, thus creating a dissatifying experience. For now I actually ended up just hiding the resource settings from the new game plus menu when your mod is installed, but still using its generation for the new surface.

This exact setup is also the reason why my original change proposal should work for my situation: I can change the config to use my new surface when I generate it, and since I don't care about nauvis I should be fine.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

Hmm and generation works on the new surface?
I would thinkg it shouldn't be functioning properly.. but I might remember wrong.
If you don't want to run two surfaces in parallel just one then your change would work without problems. I'd also need to add history reset so that stored data about previously generated ore gets reset too.

PS.
Starting from above description of what you want to do would make it much easier ;)

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

orzelek wrote:Hmm and generation works on the new surface?
I would thinkg it shouldn't be functioning properly.. but I might remember wrong.
I have never played with your mod, but it does indeed not seem to function properly, although that could be attributed to me not setting a starting area. Here is a small album of how the generation looks like on my surface: starting area is empty, but there are ores around that.
orzelek wrote: PS.
Starting from above description of what you want to do would make it much easier ;)
Yeah, I realized that when you replied again :)
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

Lack of starting area is caused by RSO being sure that it's already spawned. That would need to be tracked per surface to work properly I think. I'm a bit affraid to tinker with it to not create some strange migrations issues (I had that when adding multiple start locations :|).
Other issues are less visiblle because of large covered area - you might get less ores on new map since if rng hits spot generated previously it will skip it.
Testing if all works as intended for this will be a bit problematic. Do you have some kind of trigger in your mod that would start the jump to new surface? Remote call would be best for this to allow for quick testing.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

My mod generates the new world on gui click. I could also add a remote function to generate the new world if it's necessary, but I test by making the gui using a test command and then just clicking start or changing values if I need to.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

Is your mod already avaialble somewhere?
I can try to add what you need to restart map generation - depending on how it goes might need more testing before going to mod portal. Having your mod would help - or I can post modified RSO here first when I have something.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

I have yet to release my mod because I wanted to wait on you to make it so it could use RSO, but I attached the current version to this post. Technically the mod is finished, though I didn't comment out the command I use to (re)generate the GUI. The command is /regen_gui . It calls the same function my mod does when it makes the gui on rocket (+ satellite) launch. The mod takes the settings from that gui on the click of the start button and applies them to the new surface, teleports the player there, deletes all other surfaces, and deletes the nauvis chunks (since you can't delete nauvis....).
Attachments
NewGame+_0.0.1.zip
(5.82 KiB) Downloaded 131 times
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

I've released 3.4.0 now that contains new remote interface.
Method is called resetGeneration and requires surface as parameter.
It will reset internals of ore generation and update config based on given surface. It should also try to spawn initial starting location on that surface - I'm not sure how this will work if surface hasn't been used yet so might need more testing.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

Oh, thank you! I almost released the mod today but the mod portal didnt let me upload it. So this will make it into the release version :)
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

It works, the only issue I had that it sometimes spawned things on water. I fixed that by calling the remote function in on_chunk_generated instead of directly after creating the surface. I also call regenerate afterwards for good measure, so I would like to request you to remove the "done" print from that function (make it debug() instead).
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

Is that Done print that bad?
It's there to confirm to user that it was actually run. Just in case it doesn't work or difference is not immediately visible.

I can add one more parameter to skip the print if needed.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

orzelek wrote:Is that Done print that bad?
It's there to confirm to user that it was actually run. Just in case it doesn't work or difference is not immediately visible.
Well, to the random user, it seems like sometimes my mod prints "done" and sometimes it doesn't, because the random user doesn't know it's your mod doing it and
that only the first user sees it.
orzelek wrote: I can add one more parameter to skip the print if needed.
I'd still prefer it to be logged because that would mean that it is visible in log files that might appear in bug reports, though a parameter is just fine.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

Bilka wrote:
orzelek wrote:Is that Done print that bad?
It's there to confirm to user that it was actually run. Just in case it doesn't work or difference is not immediately visible.
Well, to the random user, it seems like sometimes my mod prints "done" and sometimes it doesn't, because the random user doesn't know it's your mod doing it and
that only the first user sees it.
orzelek wrote: I can add one more parameter to skip the print if needed.
I'd still prefer it to be logged because that would mean that it is visible in log files that might appear in bug reports, though a parameter is just fine.
It's good idea to put it into log - I've done it in 3.4.2 thats out now.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: More mod compability please

Post by Bilka »

Thank you! I hope the changes that you've made for me are also used by other mods in the future. My mod is out now btw: https://mods.factorio.com/mods/Bilka/NewGamePlus
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

aklesey1
Smart Inserter
Smart Inserter
Posts: 1862
Joined: Sun May 18, 2014 3:45 pm
Contact:

Re: More mod compability please

Post by aklesey1 »

Hi Orrzelek, very big to u - pls add compatibility for PYFE resources ;) viewtopic.php?f=94&t=51490
Nickname on ModPortal - Naron79

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: More mod compability please

Post by orzelek »

aklesey1 wrote:Hi Orrzelek, very big to u - pls add compatibility for PYFE resources ;) viewtopic.php?f=94&t=51490
I started to work on this and managed to do DyWorld (separate request) and then it turned out that PyFusion doesn't work alone - needs other mods to launch.
I'm waiting now for mod portal to come back up to grab rest of mods to try and launch PyFusion.

Edit:
New version is up.
Let me know if balance for PyFusion ores looks strange. I needed to cheat a bit since stone ones behave like fluid ores (singular spawns) but are not infinite and seem to be more like ores.

Post Reply

Return to “Resource Spawner Overhaul”