Pytorch AI Game Adding Level Scene and Stats
Автор: Stephen Blum
Загружено: 2026-02-26
Просмотров: 43
Описание:
We added some text output for the AI training. That was the part we added earlier today, and it looks really good. Now I want to add more stuff to it.
At the top, you can see the AI cost, which shows how much it is going down over time as the AI learns. You want to see it drop below 0.12, which means the AI is getting smarter. Some people might find the display hard to see, so I will make the font bigger, let's set it to 36.
I also want to show the inputs and outputs, since there are just six values in total. I will call this new output text "AI status." That fits better, and now we can display more things, like the input features and output labels. There are four input features, which is the input data, and then we just increment through them and show all four.
The labels are the output data, so I need to relabel those for clarity. We have to watch out for the minus symbol, since it can mess up the screen layout. Next, I want to add a level screen, so I'm setting up a new scene for that.
The idea is to have a wait function that lets us pause for a set number of frames and then move to the next level. For the level display, I need to turn the number into a string, so it shows up right. I want the font size to be really big, like 200 or even 300, so it stands out.
The display should not last as long either, so I'll cut the frame count in half so we can see it move faster between levels. I also want to move the level display up to the top of the screen and make sure the player character shows up in front of everything else. The AI cost, features, and labels are all at the top now.
The cost is the average loss over the last 500 training samples, which basically tells you how wrong the AI is as it tries to follow the player. The closer it gets to zero, the better, and once it gets to zero, the AI is perfect, meaning you cannot beat it. As we go, I want to update the labels to say "input data" for features and "output data" for labels, and for the cost, I will call it "accuracy," since that makes more sense for how close the AI is to being right.
Now when you play, you can see all the stats at the top, watch the levels go up, and see how the AI learns as you go. One last thing I am wondering about is whether the AI should forget what it learned after game over or keep improving.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: