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

User-settable parameters proposals #52

Closed
BertrandBordage opened this issue Apr 11, 2013 · 18 comments
Closed

User-settable parameters proposals #52

BertrandBordage opened this issue Apr 11, 2013 · 18 comments

Comments

@BertrandBordage
Copy link
Collaborator

The goal of this proposal is to have more consistent settings. Settings that we change once and for all should be in game.cfg. Settings more likely to be changed should be changed in the menu, and for the moment using command-line parameters.

Proposals for game.cfg:

  • Use key names instead of key codes for keyboard bindings.
  • Use explicit booleans true|false instead of 1|0 (for flat & max_fog).
  • Remove type, hill_height, flat, & max_trees.
  • Add a system to automatically migrate this file.

Proposals for the command-line parameters:

  • Replace every -something with --something.
  • gamemode should be choices instead of integer.
  • gamemode -> game-mode, like save-mode.
  • Remove hide-fog, hillheight, worldsize, & maxtrees.
  • Move width, height, show-gui, draw-distance, fullscreen, save-mode & motion-blur to game.cfg.
@ghost ghost assigned BertrandBordage Apr 11, 2013
@boskee
Copy link
Owner

boskee commented Apr 11, 2013

Key bindings can (will) be adjusted in the menu. Sounds good otherwise.

@BertrandBordage
Copy link
Collaborator Author

Great :)
I start working on it right now!
I will however implement key bindings with names, since it's fairly easy. Something like:

default_key_bindings = {
    'move_forward': key.W,
    'move_backward': key.S,
    […]
}
for control, default in default_key_bindings.items():
    key_name = config.get('Controls', control)
    key_code = getattr(key, key_name, None)
    if key_code is None:
        # Handles cases like pyglet.window.key._1
        key_code = getattr(key, '_' + key_name, default)

OK?

@boskee
Copy link
Owner

boskee commented Apr 11, 2013

Do it!

@BertrandBordage
Copy link
Collaborator Author

Two first steps achieved with 961a1ed and cc1de58.

I also found out why some parameters were ignored (like "disable-save" or "game-mode") since a few days. Overriding global variables was messy. I fixed it. The lesson I learned is to never use the "global" keyword or "from globals import *" again.

@boskee
Copy link
Owner

boskee commented Apr 11, 2013

global keyword is bad in pretty much every language (that I used), hence why I tried to move as much as I could into config object. Not sure about "from globals import *" tho?

@tfaris
Copy link
Collaborator

tfaris commented Apr 11, 2013

Only reason I can think of is if you import * you can't then set the imported variables, because they'll only be set in the local scope instead of at the globals.py module level.

@boskee
Copy link
Owner

boskee commented Apr 11, 2013

Yeah, just figured it out. You basically import everything from global into the local scope, so what was globals.SOME_VARIABLE is now local_scope.SOME_VARIABLE. Makes sense.

@BertrandBordage
Copy link
Collaborator Author

@tfaris is right. That's why we lost all the settings that were using global. And if we consider that we can use from globals import * to read variables and import globals to set them, this makes 2 ways to use these variables, which will mislead everyone (as it was the case).

@BertrandBordage
Copy link
Collaborator Author

One more step achieved with 98d7747 and dd1e3e7.

@ronmurphy
Copy link
Collaborator

Damn. ok, so should i start editing like crazy on my end, or ... yeah, i want to keep the blocks that i did today, and toolset, but how can i update to what you have here?

Or should i just wait a it more?

@BertrandBordage
Copy link
Collaborator Author

I'm still working on this whole issue. Have you committed your changes? If not, do it.
Then you can fetch my changes to your repository using git pull. If there is a conflict, you will have to fix the changes to merge our changes. Then, test the game. If it doesn't work, try to fix it. If you don't know how to fix it or even if it works, do a pull request, so we can see what to do.
You know, maybe you should ask for a PyCharm license (or at least try it for 30 days). PyCharm tells you when you make obvious mistakes and eases git a lot. This could really help you.

@BertrandBordage
Copy link
Collaborator Author

(Oh god, the last part of my previous message looked like I was trying to convince you to go to a retirement home ^^")

@ronmurphy
Copy link
Collaborator

LOL! No, it is ok! I have PyCharm installed now, going to use it for a week to see hwow i like it :D

@boskee
Copy link
Owner

boskee commented Apr 11, 2013

Sorry, I can't help you as I only use command line. I find it easier than any 3rd party client. You just do:

git pull (to fetch the latest revision)
git commit -a -m "Commit message" (to commit your changes)
git push origin master (to push changes to github)

@BertrandBordage
Copy link
Collaborator Author

Two more steps: cf0ccd6 & a5e6a98

@BertrandBordage
Copy link
Collaborator Author

One major step: 3b66650.

Only one thing left: move command-line parameters width, height, show-gui, draw-distance, fullscreen, save-mode & motion-blur to game.cfg.

@BertrandBordage
Copy link
Collaborator Author

More steps: 1c56c4b, 7d49348, 579dfd6, 8699a6e, 6adee76, 103781b & 8a60d99.

@BertrandBordage
Copy link
Collaborator Author

Final steps: 688c50e & d2f95f6.

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

4 participants