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

Newgame #41

Merged
merged 15 commits into from
Jun 24, 2021
Merged

Newgame #41

merged 15 commits into from
Jun 24, 2021

Conversation

etosch
Copy link
Collaborator

@etosch etosch commented Apr 29, 2021

mostly kicking off a pull request to get eyes on this.

looking for feedback on how "complete" we want the autogenerated starter code to be.

@etosch etosch requested review from jjfiv and kclary April 29, 2021 23:30
@kclary
Copy link
Collaborator

kclary commented Apr 30, 2021

lgtm. but not sure what to look out for.

I tested it and looks like nothing is breaking. pushed the result to this branch: bf04905

Looks like it:

  • creates the directory and contents for the base rust game code (game.rs, lib.rs, types.rs)
  • updates the root Cargo.toml and toybox/Cargo.toml
  • updates/adds Games.toml -- this is new to me, is this the replacement for inventory?
  • updates toybox/src/lib.rs

@etosch
Copy link
Collaborator Author

etosch commented Apr 30, 2021

Yup! Games.toml is replacement for inventory. It can be written do if someone wants to add a game manually.

I also updated the getting started with a new game information in docs.

Games.toml Outdated
@@ -0,0 +1 @@
games = [["amidar", "amidar", "Amidar"], ["breakout", "breakout", "Breakout"], ["gridworld", "gridworld", "GridWorld"], ["space_invaders", "space_invaders", "SpaceInvaders"], ["pong", "pong", "PongConfig"]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be a flat array of the capitalized one?

We could call .lowercase() to get the other two?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will do, hoss.

@etosch
Copy link
Collaborator Author

etosch commented May 5, 2021

Updated Games.toml format, code generation, and documentation.

@etosch
Copy link
Collaborator Author

etosch commented May 6, 2021

Just added a --clear command, so if you want to play around with a new game and then undo that, you can nuke it.

@etosch
Copy link
Collaborator Author

etosch commented May 6, 2021

@kclary you might want to check that this doesn't break any changes for you -- I had to update the module name in space invades, and the main game name in Pong (from PongConfig) to make the autogeneration with @jjfiv 's requested change work.

@etosch
Copy link
Collaborator Author

etosch commented May 6, 2021

BTW I was going to try to set this up as a cargo subcommand but it's too much of a hassle to get that working. We'll just stick with the instructions for now. Will be ready to merge once the tests are passing.

Copy link
Contributor

@jjfiv jjfiv left a comment

Choose a reason for hiding this comment

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

I think rolling back the change to 'spaceinvaders' is the only blocker here.

@@ -16,10 +16,10 @@ pub fn get_simulation_by_name(name: &str) -> Result<Box<dyn Simulation>, String>
"breakout" => Ok(Box::new(breakout::Breakout::default())),
#[cfg(feature = "gridworld")]
"gridworld" => Ok(Box::new(gridworld::GridWorld::default())),
#[cfg(feature = "space_invaders")]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be OK if we ditched the cfg-feature per game situation. We'd initially envisioned compiling just the games you need, but the rust compiler has gotten faster and we're distributing on pip now...

@@ -29,7 +29,7 @@ def test_breakout(self):
self._bad_json_is_recoverable(tb)

def test_space_invaders(self):
with Toybox("space_invaders") as tb:
Copy link
Contributor

Choose a reason for hiding this comment

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

I vote to restore the tuples so we don't have to break this compat.

serde_json = "*"
serde_derive = "*"
lazy_static = "*"
rand = { version = "0.6.3", default-features = false, features=["std"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we turn these version numbers into "*" and have it be OK? idk, but it would be nice to be less-specific here...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I copied the other Cargo.tomls here; presumably you chose a specific version for a reason?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I got paranoid with rand because they don't consider the specific random number generator to be part of semver... and we really want to be as reproducible as possible with a given seed.

// Put the rest of the structs for your game here

#[derive(Clone, Serialize, Deserialize, JsonSchema)]
pub struct StateCore {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a huge bikeshed, but definitely for new games, I think this will make more sense to new people as "FrameState" rather than the silly "StateCore" that's my fault. #12.

OK to punt on this since I have #12 open.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should go into another pull request.

@jjfiv jjfiv mentioned this pull request May 15, 2021
Merged
@etosch
Copy link
Collaborator Author

etosch commented Jun 24, 2021

@kclary you might want to check that this doesn't break any changes for you -- I had to update the module name in space invades, and the main game name in Pong (from PongConfig) to make the autogeneration with @jjfiv 's requested change work.

@kclary -- did this break any of your builds?
@jjfiv -- I'm back working on this now; all checks have passed, so do you have any information on where the build breaks?

@kclary
Copy link
Collaborator

kclary commented Jun 24, 2021

@etosch I made the branch/build just to check if the tool worked. Haven't made any changes, and I'd be fine to abandon & rerun the latest version. I no longer remember how to check the build -- is that helpful for debugging or more to make sure there are no lingering issues?

@etosch
Copy link
Collaborator Author

etosch commented Jun 24, 2021

@etosch I made the branch/build just to check if the tool worked. Haven't made any changes, and I'd be fine to abandon & rerun the latest version. I no longer remember how to check the build -- is that helpful for debugging or more to make sure there are no lingering issues?

@jjfiv was concerned that there were breaking changes. I think the issue he pointed out is that every instance of Toybox("space_invaders") in the other repos will break. Personally, I think that since we aren't under the gun for deadlines right now, we should just push this change, push a new version of the executable to PyPI, and I will be sure to update the Toybox repo to comply with the new naming scheme.

@jjfiv
Copy link
Contributor

jjfiv commented Jun 24, 2021

It was actually trying to use 'inventory' that broke the build: #37

I think this is orthogonal.

Copy link
Contributor

@jjfiv jjfiv left a comment

Choose a reason for hiding this comment

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

Ok with spaceinvaders rename since nobody's really using it yet.

@etosch etosch merged commit 6ced4dc into main Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants