89 Commits

Author SHA1 Message Date
Nate Smith
673232919b notes 2023-12-09 16:29:49 -08:00
Nate Smith
9162888a7d consolidate autosave into life thread 2023-12-06 21:52:40 -08:00
Nate Smith
be770c6b5e fix scoping on death_check change 2023-12-06 21:36:15 -08:00
Nate Smith
ed7498bd4a reduce CPU usage dramatically
I noticed that on tilde.town users with a high botany score used up a
lot of CPU cycles. I skimmed through the code and didn't immediately see
any tight loops, but after profiling against a user's borrowed .botany
directory I saw the culprit: the score increase thread.

This thread was designed to increase the user's score by 1 every time
the thread did an iteration of its infinite loop. It would sleep for an
interval scaled *down* based on how high a user's generation bonus was.
This meant that the sleep interval trended towards zero, creating a
tight loop for high scoring users.

This commit changes the code to use a constant sleep inteveral but scale
the score increment *up* based on generation.

I also removed the death check thread entirely since we were already
checking for death in the score thread. I also short circuited the death
check.

This had the effect of reducing CPU load for a high scoring user by a
factor of about 50.
2023-12-06 21:08:43 -08:00
Nate Smith
ea358f641d move Plant to its own module
Without this, trying to run this against cProfiler fails because pickler
can't find Plant in the "current" module. It's an annoying quirk of
pickle+cProfiler.
see: https://stackoverflow.com/questions/53890693/cprofile-causes-pickling-error-when-running-multiprocessing-python-code

this commit also adds a bunch of notes.
2023-12-04 22:04:00 -08:00
nate smith
151a700774 do not import * 2023-12-02 22:31:32 -08:00
Tiago Epifanio
c92b3d3667 Clean other instances of user 2023-03-20 00:26:43 +00:00
Jake Funke
bdfb113063
Merge pull request #40 from tilde-team/master
fix visiting
2022-10-12 12:15:42 -07:00
Ngô Ngọc Đức Huy
4ba1d6d46a
fix precision to first decimal place
fix precision to first decimal place to avoid floating-point error
2022-05-20 20:19:05 +07:00
Ben Harris
29369dae13 fix visiting 2021-04-06 15:50:53 -04:00
Jake Funke
38f7f17b66
Merge pull request #34 from jmdejong/evilvisitors
Don't let evil visitors kill a plant by adding old timestamps
2021-01-25 14:19:04 -08:00
J.M. de Jong
85d51f40f5
Stop making all plants godly
python2 division of integers always results in an integer, so `(2/3)` would result in `0`.
This caused all plants to get "godly" as rarity.
This change makes sure a float division is being used
2021-01-23 14:30:31 +01:00
troido
0556b3f75a protect plants against old timestamps 2020-10-03 09:44:06 +02:00
Jake Funke
ea92373f37
Merge pull request #24 from PaperMountainStudio/python3
Use python3
2020-04-03 14:55:10 -07:00
Paper Mountain Studio
c089f8fe67 delete old import for python2 2020-01-14 17:21:21 +01:00
Jake Funke
595a4d7e31 found an oopsie 2019-10-30 23:53:56 +00:00
Paper Mountain Studio
58ac0d3250 Use python3 2019-10-30 18:27:45 +01:00
ahriman
c9979c93e3 changed shebang to increase portability @ahriman/tilde.town 2018-12-06 16:18:26 -05:00
Jake Funke
2212596e5e halloween feature and death check fix 2018-10-03 18:53:49 +00:00
Jake Funke
e5261b79b1 fixed bug where users with live botany instances couldnt be watered 2018-08-10 20:14:11 +00:00
Jake Funke
e9b58bb61d tribute to abraxas. rest in peace friend. 2018-08-06 21:15:06 +00:00
Jake Funke
0c99c4f948 added some mutations 2018-07-12 17:42:34 +00:00
Jake Funke
2315a3ecd6 More accurate guest timing 2018-06-14 21:07:43 +00:00
Jake Funke
94584a2a36 fixed long term absence visitor check 2018-06-14 20:11:07 +00:00
Leagsaidh Gordon
63b39f92be
Fix the fix for generation bonus 2018-06-05 01:05:07 +01:00
Jake Funke
6dd0cc9d0d Merge branch 'master' of https://github.com/jifunks/botany 2018-06-05 00:02:05 +00:00
Jake Funke
f4de636a45 todos updated 2018-06-05 00:02:01 +00:00
Leagsaidh Gordon
ae99f2eb0b
Fix generation bonus not applying while closed 2018-06-05 00:54:08 +01:00
troido
6c72cc3d39 properly clean up after crash
put cleanup in finally block so it happens no matter the crash
this should prevend scrambled lines all over the terminal
2018-05-23 21:45:51 +02:00
troido
d0bc57226a dump safely by writing to tempfile
First write all the dump to a temporary file.
Rename temp file to actual file name when done.
This prevents savefile corruption when botany crashes during write.
2018-05-23 21:21:50 +02:00
Jake Funke
09b18e862d updated todos 2018-05-21 18:00:53 +00:00
Jake Funke
ce268c0609 Prevent exploitation of visit feature 2018-03-13 18:03:57 -07:00
Jake Funke
b9ef7c31bb Block user from visiting self, fix guest watering bug 2018-03-12 14:35:42 -07:00
Jake Funke
3b802dc931 Fixed water points bug 2018-03-11 15:51:11 -07:00
Jake Funke
a74d257506 File permissions, optimized db access 2018-03-11 15:44:10 -07:00
Jake Funke
eed6e61199 Cleanup and revisions 2018-03-11 14:30:10 -07:00
Jake Funke
2644370a40 Removed debugging and added clear weekly users cronjob 2018-03-11 14:23:00 -07:00
Jake Funke
d22b7d4b33 Weekly visits now held in db 2018-03-11 13:46:45 -07:00
Jake Funke
105a95f92e visitor queue handled 2018-03-07 23:31:00 -08:00
Jake Funke
55ce486dee Can check visitors now 2018-03-07 23:07:32 -08:00
Jake Funke
7e72c97928 Merge branch 'master' of https://github.com/selfsame/botany into selfsame-master 2018-03-06 17:39:16 -08:00
selfsame
1a0c3136cf pachypodium 2018-03-04 02:20:33 +00:00
Jake Funke
0665ba3506 water handling 2018-03-02 21:20:29 -08:00
Jake Funke
f29c8d5696 Turn off debug mode 2017-09-25 21:39:00 +00:00
Jake Funke
fba9bacf07 Update data structures 2017-09-21 14:29:11 -07:00
Jake Funke
2696a9d61d Decrease mutation rarity and reformat garden printing 2017-07-19 19:10:55 +00:00
Jake Funke
934c632b13 Lowered mutation chance 2017-05-26 00:06:27 +00:00
Jake Funke
e557dbab8f Generation system updated, readme updated 2017-05-04 18:49:29 +00:00
Jake Funke
c7ede5e854 Implement bonus growth for generations 2017-05-03 23:21:43 +00:00
Jake Funke
e0432f149f Add plant generations 2017-05-03 19:51:21 +00:00