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

Build GDNative client library #3205

Closed
wants to merge 16 commits into from
Closed

Conversation

o01eg
Copy link
Contributor

@o01eg o01eg commented Oct 25, 2020

Additional option to build GDNative library to use in Godot.

Adds option BUILD_CLIENT_GODOT (default OFF) and GODOT_CPP_ROOT to point at godot-cpp repository.

Exposes property optionsDB with methods to access FreeOrion's OptionsDB.

Exposes property networking with methods to connect to the server. Incoming messages are emits ping signal.

Exposes some incoming network messages as signals on main node include game_start message.

To test add

p
GodotPlayer:p:1
otherPlayer2:p:1

into auth.txt config file and start the server with ./freeoriond --hostless -q --log-file /proc/self/fd/1 --setup.ai.player.count 0 --network.server.conn-human-empire-players.min 0 --network.server.unconn-human-empire-players.max 0. This will start the game on the server and the only thing client need to do is to connect to the server.

To test single player game place client binary into the same folder as freeoriond binary.

C++ sources of it got from https://github.com/Vezzra/fo-godot-prototype

Forum thread: https://freeorion.org/forum/viewtopic.php?f=9&t=11744

@o01eg o01eg added category:feature The Issue/PR describes or implements a new game feature. component:build system The Issue/PR deals with CMake, Visual Studio or the general build process. labels Oct 25, 2020
@o01eg o01eg self-assigned this Oct 25, 2020
@geoffthemedio geoffthemedio marked this pull request as draft October 25, 2020 17:15
@o01eg
Copy link
Contributor Author

o01eg commented Oct 25, 2020

@geoffthemedio Is something should be done here?

@geoffthemedio
Copy link
Member

@o01eg I don't know... What's the point of this pull request? The GDNative library isn't used for anything as far as I know?

@Vezzra
Copy link
Member

Vezzra commented Nov 6, 2020

@o01eg, I'm on vacation now, so I have some time to look into this. Currently doing so, but it will take me some time to wrap my head around the code.

Did you run into any issues so far?

@o01eg
Copy link
Contributor Author

o01eg commented Nov 6, 2020

@Vezzra I don't have a big issues, but it would be nice to have a PasswordEnterWnd and ServerConnectWnd.

Maybe also some API guidance which functions, properties or signals to implement.

@geoffthemedio
Copy link
Member

Maybe also some API guidance which functions, properties or signals to implement.

Could you elaborate on what you mean by that? What API? What sort of "functions"? For what purpose would they be implemented or prioritized for implementing?

@o01eg
Copy link
Contributor Author

o01eg commented Nov 6, 2020

Yes, which FreeOrion internal should be exposed via Godot API. Function are something to allow Godot code call some FreeOrion code. Currently OptionsDB exposed with functions.

@geoffthemedio
Copy link
Member

The UI needs to query and populate itself based on the gamestate, so it needs ways to look up UniverseObjects, Empires, Techs, BuildingTypes, Species, etc. It also needs to be able to issue orders, end the turn, send chat messages, request combat logs, and send various other network messages.

Vezzra
Vezzra previously requested changes Nov 13, 2020
Copy link
Member

@Vezzra Vezzra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally got the time to try to use your GDNative client library with my FO Godot prototype.

It took me some time and fiddling to get it working, but I got there. I only did a first very basic test by adding a GDFreeOrion node. This successfully initializes the basic app objects, reads and parses the content files, giving me an actually correctly initialized FO Godot client. 👍

There was only one issue with the GodotClientApp object being initialized too late, see my comment on that line.

So, looks good so far, further tests should build on that. What we need next is exposing the ObjectMap and the universe objects so we can test if we can create, insert and retrieve universe objects into the FO object map from Godot.

godot/gdfreeorion.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Vezzra Vezzra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, works so far. Logging system is now initialized in time.

BTW, being experimental/used for testing purposes this PR should be set to draft, as it isn't meant to be actually merged.

@Vezzra
Copy link
Member

Vezzra commented Nov 15, 2020

@o01eg,

it would be nice to have a PasswordEnterWnd and ServerConnectWnd

I'm not entirely sure what you mean - do you mean you want these windows/dialogs in the prototype FO Godot client app? Are you asking me to provide them? What exactly do you need them to provide/do?

@geoffthemedio geoffthemedio marked this pull request as draft November 15, 2020 17:12
@o01eg
Copy link
Contributor Author

o01eg commented Nov 15, 2020

@Vezzra

I'm not entirely sure what you mean - do you mean you want these windows/dialogs in the prototype FO Godot client app? Are you asking me to provide them? What exactly do you need them to provide/do?

I want to try Godot Android support so I need some UI to enter server address because I cannot start server on the "localhost" of Android phone.

It's not crucial to move forward because I just can launch server with the game in "slow" mode and work with GAME_START message.

BTW, being experimental/used for testing purposes this PR should be set to draft, as it isn't meant to be actually merged.

Do we have some minimal criteria?

@o01eg
Copy link
Contributor Author

o01eg commented Nov 16, 2020

Added GAME_START message processing.

@o01eg
Copy link
Contributor Author

o01eg commented Nov 16, 2020

Implemented launch single-player game.

@Vezzra
Copy link
Member

Vezzra commented Nov 17, 2020

@o01eg,

BTW, being experimental/used for testing purposes this PR should be set to draft, as it isn't meant to be actually merged.

Do we have some minimal criteria?

What do you mean? Minimal criteria for what?

@o01eg
Copy link
Contributor Author

o01eg commented Nov 17, 2020

@Vezzra For merging it.

Also I implemented access to systems but not sure how to draw them correctly. I suppose I should place camera somewhere.

@Vezzra
Copy link
Member

Vezzra commented Nov 17, 2020

@o01eg,

I want to suggest to move this branch to the main/upstream repository (freeorion/freeorion), for better collaboration. Rebasing should only happen rarely then, and only after giving a proper anouncement and enough time for collaborators to prepare (always working on top of the most recent master isn't necessary anyway for this prototype).

I want to incorporate the Godot prototype app into the source tree and adjust the build scripts so work on this can proceed more smoothly.

The PR will need to be adjusted of course, by switching the base branch. If that isn't possible, it will have to be closed and a new one opened.

Would that be ok with you?

@Vezzra
Copy link
Member

Vezzra commented Nov 17, 2020

@o01eg,

For merging it.

Um, this is just work on an experimental prototype. We haven't even decided if we really want to switch to Godot, this prototype project is supposed to check if that is even possible/feasible.

Also I implemented access to systems but not sure how to draw them correctly. I suppose I should place camera somewhere.

Are you already working on your own Godot app? If you do, and reused mine as base, you shouldn't have to place a camera, my app already has that (of course, otherwise you wouldn't see anything). If you implemented your own scene for the galaxy map, then yes, you need to place a camera.

And if you already made your own Godot app, shall we integrate yours into the source tree, or use mine?

@o01eg
Copy link
Contributor Author

o01eg commented Nov 17, 2020

Are you already working on your own Godot app?

No, I opened PR in yours Vezzra/fo-godot-prototype#1

If you do, and reused mine as base, you shouldn't have to place a camera, my app already has that (of course, otherwise you wouldn't see anything).

Yes, I moved camera back a lot until I see systems.

@o01eg
Copy link
Contributor Author

o01eg commented Nov 17, 2020

Would that be ok with you?

Yes.

@Vezzra
Copy link
Member

Vezzra commented Nov 17, 2020

No, I opened PR in yours Vezzra/fo-godot-prototype#1

Oh, oops, I completely missed that! Well, good, I guess I'll incorporate that version into the source tree, as it already integrates and uses your GDNative library.

Yes, I moved camera back a lot until I see systems.

Well, the scale of maps created by FO is very different to the scale I used in my prototype. Which means the values used for the camera need to be adjusted.

Ok, if you're fine with moving the branch to the main repo, can you do that and adjust/reset the PR (or make a new one if necessary)? Also, push the most recent version of the Godot prototype you extended to your PR branch. I will then try to incorporate that into the branch you moved to the main repo.

@Vezzra
Copy link
Member

Vezzra commented Nov 17, 2020

@o01eg, give me a short notification here when you're done.

@o01eg
Copy link
Contributor Author

o01eg commented Nov 17, 2020

Yes, I cannot change source branch so I'll recreate PR.

@o01eg o01eg closed this Nov 17, 2020
@o01eg o01eg added the status:superseded The PR implementation is insufficient and a follow up implementation PR exists. label Nov 17, 2020
@o01eg o01eg deleted the build-godot branch November 17, 2020 14:29
@Vezzra
Copy link
Member

Vezzra commented Nov 17, 2020

Superseded by #3235

@Vezzra Vezzra added this to the Gateway to the Void milestone Nov 17, 2020
@Vezzra Vezzra added the component:godot-client The Issue/PR deals with the Godot client label Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:feature The Issue/PR describes or implements a new game feature. component:build system The Issue/PR deals with CMake, Visual Studio or the general build process. component:godot-client The Issue/PR deals with the Godot client status:superseded The PR implementation is insufficient and a follow up implementation PR exists.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants