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

Artificial intelligence for game development #1164

Closed
nmarafo opened this issue Dec 5, 2021 · 14 comments
Closed

Artificial intelligence for game development #1164

nmarafo opened this issue Dec 5, 2021 · 14 comments

Comments

@nmarafo
Copy link
Contributor

nmarafo commented Dec 5, 2021

It would be great if flame engine included an artificial intelligence framework such as gdx-ai.

@spydon
Copy link
Member

spydon commented Dec 5, 2021

This sounds like something we could have as a bridge library, do you know any good Dart packages that could be bundled into this? I only know about the a-star lib.

@nmarafo
Copy link
Contributor Author

nmarafo commented Dec 5, 2021

I've been looking and can't find anything intended to dart. You could do something similar to what was done with flame_forge2d and box2d.

Gdx-ai seems to me to be quite robust.

Therefore, if the conversion from java to dart is considered feasible and guidelines are set, the community could collaborate in that regard.

@spydon
Copy link
Member

spydon commented Dec 5, 2021

I've been looking and can't find anything intended to dart. You could do something similar to what was done with flame_forge2d and box2d.

Gdx-ai seems to me to be quite robust.

Therefore, if the conversion from java to dart is considered feasible and guidelines are set, the community could collaborate in that regard.

It is a looot of work to port big java libs to dart, but it can be done, so if anyone does it, I'd be happy to help with the bridge package.

@nmarafo
Copy link
Contributor Author

nmarafo commented Dec 5, 2021

Well, I think it's wonderful that a line of work could be opened in this regard.
I'm going to study the gdx-ai structure a bit and from my humble knowledge see if a simple assimilation for Flame engine is feasible.

@nmarafo
Copy link
Contributor Author

nmarafo commented Dec 10, 2021

After an arduous research task I have encountered several problems translating the library from java to dart. I don't know what type of Vector to use. I have seen that the flame-forge2d library uses "vector_math" but I have a problem about how to transcribe ```

class <T extends Vector <T>> 

since I cannot find

Vector <T extends Vector <T>> 

I would also like to know from which library to import a Math class for Math.sqrt.
On the other hand, I think there will be no problem with the "Steering Behaviors" adapter, which at first seems to me to be one of the most useful functionalities to get started.

@spydon
Copy link
Member

spydon commented Dec 10, 2021

For Vector, we use the Vector2 class which is from vector_math, I don't think you'd have to use generics on it.
sqrt exists in dart:math, so no need for a dependency there.

@nmarafo
Copy link
Contributor Author

nmarafo commented Dec 12, 2021

I would need help again. Apologies in advance.

If I extend Vector2 (flame / extensions.dart) this class uses a constructor with "factory" so when I transcribe the gdx-ai classes that extend Vector2, it forces me to build with factory.

The problem is that I can't call "super" if I build the new class with factory.

So I would need some way to make Vector2 not build with "factory" or skip that rule somehow when I create a class that extends Vector2.

An example of the problem is observed with the following class: SteerableAdapter or with SteeringBehaviour, which would give the following error if you extend to Vector2: "The unnamed constructor of superclass 'Vector2' (called by the default constructor of 'SteerableAdapter') must be a generative constructor, but factory found."

Any help on this? Thanks in advance.

@st-pasha
Copy link
Contributor

  1. If you already working on implementing this, it might be helpful to open a draft pull request so that we could review the architecture and provide feedback.
  2. Aim at implementing the smallest amount of functionality at first. Even if it's just one class. That way we could figure out how this is going to integrate with the rest of the system.
  3. Frankly, I'm not sure why SteerableAdapter would need to inherit from Vector2. However, if you do need to inherit from Vector2 then create an explicit constructor that will call one of the Vector2 named constructors:
class MyVector extends Vector2 {
  MyVector() : super.zero();
}

@nmarafo
Copy link
Contributor Author

nmarafo commented Dec 13, 2021

I have made this repository public flame-ai, which is rather an experiment because I don't have much experience.

I'm not quite sure how to open a draft pull request, so I apologize, I would need advice on this.

At the moment I am working with the steer folder to try to implement Steering Behavior the way it is done in this Pacman project.

@st-pasha
Copy link
Contributor

I'm not quite sure how to open a draft pull request

This is actually quite simple. Start making a pull request as usual, then after filling out a form -- instead of pressing the green [Create Pull Request] button, click a small arrow on the right side of that button. This will open a drop-down with the option to create a Draft pull request instead.

Also, if you already created a regular PR, it can be converted into a Draft -- just click the "convert to Draft" link in the Reviewers section.

@spydon
Copy link
Member

spydon commented Dec 13, 2021

I don't think we want such an early draft, it will be open for too long. Better discuss it on the other repository first until it is closer to release and then we can go through it and check if it is a package that we can include under the organization (if you'd want it of course).

@nmarafo
Copy link
Contributor Author

nmarafo commented Dec 14, 2021

Actually I think that maybe a person with a greater technique than me when developing should take a first step in an external repository as Lukas thinks, so that the rest of us can make contributions, suggestions...

@st-pasha
Copy link
Contributor

Actually I think that maybe a person with a greater technique than me when developing should take a first step in an external repository as Lukas thinks, so that the rest of us can make contributions, suggestions...

Don't worry Norberto, we'll figure it out. Adding AI capabilities in Flame seem like a very important feature.

@spydon
Copy link
Member

spydon commented Apr 22, 2022

@spydon spydon closed this as completed Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants