Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist ALL THE THINGS #16

Closed
WildWeazel opened this issue May 29, 2015 · 68 comments
Closed

Persist ALL THE THINGS #16

WildWeazel opened this issue May 29, 2015 · 68 comments

Comments

@WildWeazel
Copy link

Trees: World.generateTree(Location, TreeType)
Sugarcane: reuse soil check to find height of plant, then check if block above is air
Cactus: same as sugarcane, also check for solid blocks surrounding air block
Pumpkins/melons: search for attached fruit, if none search for adjacent air block above dirt/farmland, remove stem from DB, add again when fruit is broken??
Cocoa: ????
Mushrooms: ????

@ttk2
Copy link

ttk2 commented May 29, 2015

Coca just always grows out. Should be easy to figure out.

On Fri, May 29, 2015, 10:41 AM Travis Christian notifications@github.com
wrote:

Trees: World.generateTree(Location, TreeType)
Sugarcane: reuse soil check to find height of plant, then check if block
above is air
Cactus: same as sugarcane, also check for solid blocks surrounding air
block
Pumpkins/melons: search for attached fruit, if none search for adjacent
air block above dirt/farmland, remove stem from DB, add again when fruit is
broken??
Cocoa: ????


Reply to this email directly or view it on GitHub
#16.

@erocs
Copy link

erocs commented May 29, 2015

I wonder if the BlockChangeDelegate variant of generateTree will be needed to check for reinforcements. Hopefully it will just fire a growth event. Too bad it doesn't take a maturity level for the tree being generated.

@benjajaja
Copy link

I'm interested, but I'll have to take a better look at the code before I can tell you if I can do this or not. Will report back. Also mushrooms, they have some specific spreading rules.

@WildWeazel
Copy link
Author

Yeah, I don't think fully replicating vanilla behavior will be worth it. Hopefully that won't cause any problems.

I can do it but I'd rather keep focusing on Factories/Contraptions if you want to take it.

@benjajaja
Copy link

I was just thinking about the farms for these crops work:
Cacti: when it grows, the topmost block that grew is broken instantly. If we change this to persistent, then when the chunk loads after a long period, there will be MASSIVE amounts of instant growths and consequent block breaks and item drops. We could technically skip the block update and break events, but not the spawning of all the itemstacks.

I think that this may still be better than AFKing it performance wise, but the there would now be sudden lag spikes if the farm is big enough.

It may be worth exploring Contraptions to harvest cacti magically without performance impact, rather than creating huge amounts of blocks, break events, or itemstacks.

The same goes more or less for pumpkins, melons, sugarcane and mushrooms. There aren't that many autofarms like for cacti, but they do exist. Melons, pumpkins and sugarcane can be farmed with pistons from an interval or BUDs, and mushrooms with washing them away in an interval.

Ideas?

@ProgrammerDan
Copy link

Good analysis. Could the grouping of drop stacks be leveraged to reduce the performance impact by spawning dropped stacks instead of individual items?

Also, given the expense either way, perhaps finding the nearest hopper connect by water on a Y below the cactus, unimpeded by other blocks, would be feasible. Then stuff the hopper and any connected chests with cactus based on computed output.

@benjajaja
Copy link

We could group stacks yes, but don't count on putting them in hoppers - most farms collect items with water chutes into a central hopper.

@ProgrammerDan
Copy link

Yeah, that's exactly what I'm talking about, gipsy. Programmatically "follow" the water that's under the cactus source block, to the nearest hopper connected to the water. Etc.

Just figured that such a system might be less painful to the server then handling all the entity spawns on chunk load; could pre-compute association of cactus source to hopper/chest stack on chunk unload, then on chunk load, fill the chests/hoppers with items based on the expected rate of growth during the chunk's offline time.

@ttk2
Copy link

ttk2 commented Jun 8, 2015

that sounds like a job for a contraption, maybe an area collector contraption could be possible? Like a longer range hopper, but if we make them too easy to sue everyone will use them and we might negate our gains.

@benjajaja
Copy link

Eh, I think following water flow is going down the rabbit hole too much, perhaps? You'd have to calculate that on each chunk load unless I'm wrong.

Contraptions could support something like working together with RB to do basically the same thing sans following water flow. Maybe "absorb all potential offline cactus drops from above and in radius X" on chunk load. If RB can expose both chunk crops (cacti etc) and offline time to contraptions, this could make a good compromise. Existing farms could be adapted easily, just replace collection point with this contraption.

BTW I have to post to contraptions repo 'cause I couldn't figure out ow to make them work at all :|

@ttk2
Copy link

ttk2 commented Jun 8, 2015

I am not sure what state the contraptions code is, feel free to ask questions over there.

@ProgrammerDan
Copy link

@ttk2 I like that idea, it's a great thought for contraptions, although it's functionally identical to what I was suggesting.

@gipsy-king Nah, you'd only have to compute it on chunk unload, then apply the computation on chunk load, after which point vanilla behavior takes over and the computed behavior is inactive. Since it's on unload, you could spawn a FutureTask to handle the computation based on a snapshot of the chunks unloading, and allow the computation to "eventually" complete, with early cancelling of the job if the chunk re-loads before computation is done. That said, I like the contraptions idea. The "benefit" of my proposal would be no alterations to existing farms, but obviously that's not a priority in the grand scheme. Also, the Contraptions approach would be basically the same, but I'd guess more persistent.

Now we're getting into "wrong repo" territory, but with a contraption, you could suppress cactus growth and auto block break events (eliminating item spawn) and just have the item drop appear within the contraption. It should be relatively easy to define some system to mark out "area of control", but for the love of god don't make it a voronoi-style area-of-control; we're talking mechanisms, it should be a mechanically defined volume (placing lored blocks, "blueprint" loaded into the machine, something -- literally anything -- besides automatic subdivision based area control)

@ttk2
Copy link

ttk2 commented Jun 9, 2015

How would RB and contraptions communicate if we wanted to do this.
Obviously it requires coordination but we want to keep them separate.

On Tue, Jun 9, 2015, 8:03 AM Daniel Boston notifications@github.com wrote:

@ttk2 https://github.com/ttk2 I like that idea, it's a great thought
for contraptions, although it's functionally identical to what I was
suggesting.

@gipsy-king https://github.com/gipsy-king Nah, you'd only have to
compute it on chunk unload, then apply the computation on chunk load,
after which point vanilla behavior takes over and the computed behavior is
inactive. That said, I like the contraptions idea. The "benefit" of my
proposal would be no alterations to existing farms, but obviously that's
not a priority in the grand scheme. Also, the Contraptions approach would
be basically the same, but I'd guess more persistent.

Now we're getting into "wrong repo" territory, but with a contraption, you
could suppress cactus growth and auto block break events (eliminating item
spawn) and just have the item drop appear within the contraption. It should
be relatively easy to define some system to mark out "area of control", but
for the love of god don't make it a voronoi-style area-of-control; we're
talking mechanisms, it should be a mechanically defined volume (placing
lored blocks, "blueprint" loaded into the machine, something -- literally
anything -- besides automatic subdivision based area control)


Reply to this email directly or view it on GitHub
#16 (comment)
.

@WildWeazel
Copy link
Author

I think we could just expose a simple API to look up rate by plant and block/biome, basically a shortcut to what the click event handler does, and let Contraptions derive its output from that.

@ttk2
Copy link

ttk2 commented Jun 10, 2015

In the meantime let's do other crops one at a time. Getting something done
is better than waiting around forever.

On Tue, Jun 9, 2015, 8:56 PM Travis Christian notifications@github.com
wrote:

I think we could just expose a simple API to look up rate by plant and
block/biome, basically the and let Contraptions derive its output from that.


Reply to this email directly or view it on GitHub
#16 (comment)
.

@benjajaja
Copy link

Regarding plugin communication, @WildWeazel could RB emit a custom "chunk-load-harvest" event that contains data about how many blocks have been "spawned"? RB could then create these blocks, unless the event is cancelled by Contraptions presumably to fill the contraption. This would allow for a future implementation of contraptions while having persistence now.

I'm going to start with melon and pumpkin, then sugarcane. I don't think that there are many auto farms for these, although I have a tiny BUD autofarm for melons. Sugarcane is mostly farmed at an interval I think.

Cacti are a different story, because cactus farms are continuously dropping, so AFKing will always give more output than output from offline persistence, since the latter maxes out after the time it takes for all cacti to grow. I think cacti NEED contraptions, or players will continue to AFK cactus farms.

@WildWeazel
Copy link
Author

Perhaps so but does that also account for the manual stick checks? Do they trigger a whole chunk update?

@ProgrammerDan
Copy link

@gipsy-king Although I agree you should go ahead and tackle melons and pumpkins, do note that there are quite a few auto farms for both, and some are quite massive.

@ttk2
Copy link

ttk2 commented Jun 12, 2015

lets get what we can done while we discuss the rest.

@WildWeazel
Copy link
Author

trees at least should be easy enough, ironically

@WildWeazel
Copy link
Author

#20 for cocoa

@ghost
Copy link

ghost commented Jun 13, 2015

http://forum.civcraft.co/t/starting-soon-realisticbiomes-cocoa-persistent-crop-growth/457/2

I updated the jar and the config to the latest build. inb4 I borked something.

@ttk2
Copy link

ttk2 commented Jun 18, 2015

it looks like Coco works, next?

@WildWeazel
Copy link
Author

treeeees

@ProgrammerDan
Copy link

Good point. Perhaps a new chunk that fails the check should test if a runnable is already "queued" and attach itself to that runnable. Yay threadsafe coding.

@benjajaja
Copy link

@WildWeazel @ProgrammerDan should I add mushroom persistance? The easy route would be to subsitute with huge mushrooms like trees and nerf small mushrooms to the point of being useless, but that would upset A LOT of players. Normally I wouldn't care but this is delicate in the sense of players trusting that what they build won't be rendered useless anytime. The upside would be that chopping down huge mushrooms, like trees, is very complicated to bot.

Emulating the algo to grow shrooms isn't too difficult either. It has to be a 9x9x5 bounding box centered on the shroom, and in that box there can be max 5 shrooms, and a free spot requires to have dirt/grass/mycelium and low light or something like that.

@ttk2
Copy link

ttk2 commented Jul 21, 2015

how much lag is mushroom farming? if its not much efforts may be better centered elsewhere. Then again if its easy do it now.

@ProgrammerDan
Copy link

The mushroom spawning isn't the lag source. The issue is that mushrooms are harvested with flowing water released by pistons on a redstone clock. The water and pistons in large farms will be a significant lag source. I'm not aware of any designs that pop the mushroom using timed light sources, although that would be possible (and likely less laggy than flowing water).

So I don't see much value in persisting mushrooms, unless there's some means to harvest I'm not aware of, as the harvesting alone is the lag source, not the mushrooms.

@ttk2
Copy link

ttk2 commented Jul 22, 2015

very well then, @gipsy-king we have interesting reports that they RB remove plant function might actually be removing random blocks.

@benjajaja
Copy link

@ProgrammerDan the lag source we're targetting with persistence is AFKing. That is, chunks being continuosly loaded over long period of time with all their possible lag sources.

@ttk2 that would be the block-update function, that updates the block(s) to whatever the plant's growth is supposed to be. When a plant gets removed (that is the spam log message from the other issue, fixing ASAP), it only gets removed from the tracking list of the plugin.

@ProgrammerDan
Copy link

@gipsy-king I know, I'm not making my point clear. My point is, collecting the plant is the lag source. That's going to be true regardless, your efforts would be in vain for mushrooms specifically. It doesn't use a fixed flowing water source for collection like cactus can or melons and pumpkins can. The water is flowed selectively... much of the lag is the infrastructure at harvest time, not during the larger AFK time.

@benjajaja
Copy link

@ProgrammerDan but the target of persistence is AFK, not much else. If you want to make it less laggy, we can do it for example with disabling mushroom spread entirely and allowing giant mushrooms to grow like trees (I don't remember who proposed that, I think it was in the forum discussion).

@ProgrammerDan
Copy link

Ok, fair point. I concede. Perhaps my comments could be reframed as "set ttk's expectations" so he doesn't interpret mushroom persistence with any behavior or lag change, as it won't provide it. Just lets people leave their farms alone, but they'll need to return in the same frequency as their water-flow harvest mechanisms to keep the same rate of return, so I hazard they won't stop AFK'ing.

@benjajaja
Copy link

@ProgrammerDan yea there is a veri big issue of people still AFKing because it either 1. already works fine for them or 2. to setup a bot that connects for 1-5min every N hours is more complicated than most AFK mechanism.

Can we think of some way to penalize AFKers (vs disconnecting and using persistence), without penalizing farms that are near populated areas too much?

@ProgrammerDan
Copy link

We're working on it :P (Max and I). So keep your eyes on the AFKPGC mod, it's coming. We've got some good ideas to get people moving.

@benjajaja
Copy link

@ProgrammerDan yea I've been watching the development, looks good!

@ttk2
Copy link

ttk2 commented Jul 22, 2015

I think ideally we would rebalance RB such that harvests are only needed once or twice a day. Such that bots are not needed to harvest to maximum efficiency. Thoughts on this proposal?

@WildWeazel
Copy link
Author

Now that compactors are in it's more practical to work in high volume, so I think that makes sense. Would that mean multiple drops per harvest? How does that affect people who are actually growing food?

@hlprimm
Copy link

hlprimm commented Jul 23, 2015

Maybe something to "simulate" fertilizer. Make the maturity time 24 hours for wheat. You can get more wheat only if you punch it with a certain block, which is consumed from the player's inventory.

@WildWeazel I think people would just end up harvesting wheat as food less? I don't know how else you would prevent people from piggybacking on this change, though.

@ttk2
Copy link

ttk2 commented Jul 23, 2015

Why not just have a 24 hour grow period?

@benjajaja
Copy link

@ttk2 that would probably make people AFK less, since they just have to log in once a day.

@ttk2
Copy link

ttk2 commented Jul 24, 2015

that's the goal, lets just balance for that, work out how to keep it from being too big of a pay cut and call it a day.

@benjajaja
Copy link

@ttk2 the problem would be that food for newfriends without clay soil would take several days to grow, as WildWeazel pointed out.

@ttk2
Copy link

ttk2 commented Jul 24, 2015

this is true, its not like they will find any mobs to eat either.

@benjajaja
Copy link

@ttk2 if tried with something boring like cactus for starters, to set it to 24hrs, what would be the problem? Farmers will say "the output is way lower" and they'll be right, it will be 48 times lower.

I don't think adding some modifier that doubles the output of a single plant is a good idea. Ideally we would have a contraption that "sucks up" as much as we configure, but contraptions aren't there yet.

Cactus seems to have a huge number in XP recipes, namely 4 times as many as the cocoa requirement for example, simply becuase there is a huge output from farms. If we set the cactus requirements to roughly 1/50 of what it was before (or something higher for starters), I think everyone would be happy and we could reduce botting significantly.

@ttk2
Copy link

ttk2 commented Aug 1, 2015

I don't have an issue with that for cactus, but what about food crops? should we add a bread factory to allow the creation of the same amount of food from 1/48th the wheat while we reduce the xp what requirements by a factor of 48?

@benjajaja
Copy link

Let's start with cactus. I don't think it makes much sense to AFK wheat anyway. Harvesting bots aren't that common, and if you can make a harvest bot, you can just connect it every N hours, instead of having it idle between the "harvesting" program.

@benjajaja
Copy link

Correction regarding wheat AFK: it seems noone AFKs wheat, but wheat bots usually work on fields so large, that when the bot has finished harvesting, it has already grown back at the beginning.
So increasing wheat time would probably just increase farm sizes, annoy players and not really reduce AFK for now.

@benjajaja
Copy link

closing this issue, if we need persistent mushrooms we should open a new issue.

@ttk2
Copy link

ttk2 commented Aug 1, 2015

ok lets start with cactus then, it should be an easy change to make.

@benjajaja
Copy link

@ttk2 I'm going to make a PR setting the time to 12h and explaining that it requires the XP recipes to be adjusted.

psygate pushed a commit to psygate/RealisticBiomes that referenced this issue Oct 26, 2020
Add more information to RB GUI
psygate pushed a commit to psygate/RealisticBiomes that referenced this issue Jun 23, 2022
Add right click to auto replant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants