[Code] A Thread On Lambdas And Other Epsilons


simplex

Recommended Posts

@simplex

 

Upon climbing the beanstalk in Don't Starve, I'm getting the following error:

 

[20:18:09] (Up and Away (dev)) WARNING: @UpAndAway/code/prefabs/cloudrealm.lua:227: Overwriting existing component 'seasonmanager' of [100022 - cave].scripts/entityscript.lua(280,1) component seasonmanager already exists!    scripts/components/seasonmanager.lua(1529,1) SPRING TIME    scripts/mods.lua(17,1) error calling ComponentPostInit: seasonmanager in mod UpAndAway (Up and Away (dev)):...AndAway/wicker/kernel_extensions/dst_abstraction.lua:242: Logic error: two seasonmanager components instantiated in a game instance.LUA ERROR stack traceback:        =[C] in function 'error'        ../mods/UpAndAway/wicker/kernel_extensions/dst_abstraction.lua(242,1)        =(tail call) ?        =[C] in function 'xpcall'        scripts/mods.lua(15,1) in function 'fn'        scripts/entityscript.lua(290,1)        =(tail call) ?        ../mods/UpAndAway/code/prefabs/cloudrealm.lua(227,1) in function 'fn'        scripts/mainfunctions.lua(127,1)        =[C] in function 'SpawnPrefab'        scripts/mainfunctions.lua(161,1)    ...        =[C] in function 'SetPersistentString'        scripts/saveindex.lua(85,1) in function 'Save'        scripts/saveindex.lua(737,1)        =[C] in function 'SetPersistentString'        scripts/saveindex.lua(740,1) in function 'OnGenerateNewWorld'        scripts/gamelogic.lua(1041,1) in function 'cb'        scripts/screens/worldgenscreen.lua(168,1) in function 'cb'        scripts/frontend.lua(409,1) in function 'DoFadingUpdate'        scripts/frontend.lua(461,1) in function 'Update'        scripts/update.lua(46,1)    scripts/mods.lua(226,1) Disabling UpAndAway (Up and Away (dev)) because it had an error.  
Link to comment
Share on other sites

@simplex

 

Upon climbing the beanstalk in Don't Starve, I'm getting the following error:

Yeah, sorry, the mod was crashing under singleplayer. I added a custom cave implementation (prefabs/ua_cave.lua) to be used as a base for the cloudrealm entity, since DST's cave prefab isn't compatible with DST itself, and under singleplayer I was adding the seasonmanager component both to ua_cave and to the cloudrealm, resulting in a duplicate addition.

It should be fixed now.

Link to comment
Share on other sites

@debugman18

@DeathDisciple

Full cave support has been implemented. Both host and clients can enter/leave the cloudrealm within a session, without having to reconnect to the server (i.e., without ever breaking the connection). The worldgen screen does appear on clients as well, however the default one appears instead of our custom one*.

Below, whenever I mention a constant value, this is just the current default value. They can be tweaked in tuning/network.lua and tuning/voting.lua.

Entering the cloudrealm or not is done by consensus, through a poll. I implemented the following consensus modes:

  • UNANIMOUS: everyone must agree.
  • SIMPLE_MAJORITY: strictly more than half of the people must agree.
  • THREE_QUARTERS: at least 3/4 of the people must agree.
  • EIGHTY_PERCENT: at least 80% of the people must agree.
  • NINETY_PERCENT: at least 90% of the people must agree.
  • ALL_BUT_ONE: at most one person may disagree.
  • ALL_BUT_TWO: at most two people may disagree.
  • ALL_BUT_THREE: at most three people may disagree.
The list of possibilities (and their implementation) is in tuning/voting.lua. It's very simple to implement a new consensus mode: it's just a function that takes the total number of players and returns the minimum number of players that must agree with the poll (by "poll" I mean the motion to switch levels).

The current consensus mode is "UNANIMOUS", for testing purposes. The mode to be used in defined in tuning/network.lua, under CLIMBING_MANAGER.CONSENSUS. This value is a string that must match one of the consensus modes defined in tuning/voting.lua. For proper release, I think "SIMPLE_MAJORITY" should be the default. We could easily make that a mod configuration options, or, with more widget/screen patching work, we could add it to the server creation screen (it is the server setting that defines the consensus, the client setting is ignored).

The beanstalk and beanstalk_exit prefabs no longer have the activatable component. The climbable component now accepts the (new, custom) CLIMB action, which handles initiating a new climbing poll. The confirmation screen (where now confirming or not the entering to the cloudrealm means voting for or against the motion for the whole server to do that) for both the UP and DOWN cases is in screens/climbingscreen.lua, and it is pushed/popped by components/climbingvoter_replica.lua, so beanstalk.lua and beanstalk_exit.lua no longer have any screen/widget logic.

When a player clicks on a beanstalk/beanstalk_exit, the mod checks if there are at least the minimum number of players required pass the motion within a radius of 30, then a poll starts. This minimum number of players is determined by the consensus method configured. Then, each player within this range will get the "The land above is strange and foreign" or equivalent screen popup (these strings are now in code/strings.lua). Then each player votes. The poll has a timeout of 15 seconds, after which it will not pass if not finished. If at any point the number of agreeing players is greater than the minimum required by the consensus method chosen, the motion passes and the level switches. If at any point the number of disagreeing players is greater than the maximum allowed for the consensus method chosen, the motion fails and any confirmation screen still open on a client or the server pops.

Level switch polls have a cooldown of 20 seconds, to prevent trolling.

Whenever someone votes, the new partial poll data is printed to the console/log on each client and on the host (this data is synced via components/climbingmanager_replica.lua). It would be nice to add a text widget to the top of the screen announcing that.

* This is caused because on clients the worldgen screen is constructed passing 'nil' as the worldgen_gen_options constructor parameter. It would take a lot of work (saving data on files and reading them back to know if we're entering the cloudrealm or not) to fix this without engine support, so I think we should wait to properly implement that once the official cave implementation comes out, which should address this.

Link to comment
Share on other sites

@debugman18

@DeathDisciple

Full cave support has been implemented. Both host and clients can enter/leave the cloudrealm within a session, without having to reconnect to the server (i.e., without ever breaking the connection). The worldgen screen does appear on clients as well, however the default one appears instead of our custom one*.

Below, whenever I mention a constant value, this is just the current default value. They can be tweaked in tuning/network.lua and tuning/voting.lua.

Entering the cloudrealm or not is done by consensus, through a poll. I implemented the following consensus modes:

  • UNANIMOUS: everyone must agree.
  • SIMPLE_MAJORITY: strictly more than half of the people must agree.
  • THREE_QUARTERS: at least 3/4 of the people must agree.
  • EIGHTY_PERCENT: at least 80% of the people must agree.
  • NINETY_PERCENT: at least 90% of the people must agree.
  • ALL_BUT_ONE: at most one person may disagree.
  • ALL_BUT_TWO: at most two people may disagree.
  • ALL_BUT_THREE: at most three people may disagree.
The list of possibilities (and their implementation) is in tuning/voting.lua. It's very simple to implement a new consensus mode: it's just a function that takes the total number of players and returns the minimum number of players that must agree with the poll (by "poll" I mean the motion to switch levels).

The current consensus mode is "UNANIMOUS", for testing purposes. The mode to be used in defined in tuning/network.lua, under CLIMBING_MANAGER.CONSENSUS. This value is a string that must match one of the consensus modes defined in tuning/voting.lua. For proper release, I think "SIMPLE_MAJORITY" should be the default. We could easily make that a mod configuration options, or, with more widget/screen patching work, we could add it to the server creation screen (it is the server setting that defines the consensus, the client setting is ignored).

The beanstalk and beanstalk_exit prefabs no longer have the activatable component. The climbable component now accepts the (new, custom) CLIMB action, which handles initiating a new climbing poll. The confirmation screen (where now confirming or not the entering to the cloudrealm means voting for or against the motion for the whole server to do that) for both the UP and DOWN cases is in screens/climbingscreen.lua, and it is pushed/popped by components/climbingvoter_replica.lua, so beanstalk.lua and beanstalk_exit.lua no longer have any screen/widget logic.

When a player clicks on a beanstalk/beanstalk_exit, the mod checks if there are at least the minimum number of players required pass the motion within a radius of 30, then a poll starts. This minimum number of players is determined by the consensus method configured. Then, each player within this range will get the "The land above is strange and foreign" or equivalent screen popup (these strings are now in code/strings.lua). Then each player votes. The poll has a timeout of 15 seconds, after which it will not pass if not finished. If at any point the number of agreeing players is greater than the minimum required by the consensus method chosen, the motion passes and the level switches. If at any point the number of disagreeing players is greater than the maximum allowed for the consensus method chosen, the motion fails and any confirmation screen still open on a client or the server pops.

Level switch polls have a cooldown of 20 seconds, to prevent trolling.

Whenever someone votes, the new partial poll data is printed to the console/log on each client and on the host (this data is synced via components/climbingmanager_replica.lua). It would be nice to add a text widget to the top of the screen announcing that.

* This is caused because on clients the worldgen screen is constructed passing 'nil' as the worldgen_gen_options constructor parameter. It would take a lot of work (saving data on files and reading them back to know if we're entering the cloudrealm or not) to fix this without engine support, so I think we should wait to properly implement that once the official cave implementation comes out, which should address this.

 

 

Wow!

 

So it's technically ported now (aside from issues which will be solved by Klei in time, ideally).

 

 

giphy.gif

Link to comment
Share on other sites

Wow!

 

So it's technically ported now (aside from issues which will be solved by Klei in time, ideally).

I just implemented the poll data widget notification system. I'm using DST's standard announcing subsystem to broadcast it (it's always the host that broadcasts it). It's the same system used to announce some player joined/left or someone died/was revived, appearing at the top of the screen. The messages are something like:

Motion to climb up Giant Beanstalk: 1/2 yays, 0/1 nays, 1 undecided.
or

Motion to climb down Beanstalk Tip: FAILED.
In these examples 1/2 yays means one player agreed and 2 is the minimum required to pass the motion. 0/1 nays means no player disagreed and 1 is the minimum required to fail the motion. 1 undecided means one player hasn't voted yet.

However, in multiplayer I disabled our "Up and Away is a work in progress!" string at the top of the screen, since its position clashes with DST's notification system. We can fix it by changing its position, but since DST's announces may span several lines that'd be somewhat annoying; I don't think it's an important enough feature to merit the work needed in "porting" it.

Link to comment
Share on other sites

@debugman18

@DeathDisciple

Full cave support has been implemented. Both host and clients can enter/leave the cloudrealm within a session, without having to reconnect to the server (i.e., without ever breaking the connection).

...

 

 

Ahaha, just bloody awesome, show 'em how it's done. Not going to pretend I'm surprised tho.

 

My forum mentions are not working for some reason.

Link to comment
Share on other sites

@simplex

 

I'm still detaching stuff, but once I'm done I'm going to implement the reputation mechanic. I think having it be a component would be ideal. We could have a boolean for whether or not it is allowed to increase, have thresholds for more active changes, and have a reputation min/max.

 

What are your thoughts? The only part I'm stumbling on, is how to send events like a reputation-related prefabs being dropped/worked.

Link to comment
Share on other sites

@simplex

The reputation component has been implemented. I did basic functionality tests and it does indeed work as intended. Events will be added as needed on a stage by stage basis.

 

:grin:

 

I'm not sure, however, about DST compatibility yet. It'll likely need some adjusting.

 

Edit: I just realized it'll also need some decay functionality. A boolean of whether or not a particular faction can decay, as well as a specific decay rate. I'll take care of that tomorrow.

Link to comment
Share on other sites

Ah, sorry, didn't we have some sort of Bugtracker once?

 

2015_01_11_00001_by_milleniumcount-d8dg8

 

Happens when I went to the cloud Realm and picked up some Tealeaves. Winnie, dev branch, Up and Away Preview in World menu (maybe this doesn't work with the dev branch?)

 

Well, firstly, there is no longer a dev branch. You should be on master. :p

 

Anyway, could you share your log.txt? The error screen doesn't show enough for me to figure out what's happening.

Link to comment
Share on other sites

Well, it was shortly after generating the Cloud Realm. There were some Beefalos following me upstairs. As I said, Winnie  and just picking the first teabushes I saw. Picking was sucessfully until it crashed ...

 

I haven't been able to reproduce it, oddly enough. I've tried all sorts of things, but nothing is working.

 

On a side note, the cloud walls work as intended. The player leaves a fair sized trail behind them, so that you're encouraged to really make the most out of your cloud walls, instead of simply abusing them.

 

http://cloud-4.steamusercontent.com/ugc/31856754840890751/660B979B9C1E4A40B003002E29DC31872E7811AD/

 

If you could test their balance out next time you play, it'd be helpful. (You'll have to pull the latest changes.)

 

 

Link to comment
Share on other sites

I haven't been able to reproduce it, oddly enough. I've tried all sorts of things, but nothing is working.

 

 

Maybe this would be helpful. By watching the Video I saw that the Wod better Mod was installed when I started this game. Maybe disabling it afterward has impact on this behaviour?

 

I hope my english is understandable....^^

Link to comment
Share on other sites

 

Maybe this would be helpful. By watching the Video I saw that the Wod better Mod was installed when I started this game. Maybe disabling it afterward has impact on this behaviour?

 

I hope my english is understandable....^^

 

Er, the video is set to private. :p

 

Link to comment
Share on other sites

Arghhh, ok fixed. ^^

 

 

Okay, so I'm pretty sure that you're on an older version of the mod now.

 

The giveaway was the shopkeeper in the bottom left. In the more recent versions, he is actually next to the beefalo advertisement.

 

So if you check out this page:

https://help.github.com/articles/how-do-i-work-with-branches-in-github-for-windows/

 

It should help you out with switching to the master branch. If you get stuck and have any questions, just let me know.

Link to comment
Share on other sites

Alright the bug is gone with the newer version. But one question is the cloud wall in this version already. Or do I need moe than the Cumulocator to research it? I can't find it in the tabs.

 

Oh. If you'll pull from the repo, I just implemented it (the recipe).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.