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

Otter randomly giving stats not recorded #32

Open
andreped opened this issue Aug 28, 2022 · 11 comments
Open

Otter randomly giving stats not recorded #32

andreped opened this issue Aug 28, 2022 · 11 comments
Labels
bug Something isn't working

Comments

@andreped
Copy link
Owner

During deployment, when buying the otter, it will give +2 attack +1 defence to a random member in the team. This is not recorded in the team.

@andreped andreped added the bug Something isn't working label Aug 28, 2022
@GoldExplosion
Copy link
Contributor

For me, it gives +1 attack +1 defense to a random member in the team

before buying:

CURRENT INFO:
--------------
PACK:  StandardPack
TURN:  1
LIVES: 10
WINS:  0
GOLD:  7

CURRENT TEAM:
--------------
0: < Slot pet-beaver 2-2 none 1-0 >
    1: < Slot EMPTY >
    2: < Slot EMPTY >
    3: < Slot EMPTY >
    4: < Slot EMPTY >

CURRENT SHOP:
--------------
0: < ShopSlot-pet not-frozen 3-gold pet-duck 1-3 none 1-0 >
    1: < ShopSlot-pet not-frozen 3-gold pet-otter 1-2 none 1-0 >
    2: < ShopSlot-food not-frozen 3-gold food-honey 0-0 status-honey-bee >
    >

after buying:

CURRENT INFO:
--------------
PACK:  StandardPack
TURN:  1
LIVES: 10
WINS:  0
GOLD:  4

CURRENT TEAM:
--------------
0: < Slot pet-beaver 3-3 none 1-0 >
    1: < Slot pet-otter 1-2 none 1-0 >
    2: < Slot EMPTY >
    3: < Slot EMPTY >
    4: < Slot EMPTY >

CURRENT SHOP:
--------------
0: < ShopSlot-pet not-frozen 3-gold pet-duck 1-3 none 1-0 >
    1: < ShopSlot-food not-frozen 3-gold food-honey 0-0 status-honey-bee >
    >

This is because sapai hasn't been updated. Is this the issue or is the effect not recorded at all?

@andreped
Copy link
Owner Author

andreped commented Aug 29, 2022

For training this is perfectly fine. The problem has to do with deployment with the actual game. We just have to catch which animal the otter gave the stats point.

The issue was the stats giving, not the amount of attack/health. It is probably +1/+1. I dont recall. But I will update to the latest version of SAP tomorrow. Cant update to the latest sapai until sapai-gym is made compatible with it.

@GoldExplosion
Copy link
Contributor

oh I understand, the random pet the otter gave stats to in the actual game and in sapai is different.
To find out which pet the game gave stats to will require an extension of the computer vision system so that it detects the pets and its stats in the team. (This is especially challenging because Pets may have effects such as honey on them which causes the confidence in detection by single template matching to drop).
One solution is to just detect the stats(health and attack) of the Pet in nth_slot and not the Pet itself(since we know what it is). This way we can know which Pet received the stat buff.

@andreped
Copy link
Owner Author

This is especially challenging

Yes, this is absolutely not trivial. There are also other pets that have similiar complex behaviour.

I think for now, I would not spend a lot of time on that. Now I think is the time to improve the reward system and RL algorithm, as I believe the deployment method is working fine enough.

It would also be great to support freezing of objects, but currently sapai-gym does not support freezing items:
https://github.com/alexdriedger/sapai-gym/blob/master/sapai_gym/SuperAutoPetsEnv.py#L294

We would also need to handle that in the machine vision system somehow. For instance the template matching method might fail if an animal is frozen. More tuning to be made.

One solution is to just detect the stats(health and attack) of the Pet in nth_slot and not the Pet itself(since we know what it is). This way we can know which Pet received the stat buff.

I like that idea. Seems a lot more seemless. If you are interested, you can also contribute to the machine vision system. Up to you what you prefer working on :)

@GoldExplosion
Copy link
Contributor

GoldExplosion commented Aug 30, 2022

Yes, I am interested in contributing to the machine vision system. I will start once I finish what I am working on currently.

@andreped
Copy link
Owner Author

andreped commented Aug 30, 2022

Yes, I am interested in contributing to the machine vision system. I will start once I finish what I am working on currently.

Looking forward to it :)

I will have more time this weekend to contribute. I guess I will start playing around with the reward system, but would be great if we were multiple people testing ideas here, as it really is not trivial.

@GoldExplosion
Copy link
Contributor

There is a recent update to Super Auto Pets that allows you to set how you visualise the Food on a Pets. We can set the visualization of Food on Pets to be static.
image

Now we can get state information about the current team. With this, we can switch between human player and AI player freely (previously this was not possible because there is no way for the AI to know what team was currently in the Team Slot).

We can also check if the action made by the AI has been correctly implemented.

@andreped
Copy link
Owner Author

andreped commented Sep 8, 2022

@GoldExplosion Oh!! That's great!! And as you said, this can easily be added through template matching.

But the machine vision system seems to know quite well which animals are in the item shop. It knowns the initial state and tracks all actions where it updates the team. I believe the team and team order should be available in the engine, at all times, or was there something else you were thinking about?

@GoldExplosion
Copy link
Contributor

But the machine vision system seems to know quite well which animals are in the item shop. It knows the initial state and tracks all actions where it updates the team. I believe the team and team order should be available in the engine, at all times, or was there something else you were thinking about?

you are right @andreped. The team should be available in the engine at all times. But if suppose you have to restart the engine in the middle of the game then you have to restart the game also because the engine doesn't the current team and steps taken to get there. We also cannot make switch between manual and AI. We can overcome this by using computer vision system to detect the team and other state information(wins, rounds, gold and health).

On a different note, another use is that we can now get teams that we play against. With this we make a database of teams the AI has played against, potential leveraging it for future training.

@andreped
Copy link
Owner Author

andreped commented Sep 8, 2022

restart the engine in the middle of the game

Yes, then I agree. For now, I have not taken that scenario into account, but that could easily be done, as you mentioned. However, we would have to update the current team and statuses to the engine. Should be possible.

However, improving the reward system is more urgent. I have no time this week to work on this project, but should have more time next week.

It is nice to build up a database, sure. However, it would be great if we didn't need "real games" to make a good AI ;) Right now, the AI does not seem to be that intelligent - I blame the reward system being too simple.

@GoldExplosion
Copy link
Contributor

However, improving the reward system is more urgent. I have no time this week to work on this project, but should have more time next week.

ok got it. Take your time.

It is nice to build up a database, sure. However, it would be great if we didn't need "real games" to make a good AI ;) Right now, the AI does not seem to be that intelligent - I blame the reward system being too simple.

I see. makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants