Autonauts

Autonauts

SameNameSameWork
30 Comments
Sunyata 13 Feb, 2024 @ 10:32pm 
This mod was great in older days, but now Bot Databse is enhanced and easy to use. Further more, I experienced a problem using this mod in current game version. A container was stuck and I can't put something in or out so I had to reload the game. I guess this mod may caused it, I'm not sure though.
Rushin 6 Jul, 2023 @ 6:13am 
I'm a little confused, isn't this exactly what the bot database does in vanilla? Was this mod created before it even existed or is it helping achieve something else?
Ohmere 27 Dec, 2022 @ 12:46pm 
Possible bugs:
- Doesn't seem to work across different bot tiers
- Doesn't seem to work on bot tiers other than the lowest.

This is likely because I'm using another mod "BotUpgrade" to change T0 bots to T1 and above

I shall test this.
Ohmere 26 Dec, 2022 @ 7:43am 
Or, another idea.

I have a farming area where bots each have a 1x10 slice next to each other.
Each new bot i add I use the SameName thing then change the name afterwards so I can move the search area of each new bot up by one.

Maybe you could find a way to include "shifting" into the name, so each new bot has the SameName but a syntax in the name can have them "shift" by whatever is written like... I dunno Berry Farmer <Z+1>

Maybe you could make it so each new bot added "counts" how many with the SameName there are already and "shifts" that number of times.
Ohmere 26 Dec, 2022 @ 7:33am 
May I suggest a idea:

A few options where you can toggle what aspects to ignore when copying scripts.

Things like storing locations, bot search locations, what building to use, player set values in scripts etc...

For example, two bots storing two different things at two locations.
You don't want to sync their search or storing location but what they do when the storage container is full, so you toggle the search location and store location to be ignored.

Of course I'm not asking for a perfect solution, I still expect having to tweak some values back to what they were, but I just think this might help just a little bit.
Megümin · Arkäne 23 Jun, 2021 @ 4:51am 
@windthunder310
Yeah, same here ^^

Anyway, I would like to say, good luck & thanks for your mods. ^^
And don't push to hard, a new feature is coming to "register a bot to a script" (auto sync). But, it can be released in 2 months or 2 years, we don't know :D
windthunder310  [author] 23 Jun, 2021 @ 2:56am 
@Arch-kain

I’m not familiar with lua. In fact, this is my first mod.

I have not done the performance analysis of this mod, so I don’t know what is the main reason for the performance problem, I guess it is in ModBot.GetScriptSavegameFormat() and ModBot.SetScriptSavegameFormat(), if it is really the problem of these two functions , There is probably no way to solve it, because the number of uses of these two functions cannot be reduced.

I have to find out how to check the running time of lua before testing
Megümin · Arkäne 22 Jun, 2021 @ 9:22am 
@windthunder310
No worries! I have issues with english, and use google translate too :p

People can forget what the shortcut is indeed ^^ But they can re-read the mod's description instead. Set their own shortcut helps to remember (for F5 make sense to me)
That apart, using a shortcut to temporary pause/play auto sync is not ideal, yes x) But it was my solution to my design and, to the "lack of api"

In your case, for the performance concerns, (and i know too much loops can cause performance issues sometimes) , I don't know if 2 loops (register script ; set script) is "too much" or not. But it is necessary. Instead, this is maybe a game performance issue
I don't think either that adding a shortcut is useful in this case

But! (i'm way **not** a lua expert xD), maybe instead of 2 loops, using just one can improve performances:
- register script if its not already (re-check this bot later if no script)
- otherwise, set script
'just a thought, I don't know ^-^
windthunder310  [author] 21 Jun, 2021 @ 9:09pm 
@Arch-kain

Sorry for my bad English, although it is ok to read the file, but I can’t write, so I use Google Translate

Regarding the shortcut key part, I mean for the player, if he forgets what the shortcut key is for a certain operation in the game, he can’t check it in the game, he can only go back to the main screen and go to the mod setting to find it. I think this is bad.

So if the performance problem can be solved, I hope there is no need to set the AutoSync switch and shortcut keys (Always AutoSync)

But in this version of yours, there should be no way to remove the shortcut keys
Megümin · Arkäne 21 Jun, 2021 @ 8:05pm 
@windthunder310

I can try to fork from the current version to [...]
If it's a question, if you want, do as you like! :D
but (like i said, if i helped), yeah, i would like a mention of me somewhere, why not, and that would be nice of you ^-^

For the rest, I'm not sure if I understand very well what you mean :thinking: but let's try!

The more troublesome[...] (it's a fact)
Yes, indeed

"which shortcut", I suppose you mean " the player don't know what the shortcut do" ?
[But in case : NO]
We (you & me) don't need to know what the shortcut's value is (it's 1, 3 or something else ?),
we just need its name (eg. my "Toggle auto sync")

[YES] When I wrote this, I thought a description :
<shortcut name> do <this>. Please, check if it's not already used (we can only use 1-9, it's very limited)
I recommend <this shortcut>* ; in your case, you can use it


* My own shortcuts was
"Sync bots now" : F5
"Toggle auto sync" : F6 (or Ctrl+F5) -ish
windthunder310  [author] 21 Jun, 2021 @ 5:46pm 
@Arch-kain

I have finished reading it, and I probably understand your design

If you don’t want to publish, I can try to fork from the current version to a version that considers the group name and mention your contribution. How about that?

The more troublesome part is probably AutoSync, because you have to load the game to check if there are duplicate groups, but AutoSync can only be set outside the game

Your approach is to use shortcut keys to switch AutoSync in the game, but there is no way to check which shortcut keys will do in the game. This makes me very unwilling to use shortcut keys.
Megümin · Arkäne 21 Jun, 2021 @ 4:55pm 
@windthunder310

https://pastebin.com/mBPzZjHz
See GetGroups() function for your question. It was my solution. Maybe it's too much and reduce the "many bots" threshold, but, meh! it was fine to me.

I don't specially want to publish my script. It was just for me. I used your codes (2-3 mods), learned modding for autonauts "for the fun", make my own version and "it work like a want", that's it :p Plus, I don't want to maintain this (specially when I'm **not** playing the game)

But, I don't know :shrug, if you want and if my script helps you , note my name somewhere :p
windthunder310  [author] 21 Jun, 2021 @ 11:50am 
@Arch-kain

How can I tell if there are two groups with the same name? When I test, if two groups are called "aaa", ModBot.GetBotGroupNames() will get ["aaa"] instead of ["aaa", "aaa"], please share your version, thanks.

In addition, if you want, you can fork a version that has a group name, as long as you refer to this mod.
Megümin · Arkäne 21 Jun, 2021 @ 5:34am 
" As for the part of the group name you mentioned [...] "
I modified your mod a month ago, for my own use. And indeed. The API don't provide us the ability to get group id. Instead we can only get names.

If two or more groups have the exact same name. The code "merge" these groups to one and we get all their bots, when we use their id for synchronisation.

Personally, I used a popup to warn me when groups have the same name

(If you want, I can share my "edit" with you)
windthunder310  [author] 20 Jun, 2021 @ 2:43pm 
@'KeithFromCanada' Olson

When I was making this mod, I imagined that you only need to do some ordinary operations, modify the name, modify the code, and do not need to press any shortcut keys.

Of course, the ideal situation is that I only synchronize once when changing the name/code, but there is no such type of event as "when..." in the mod file of autonauts, so I can only check and sync every second.

If there is no performance problem, I don't even want to set the AutoSync switch, so I want to keep AutoSync turned on by default. This is also to let people who have installed this mod not feel that this mod suddenly fails.

As for the part of the group name you mentioned, I just checked the file and tested it. If there are two groups with the same name, I cannot tell them apart. I think this will cause more confusion. Even if you don’t consider performance issues, using group names does not seem to be a good way.
'KeithFromCanada' Olson 19 Jun, 2021 @ 11:24pm 
I hear you. I suggest, then, that AutoSync be off by default and warn users of the 'gotchas' inherent in using it before making sure that all bots have unique names. Honestly, I think you should use the team/name identification and only sync when requested; I don't see why it needs to be running all of the time. Am I missing something?
windthunder310  [author] 19 Jun, 2021 @ 9:11pm 
@'KeithFromCanada' Olson

I'm sorry, but getting the group name will reduce the performance of this mod, and it is currently known to have performance issues when the number of robots is large.

When I use it myself, I use a naming method like this
In the wheat group
wheat-harvest
wheat-planting
wheat-watering

I will add a reminder that this mod will affect all robots with the same name
'KeithFromCanada' Olson 19 Jun, 2021 @ 8:29pm 
*Fantastic* mod, but it needs to only sync bots with the same name that are on the same team. It wrecked my setup because I use a common name across different teams. For example, I have a few teams that have 'Add Stones' bots to build structures. Suddenly, all of them across all of the teams are syncing, which is NOT how it should work; the 'name' the mod looks for should be {Team Name}{Bot Name}, not just {Bot Name}.
Megümin · Arkäne 28 May, 2021 @ 10:45pm 
I mean, bots with the same name (ofc) but not in the same group, like : "Group 1 / bot_do_stuff & Group 2 / bot_do_stuff". Both bots are synchronized, and i suppose it's not indented ?

But I realized after that my groups have sometimes the same name (deeply nested xD), that's the issue.
*Since we can only get name's groups and not id, the script loops the same group multiple times
If i'm not wrong, a warning in the description could be nice :)
windthunder310  [author] 28 May, 2021 @ 8:47pm 
@Arch-kain Sorry, I don’t understand what you mean. What do you mean by "non-siblings bots"?
Megümin · Arkäne 28 May, 2021 @ 3:03am 
Hi! It seems non-siblings bots are sync too! Can we avoid that ?
Nunu 27 May, 2021 @ 9:56am 
It just sucks when you want to do temporary work quickly and you have to feed every robot with this disc. Really well done, thanks :)
windthunder310  [author] 23 May, 2021 @ 7:52am 
@Predatorian Probably not, there is no related event in the modding file of autonauts.
windthunder310  [author] 23 May, 2021 @ 7:41am 
@Conan I just uploaded a new version, you can turn off the automatic synchronization, use the shortcut key to synchronize, please try.
Predatorian 22 May, 2021 @ 11:05pm 
Isn't possible to sync only when code was edited or when play button is pressed?
Conan 15 May, 2021 @ 11:03am 
Nice I look forward for that change :D Thank you very much
windthunder310  [author] 13 May, 2021 @ 3:36pm 
Sounds great! But because automatic synchronization is still more convenient to use, I want to make it into automatic or shortcut keys for users to choose.
Conan 12 May, 2021 @ 2:50pm 
Maybe you can do a shortcut? For example if you press the "Y" key it will synchronize all bots with the same name? I love this mod and thank you for all your work :)
windthunder310  [author] 11 May, 2021 @ 9:47pm 
I will try, but I’m not sure I can solve it, because every time I try to synchronize, I need to scan all the robots.
The method currently in mind is to reduce the frequency of checking/synchronization, but I am not sure if this method will have other problems
Conan 11 May, 2021 @ 2:24am 
Great mod to make life easier. I noticed that when you have a lots of bots like 500+ the mod is making annoying lag spikes in a constant interval of time. When I remove the mod lag spikes are gone. I suspect that the mod is trying do copy/paste scripts but when the amount of bot is large it has performance issues. Is there something we can do to fix this problem?