Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

About bot logic in SFD

Share questions, scripts and tutorials related to the ScriptAPI in SFD.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

About bot logic in SFD

Post by Gurt » Sun Sep 02, 2018 2:39 pm

With a carefully crafted path grid where you promise the bots where they can navigate and how they should navigate you can make the bots operational in your map.

In a series of topics I will try to explain some of the systems in SFD you need to be aware of in order to create your own path grid and how the bots operate and what tools you have to help debug your path grid.


Bots in SFD all share the same resources (CPU) so a few design principles are in use to reduce the overall CPU usage from frame to frame:
  • Only use ray tracing (in box2D) when required.
  • A path grid is used to tell bots how they can navigate the world.
  • A shared round-robin system is used for heavy calculations.
  • Assumptions are used in certain situations to avoid using ray tracing.

Everything shares the same round-robin system to update heavy calculations. As of now bots use it for various actions and the path grid uses it for dynamic nodes.
Bots use this to figuring out their destination and goal and calculate a path through the path grid. Some calculations are cached for some time before being updated again if possible.

Because of the shared round-robin system and cache times the bots might not do anything at times when there's a lot going on. This can be made clear if spawning a lot of bots that all should navigate to a specific target, they start moving one after another.

Each player instance do have an update routine each frame to comply with all the basic rules of the game. It's also in this update the bot will navigate along any calculated path they have been given or other instructions.

Bots perform actions in the game by pressing virtual keys on a virtual keyboard in their logic. You are also pressing virtual keys on a virtual keyboard, they are just mapped to a physical medium - like a real keyboard or gamepad. Player commands also result in virtual keys being pressed. We have designed it like this to prevent bots from being able to do things you can't, and vice versa. Whatever the bots can do, so can you!

That's a quick overview.
10 x
Gurt

NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Post by NearHuscarl » Wed Mar 25, 2020 10:10 am

Where can I read the rest of the series?
0 x
Image

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Sat Apr 25, 2020 11:26 am

NearHuscarl wrote:
Wed Mar 25, 2020 10:10 am
Where can I read the rest of the series?
I never got around to it due to lack of time and there wasn't enough interest in the topic itself. So I kinda let it be and let users inspect our custom maps instead how we designed the path grid there. If you have anything specific you want to know more about I could try to explain that in a bit more detail instead.
1 x
Gurt

Post Reply