google-research / falken

Falken provides developers with a service that allows them to train AI that can play their games
Apache License 2.0
253 stars 35 forks source link

Access Violation Reading Location Error #20

Closed mattlegro closed 3 years ago

mattlegro commented 3 years ago

Hello, decided to open a new issue here since the stuff in the previous one, I was getting all over the place. Anyway, by manually specifying:

    static const char *project_id = "MilleniumFalken";
    static const char* api_key = "somelettersandnumbersandstuff";

I can connect to the service. Now I am getting an exception:

    Exception thrown at 0x00007FFDA32A91A8 (falken_cpp_sdk.dll) in CPPExampleBot.exe: 0xC0000005:
    Access violation reading location 0x0000000000000008.

and the error:

    [Falken] ERROR: CreateBrain failed with status: failed to connect to all addresses.

Thoughts?

mattlegro commented 3 years ago

In the variable inspector I also notice for Name: brain_spec_base we have Value: Information not available, no symbols loaded for falken_cpp_sdk.dll" and for Name: service it says Value: shared_ptr {service_data_=unique_ptr {...} } [1 strong ref, 2 weak refs] [<Information not available, no symbols loaded for falken_cpp_sdk.dll>] if that is helpful

mattlegro commented 3 years ago

So I guess I'm getting the access violation error when trying to call brain->StartSession( falken::Session::kTypeInteractiveTraining, kMaxSteps); because brain is a null, but the CreateBrain error still stands.

hmoraldo commented 3 years ago

Is the service receiving any calls? Are the project id and api keys the right values?

When you start the service it should tell you which id and key to use. You can start the service using the generate_sdk_config flag to force it to create a new config, as described in https://github.com/google-research/falken/blob/main/service/README.md#launch-the-service and then you just need to copy the config file to the right place as described here https://github.com/google-research/falken/blob/main/environments/cpp/hello_falken/README.md

I recommend starting from one of the tests; if the test passes, you can try modifying it until it is closer to what you intend to do. If when you apply the changes to your own project that doesn't work, then you know whatever is wrong has to be related to whatever is different between your project and the test project. That should make debugging it much easier.

mattlegro commented 3 years ago

I didn't have any problems running the test project following those instructions. I double checked that the API key and project ID is correct for my project and are the same as the file generated with the --generate_sdk_config that is located in falken\service\tools. I ended up having to initialize the api key and project_id as above as a char in the cpp file since it didn't work to have the falken_config.json in the binary directory.

hmoraldo commented 3 years ago

This really sounds like the game is having trouble connecting to the service. With the information given I can't say what is the reason for this failure, but further debugging should clarify it. Since the test itself works well, it would be useful to bisect the differences between the test and the game to find out which of the differences is causing this issue.

hmoraldo commented 3 years ago

Hi,

Thanks for closing this issue. Please let us know what the problem was if you figured it out.

Thanks!

mattlegro commented 3 years ago

No problem.. I ended up doing a couple things, so I'm not really sure what the problem exactly was, but I regenerated the sdk config, then copied it into all my different debug and release and solution containing folders, and that solved the issue with having to manually initialize the API key and project name. I also was having a problem with one of the joystick attributes I was trying to create, because I was using kControlFramePlayer when I was supposed to be using kControlFrameWorld, though how exactly they are different is still kind of confusing, because my interpretation is that steering left in control kControlFrameWorld is turning the player left in the world, or something like that, so the language is a bit confusing but I worked it out, so maybe that was interacting with the problem I was having somehow.

hmoraldo commented 3 years ago

Thanks for the details!