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

Headless mode #652

Open
coffenbacher opened this issue Oct 26, 2016 · 5 comments
Open

Headless mode #652

coffenbacher opened this issue Oct 26, 2016 · 5 comments
Labels
just do it You can start working on this, there should be nothing left to discuss lang: c++ Done in C++ code nice new thing ☺ A new feature that was not there before

Comments

@coffenbacher
Copy link
Contributor

I would love to be able to develop and run tests of the engine without spinning up the whole asset loading & graphics pipeline. Combining a simple test framework with the history / log discussed in Chipmunk's pull request this could enable powerful regression testing as well in the future.

For example, in some silly pseudocode, maybe testing wood gathering could look like this:

# test_wood_gatherer_log.txt:
- tick 0: load TestArabia.map
- tick 0: spawn villager at (1,1) with id 0
- tick 1: task unit with id 0 to chop wood at (1,2)
- tick 1000: end

# test.py
import headless_engine
headless_engine.run(open('test_wood_gatherer_log.txt'))
assert headless_engine.get(unit=0)['carrying']['wood'] == 10

Perhaps this is already possible. If so, can someone point me in the right direction for doing so?

(This is a bit of a stupid reason / test compared to the architectural advantages of a headless mode, but I only develop on Linux over SSH (my local machine cannot effectively run it) and I'd love to be able to contribute without having access to Linux with a graphical environment. Except for the rendering pipeline, everything should be workable like that it seems.)

@TheJJ TheJJ added nice new thing ☺ A new feature that was not there before lang: c++ Done in C++ code just do it You can start working on this, there should be nothing left to discuss labels Oct 27, 2016
@TheJJ
Copy link
Member

TheJJ commented Oct 27, 2016

Jup, should be a very good thing especially for automated testing gameplay features.

@VelorumS
Copy link
Contributor

We'll be getting the game logic out of the client (while still using it somehow for the prediction). So the test you've described will be for the server code.

The different kind of test will be needed for the client part that plays the history. Because the history is what has been recorded after the execution of the game logic. For example, path finding is done on the server, so the history contains only a "rasterized" path.

Actually, I was thinking about the fastest way to see the multiplayer in action. While playing the game, make the client dump curves (in whatever form they are available) to stdout, pipe that to the second client that will be reproducing the game. It involves some shims "before" and "after" the game logic calculations, but no explicit headless launch...

@coffenbacher
Copy link
Contributor Author

Can we also just send the curves over loopback IP instead of stdout so it's consistent with needing a network stack?

Also, I got a little lost, where is the server code in your 3rd paragraph?

@VelorumS
Copy link
Contributor

over loopback IP

It's faster to just std::cout than edit cmake to get the boost::asio/or-whatever working. Besides, network junkies haven't decided on the protocol yet, so it's temporary.

Also, I got a little lost, where is the server code in your 3rd paragraph?

We already have the server code on the client - it's the game logic. Now we need to record history and write it out.

@coffenbacher
Copy link
Contributor Author

Cool, got it.

@TheJJ TheJJ added this to the Architecture restructuring milestone May 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
just do it You can start working on this, there should be nothing left to discuss lang: c++ Done in C++ code nice new thing ☺ A new feature that was not there before
Projects
None yet
Development

No branches or pull requests

3 participants