Page 1 of 1

Added some functionality to Platforms

Posted: Wed Dec 21, 2016 11:09 pm
by Dreadicon
So, I made a version of RSO which allows for partial or complete use of Straight World mod but only for platforms. You can adjust how blocky/organic the shapes are by adjusting a ratio which I added to the config. I prefer just a little bit of imperfection with an overall blocky shape. This makes them more useful and feel more like they're from some alien civilization long-past.

Anywho, made this for myself mostly, but figured others out there might like it too. Do what you will with it; if orzelek uses it I'd be honored and maybe he could stick my username in a corner of a file somewhere....or not :) It's not like I did a lot; just re-wrote the straight world code to only work for platforms if a config is changed in RSO.

Re: Added some functionality to Platforms

Posted: Thu Dec 22, 2016 9:49 pm
by orzelek
Looks promising :)

Since it integrates nicely I don't see any problems adding it to RSO permanently. On thing that might need tweaking is to disable the processing when platforms mod is not present to make sure it's not searching around when it doesn't need to.

I haven't played around with platforms mainly because the are kind of incompatibile with bobs+angels set.

Re: Added some functionality to Platforms

Posted: Fri Dec 23, 2016 6:44 am
by Dreadicon
I'm actually playing with Angels+bob's right now, though I did turn up the starting zone platforms a little, turned on a medium-cost recipe to make more platforms, added AAI, and a neutered version of Factorissimo(sp?) where I set them as always night, reduced their interrior size to 2/3 scale, and disabled the option for building-in-a-building. Oh, and I've added Rampant AI + Natural Evolution (because I'm a masochist who thinks the enemies should be deadly on top of all that crazyness...)

I'm almost to the point of automating platform manufacture in my first run through, so that'll help. I've been meaning to add No Handcrafting and Only Robots to make it into a proper sci-fi factory survival sim, but I'm getting my sea legs with Platforms before I do that ;) I might end up disabling some of Angel's Petrochem buildings for placement inside Factorissimo buildings; mostly tanks and refineries. We'll see.

Anywho, glad you like the look of it :) Not bad for a few hours and having completely forgotten how to Lua (been wielding C# at my work, so takes a little getting used to a squishy language again). I would have implemented a check for if Platforms exist, but that's reliant on stuff I don't know, like what order mods are loaded in, when what is called, etc., so I decided to let the one more familiar with Factorio's mod API do that ;)

Re: Added some functionality to Platforms

Posted: Sun Dec 25, 2016 11:56 am
by orzelek
There is a recent addition that gives a direct array for mods that are installed so it's not a problem to check for mod.
When you add Factorissimo all balancing goes away anyway - you are basically multiplying space and that has a lot of consequences for stuff like terrain grabbing and defense.
Not sure how much you can fit of angel's in one factory tho.

Your total set of mods seems.. ambitious. I got stuck on trying to do bob's+angel's with science cost tweaker to make science more costly.

Re: Added some functionality to Platforms

Posted: Mon Dec 26, 2016 1:50 pm
by orzelek
Added this support to latest RSO version.
Thanks for preparing the code :)

Re: Added some functionality to Platforms

Posted: Thu Dec 29, 2016 6:02 pm
by Neemys
@orzelek

I'm Building-Platform author, is there something I could add in my mod to help with the support of RSO with my mod or you have taken care of everything ?

Platform incompatible with angel+bob ? Because of space needed or because some building aren't blocked ?

Re: Added some functionality to Platforms

Posted: Thu Dec 29, 2016 7:51 pm
by orzelek
Neemys wrote:@orzelek

I'm Building-Platform author, is there something I could add in my mod to help with the support of RSO with my mod or you have taken care of everything ?

Platform incompatible with angel+bob ? Because of space needed or because some building aren't blocked ?
Dreadicon did all the worka nd I integrated it already.

And angel+bob and platforms is to hardcore. They would need to be much bigger - small output high grade smelting facility might need 3-4 chunks of space :)
Even then it would be a pain looking at sice of my sorting areas - and I didn't have petrochem then.

Re: Added some functionality to Platforms

Posted: Tue Jan 03, 2017 9:52 pm
by Dreadicon
Glad my code was useful!

Concerning the matter of Factorissimo, thanks to my nerfs and tweaks, it is about a 1:3 ratio of expansion, and I've disabled the power plant option (so no packing steam generators or solar panels in them). This means that where previously one had to scrunch their factory into convoluted shapes, now, one just has to have multiple factories and move goods between them. This gets balanced out thanks to Angels + Bob's, which demand a lot of process and space. Also I denied some of the Angel's buildings from being placed inside, such as Ore Sorter and the various Refineries. I play with a medium-expense platform placement option (custom one using stone, concrete, and iron sticks, to the tune of 100/30/80) so I can expand, but generally it's best to just make separate factories. Mostly the recipe is so that I can make better use of odd shaped platforms.

More than anything, imo the combo of (nerfed)Factorissimo + Platforms changes the gameplay from 'build mega busses' to 'build modular factories'. I'm still adapting, and eventually I plan to add no hand crafting, only robot building, and finally I will add one that slices your inventory to a single row (expandable via power suit to a small degree). I mean, really, what use are cars otherwise? ;)

Re: Added some functionality to Platforms

Posted: Sun Jan 29, 2017 11:28 pm
by Dreadicon
Hey Orzelek, encountered an error in the Platforms code I wrote when using my monstrous pile of mods; LuaTile API call when LuaTile was invalid.

Already tracked down the cause and fixed it; new straight_world_platforms.lua code below. Essentially in some cases tiles can be called before they are 'valid', or they can be null. Added a couple null checks and a (tile).valid check. Toss it in your next update if you would; not especially urgent as I think this is an edge case caused by one of my other mods. Thanks!

Code: Select all

require("config")

local blocksize=6
local blockThreshold=straightWorldPlatformsThreshold
local blocksizem1=blocksize-1
local platformName = "building-platform"

function straightWorldPlatforms(surface, leftTop, rightBottom)
  local lt = leftTop
  local rb = rightBottom
  if surface == nil then
    return
  end
  for y0=lt.y,rb.y-1,blocksize do
    for x0=lt.x,rb.x-1,blocksize do
		--Check all blocks for platforms
		local replaceBlocks = false	
		local blockCount = 0
		for y1=y0,y0+blocksizem1 do
			for x1=x0,x0+blocksizem1 do
			  local tileObj = surface.get_tile(x1,y1)
			  if tileObj ~= nil and tileObj.valid then 
			    local tile=tileObj.name
			    if tile == platformName then 	
				  blockCount = blockCount + 1
			    end
			    if blockCount > (blocksize * blocksize) * blockThreshold then
			      replaceBlocks = true
				  break
			    end
			  end
			end
			if replaceBlocks == true then break end
		end
		--if enough platforms are found, replace the blocks
		if replaceBlocks then 
		  local tiles={}
		  for y=y0,y0+blocksizem1 do
			for x=x0,x0+blocksizem1 do
			  table.insert(tiles,{name=platformName,position={x,y}})
			end
		  end
		  surface.set_tiles(tiles) 
		end
    end
  end
end

Re: Added some functionality to Platforms

Posted: Mon Jan 30, 2017 7:13 pm
by orzelek
I add it along. I'm not sure if there will be any release before 0.15 - depends on how long devs will make us wait ;)