Page 1 of 4

[0.11.22] Automated Red Alert harvesters 0.1.0

Posted: Fri Jun 05, 2015 11:21 am
by ThaPear
After many hours of coding, spriting and prototype definitions, I bring you:
Automated Red Alert harvesters
This mod brings back the fully automated, fully animated Red Alert harvesters for your pleasure! (And profit, of course)

Image. Image? Image!
Image

That's not enough? Ok, here's a gif: Optimized by imgur.
Raw 11mb gif
How does it work? A step-by-step guide:
1. Research the technology. (/c game.players[1].force.technologies["Old-World-Harvesting"].researched = true)
2. Craft a refinery and any number of harvesters. (About 200 should do)
3. Place them down.
4. Place a belt at any (or all) of the three lanes shown above. (Or don't, you can use inserters)
5. Put coal in the harvester(s). (You didn't think it'd be free did you?)
6. Sit back and watch the resources roll in.

More information:
Animations!
No belts are required! Place one or two (or 24) inserters and watch them pluck the resources from the refinery with weirdly extending arms!
The harvesters automatically refuel at the nearest refinery that contains the fuel they're currently using, so make sure it's available.
The refinery is also a smart chest, this allows you to do many things. (Such as maintaining the fuel supply)
The refinery will always try to keep at least a stack of each fuel containing item it contains.
Sorting the ores is up to you. It won't be done by the refinery.
There's probably loads of bugs, so do please report them.

Known issues:
There's no preview when placing the harvester. Just place it and it'll appear.
The harvester ignores every entity on its path, this is due to the nature of its movement. The only way to move/turn an entity in script is to teleport it.

Q&A:
Q: Isn't this overpowered?
A: Probably, but it looks cool!

Q: Why can't I drive them?
A: Why waste your time driving them if you can let them do the driving! (Also, that mod already exists, albeit quite outdated)

Q: Can I use your mod for ----?
A: PM me and I'll quite probably say yes.

Q: I love this mod!
A: That's not a question, but do please let me know in a reply! It's comments like that we do this for!

Latest version:
Harvester-mod_0.1.0.zip
(1.33 MiB) Downloaded 22506 times
Old Versions
Changelog
Special thanks/credits:
McSpiffy, who built the mod that inspired this: [MOD] 0.9.X]Red Alert Harvester V0.0.5 (Which I've used the recipes from)
The people who helped me at Maximum number of frames
The creators of Red Alert, who I've shamelessly taken the sprites from. (It's free nowadays, so go play it!)
The factorio team, for making a game I spend too much time playing and modding on.

Re: [0.11.22] Automated Red Alert harvesters 0.0.1

Posted: Fri Jun 05, 2015 1:52 pm
by n9103
Holy crap. This is exactly what that mod needed. :D
What's the logic behind the harvester's points to harvest from? And how long, since they don't harvest to depletion?
I would guess that when you said they ignore all entities, that they also don't queue up to unload, and several can unload at the same time?
Have you made sure that the harvesters don't dump more ore than the refinery can hold?
Hope these questions aren't too much of a bother, but I haven't been playing Factorio in awhile, and can't look at this first hand to deduce the answers myself. Plus could be useful info for other people.

Assuming this doesn't get broken horribly with the .12 update, I've just found a new mandatory mod for myself.

As for balancing, decreasing the amount the harvester scoops per cycle by a fair bit would work. Would probably need to reduce the maximum load somewhat as well so that it doesn't take forever to return any ores.

Re: [0.11.22] Automated Red Alert harvesters 0.0.1

Posted: Fri Jun 05, 2015 2:23 pm
by ThaPear
n9103 wrote:Holy crap. This is exactly what that mod needed. :D
What's the logic behind the harvester's points to harvest from? And how long, since they don't harvest to depletion?
I would guess that when you said they ignore all entities, that they also don't queue up to unload, and several can unload at the same time?
Have you made sure that the harvesters don't dump more ore than the refinery can hold?
Hope these questions aren't too much of a bother, but I haven't been playing Factorio in awhile, and can't look at this first hand to deduce the answers myself. Plus could be useful info for other people.

Assuming this doesn't get broken horribly with the .12 update, I've just found a new mandatory mod for myself.

As for balancing, decreasing the amount the harvester scoops per cycle by a fair bit would work. Would probably need to reduce the maximum load somewhat as well so that it doesn't take forever to return any ores.
It waits until there's enough free slots to dump its cargo hold contents.

As for the selection logic:
It mines 9 (up to 16) ore per scoop and scoops 3 times per location.
It randomly selects an ore point within a radius of 7 from its last position.
When leaving from a refinery, it uses a starting radius of 15 to make it drive further on average.
If no ore is found within the starting radius, it's increased by 5 each tick until ore is found.

harvesterstats.lua lists all these things and allows you to easily adjust them without even having to restart the game :D.

Code: Select all

Stats = {
	RotationSpeed = 0.01, -- Per tick, 1.0 is a complete loop.
	MovementSpeed = 0.085, -- Tiles to move per tick.
	OreMinedPerScoop = 9, -- At least N, at most N+8 due to underlying mechanics. Multiples of 9 work best. (The 8 is dependent on the MiningRadius)
	ScoopsPerLocation = 3, -- Amount of scoops to take in a single location.
	MiningRadius = 1.1, -- Radius in which to search for ores when currently scooping.
	-- Radii automatically increase if no ore is found.
	DefaultSearchRadius = 15, -- Starting radius to search for a random ore when at a refinery.
	CloseMineSearchRadius = 7, -- Starting radius to search for a random ore when it's just finished scooping a location. Lower will result in less driving between scoops.
	
	EnergyUsedPerTick = 1200000 / 60, -- 1200kW. Energy is only consumed when animating or driving.
	
	TicksPerAnimationFrame = 4, -- Less means faster animations.
	TotalAnimationFrames = 117, -- Technical, can not adjust.
	
	RefineryApproachOffset = {5, 2}, -- Location to drive to before approaching a refinery.
	RefineryDumpOffset = {1, 2.5}, -- Location to dump the ores.
	
	-- Adjust this in the prototype definition as well! (prototypes/entities/harv_entity.lua, line 7) Mismatch will result in issues.
	HarvesterCargoSlots = 20,
}

Re: [0.11.22] Automated Red Alert harvesters 0.0.1

Posted: Fri Jun 05, 2015 9:42 pm
by XyLe
This is super-extremely impressive! ) gonna try and play with this mod for a bit. Very curious :)

Re: [0.11.22] Automated Red Alert harvesters 0.0.1

Posted: Fri Jun 05, 2015 10:07 pm
by laige
I like this mod well done.

Now for a tiberium Ore Mod. An Ore that solves energy problems but spreads unless it is contained/mined and is harmful to life forms. :D

Re: [0.11.22] Automated Red Alert harvesters 0.0.1

Posted: Sat Jun 06, 2015 4:40 am
by CreeperDaReeper
laige wrote:Now for a tiberium Ore Mod. An Ore that solves energy problems but spreads unless it is contained/mined and is harmful to life forms. :D
YES! H*** YES!!! Would play the crap out of that!

Re: [0.11.22] Automated Red Alert harvesters 0.0.1

Posted: Sat Jun 06, 2015 8:54 am
by Aikonn
I am getting error when loading auto-saved game:

Code: Select all

Error while running the event handler:
__Harvester-mod__/harvester-anims.lua:140:
attempt to perform arithmetic on global 'animationTick' (a nil value)
btw: Cool mod!

Re: [0.11.22] Automated Red Alert harvesters 0.0.2

Posted: Sat Jun 06, 2015 11:41 am
by ThaPear
Updated to 0.0.2
Thanks for all the positive comments guys, it means a lot!

How would you imagine the ore solves energy problems? The growing/being harmful wouldn't be a problem to code.

Aikonn wrote:I am getting error when loading auto-saved game:

Code: Select all

Error while running the event handler:
__Harvester-mod__/harvester-anims.lua:140:
attempt to perform arithmetic on global 'animationTick' (a nil value)
btw: Cool mod!
Whelp, I'm surprised it even worked at all. It should be fixed now, check the first post for 0.0.2

Re: [0.11.22] Automated Red Alert harvesters 0.0.2

Posted: Sat Jun 06, 2015 12:22 pm
by darkshadow1809
ThaPear wrote:Updated to 0.0.2
Thanks for all the positive comments guys, it means a lot!

How would you imagine the ore solves energy problems? The growing/being harmful wouldn't be a problem to code.

Aikonn wrote:I am getting error when loading auto-saved game:

Code: Select all

Error while running the event handler:
__Harvester-mod__/harvester-anims.lua:140:
attempt to perform arithmetic on global 'animationTick' (a nil value)
btw: Cool mod!
Whelp, I'm surprised it even worked at all. It should be fixed now, check the first post for 0.0.2
Like have a refinery for it :)? Special building which accepts those and only those kinds of ores. In this case tiberium. and have the building output a huge amount of power if active? :P ? Just an idea.

Re: [0.11.22] Automated Red Alert harvesters 0.0.2

Posted: Sat Jun 06, 2015 12:30 pm
by n9103
It's an item that's used as a fuel (not a fuel item) to create buttloads of energy at low pollution rates.
Can't make it a fuel item obviously, or you could use it in anything that takes fuel.
If it spreads very slowly and maintains a very low maximum density (thinking single digits/tile), it might even be possible to have something that's not completely imba if you use the map gen to place the starting patches.
Stick that into a special refinery to get tiberium fuel, and that goes into a reactor/power plant that gives off no pollution while providing a large amount of power per tiberium.

As a starting point to find balance, I would imagine generating something like 1MW for 1 minute per tiberium used to make the item.
I'd say however long the item lasts should be somewhere around 2-4x how long it takes to process the tiberium, and each item should take a full tile's worth of tiberium to make.
Varying the ratio of tiberium/item, net power/item, and growth rate/item working time are going to be the main balancing ratios.

I don't want to call the refined tiberium a fuel rod, but replace all the references to "item" above with whatever you'd call it's refined form.
Also, obviously I pulled this idea and all these numbers out of thin air, so don't put too much into it. ;)

Re: [0.11.22] Automated Red Alert harvesters 0.0.2

Posted: Sat Jun 06, 2015 2:09 pm
by Alekthefirst
Now we just need to replace the biters with some NOD scum to beat over the Tiberium

Re: [0.11.22] Automated Red Alert harvesters 0.0.2

Posted: Sat Jun 06, 2015 7:38 pm
by laige
I am just going off the c&c story line for the first Tiberium War. The storyline tells us that tiberium was going to be a source of unlimited energy solving all humanities problems. GDI and NOD started fighting as tiberium was rather rare at first. In game-play though it was just a type of money.

The whole energy source of tiberium bit, I don't think we saw it in the games. Instead as the story developed; tiberium was shown as a huge curse mutating organic life and even terraforming the planet. Its just the idea of it being a limitless source of energy got the fighting started in the beginning. At least that's how I understood the first game.

I really like the C&C games, and your mod is lots of fun. Thank-you for the updated version.

A Tiberium Ore mod would be lots of fun too.

I imagine finding a field and having to put walls around just to stop it from growing outward faster then I can mine it. Bitters crossing the fields and getting poisoned, but every once in a while when one dies from tiberium poison, a mutated bitter spawns. Or those bitters not being highly intelligent will destroy a wall that is keeping a tiberium field from expanding; on there way to kill my machines. Perhaps I have a field that nearly run dry. I would just cut back or stop mining it until the ore grows back enough. How horrible it would be if I didn't notice; and did mine the field completely. I would have to find another field.

I don't really have a good idea of what an energy producer based on tiberium would look like. http://en.wikipedia.org/wiki/Tiberium says - It gives off radiation, which in the game universe is harnessed both for energy and as a weapon.

On another note I also gave thought to how the early C&C games had showed mountains that were just impassible textures. No real elevation but it gave the illusion that there were different levels of terrain. I often thought that terrain concept would fit well in factorio.

Re: [0.11.22] Automated Red Alert harvesters 0.0.2

Posted: Sat Jun 06, 2015 9:21 pm
by Airat9000
It would be nice to make up base drove the machine)) is firstly, and secondly to make production and handling longer .. and technology to make what one technology opens up more and faster production resources ..

Re: [0.11.22] Automated Red Alert harvesters 0.0.2

Posted: Sat Jun 06, 2015 9:43 pm
by FishSandwich
Hi, got error when trying to mine a harvester:

Code: Select all

Error while running the event handler: __Harvester-mod__/harvester.lua:89: attempt to index field 'driver' (a nil value)

Re: [0.11.22] Automated Red Alert harvesters 0.0.3

Posted: Sat Jun 06, 2015 11:08 pm
by ThaPear
FishSandwich wrote:Hi, got error when trying to mine a harvester:

Code: Select all

Error while running the event handler: __Harvester-mod__/harvester.lua:89: attempt to index field 'driver' (a nil value)
Now this is getting silly... Sorry, another mistake by me. (And a lack of proper testing)

Updated to 0.0.3

Re: [0.11.22] Automated Red Alert harvesters 0.0.3

Posted: Sun Jun 07, 2015 12:04 pm
by Dariel92
RU: при загрузке сейва выдало такую ошибку Error while running the event handler: __Harvester-mod__/harvester-anims.lua:140: attempt to perform arithmetic on global 'animationTick' (a nil value) возможно это потому что я играл с версией 0.0.1, но все таки подумал что лучше сказать об этой ошибке.
EN: if you load the save game gave this error Error while running the event handler: __Harvester-mod__/harvester-anims.lua:140: attempt to perform arithmetic on global 'animationTick' (a nil value) maybe it's because I played with version 0.0.1, but still thought it better to say about this error.

Re: [0.11.22] Automated Red Alert harvesters 0.0.3

Posted: Sun Jun 07, 2015 12:07 pm
by ThaPear
Dariel92 wrote:RU: при загрузке сейва выдало такую ошибку Error while running the event handler: __Harvester-mod__/harvester-anims.lua:140: attempt to perform arithmetic on global 'animationTick' (a nil value) возможно это потому что я играл с версией 0.0.1, но все таки подумал что лучше сказать об этой ошибке.
EN: if you load the save game gave this error Error while running the event handler: __Harvester-mod__/harvester-anims.lua:140: attempt to perform arithmetic on global 'animationTick' (a nil value) maybe it's because I played with version 0.0.1, but still thought it better to say about this error.
Yeah, that was fixed in 0.0.2. Thanks for letting me know though.

Re: [0.11.22] Automated Red Alert harvesters 0.0.3

Posted: Sun Jun 07, 2015 12:23 pm
by FishSandwich
Playing with 0.0.3, getting this error when loading a save.

Code: Select all

Error while running the event handler: __Harvester-mod__/harvester.lua:322: attempt to index upvalue 'self' (a nil value)

Re: [0.11.22] Automated Red Alert harvesters 0.0.3

Posted: Sun Jun 07, 2015 12:33 pm
by DusoMR
FishSandwich wrote:Playing with 0.0.3, getting this error when loading a save.

Code: Select all

Error while running the event handler: __Harvester-mod__/harvester.lua:322: attempt to index upvalue 'self' (a nil value)
Hi!! I love Red Alert so.... I love your MOD!! xD But I get the same error when I try to load a savegame.

I´m on 11.22 and I have other mods installed: Cyberchest, Test Mode and speedy brain´s supreme warfare. If I deactive them (except Test Mode) the error is still there :/

Thx!!!

PD. Sorry by my english ^^
PPD. Could be possible that harvesters look for refineries with avaible storage? :P

Re: [0.11.22] Automated Red Alert harvesters 0.0.4

Posted: Sun Jun 07, 2015 2:23 pm
by ThaPear
Yeah, that error was a bit more elusive. It only occurred when a harvester was mid-animation during a save.
It appears table values are not correctly saved alongside closures, so it took me a bit to fix.
This version should fix savegames that were having the 0.0.3 error. If it doesn't, let me know.

Updated to 0.0.4

It also didn't help that lua (or at least Factorio) doesn't allow this code:

Code: Select all

tbl = {subtbl = {}}
subtbl.parent = tbl