Using Learning Agents to create a simple cube bot

Lurkboii
Tue, 03 Feb 2026 15:55:50 +0000
AI

Greetings, fellow devs. I am doing some research into the capabilities of learning agents in various engines, currently dealing with UE5. I wanted to create a simple scenario: the agent is a cube, tasked with reaching a randomly positioned goal. Worked just fine in other engines (Unity, Godot), but in UE5 it’s struggling and I don’t know why. Maybe y’all could help and steer me into the right direction.

As you can see, I am using the Learning Agents 5.5 plugin for this project. The only tutorial on it was about cars though, so I had to improvise and figure things out on my own. The cube can move in four directions, and it can observe its own location and the location of the target. It gains a reward for reaching the goal, and a penalty for hitting the wall. There’s also a location difference calculator, though it seems to give slightly better results if it gives a reward for approaching the target rather than a penalty for not being close enough. Finally, positions reset after time-out. The goal (green ball) changes location on the board randomly.

This set-up worked well enough in other engines, but no matter how long I let the program train, its performance gets worse. At some point, it picks a wall or a corner and starts racing towards it, episode after episode, completely ignoring the goal. I’ve attempted to place in multiple agents to speed up the learning process, but the results are the same. It’s as if the Agent wasn’t even receiving the location or reward data. Using the visual logger, all the observations are clearly working, and the output log gives me no errors either.

Trying to get this to work correctly is like herding cats, and the lack of tutorials on the topic doesn’t help. It’s the most basic example of an ML-Agent, surely someone else has attempted this in the past? If anyone has any insight at all, I would greatly appreciate it.

Don’t hesitate to ask me for additional info.

12 posts - 4 participants