Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

685 Good

About Hollower

  • Rank
  1. Hollower

    error while importing module

    This happens when you have an incompatible version of a package. Usually 32-bit vs 64-bit. Google says the same. When you get an error first thing you should do is search it.  
  2. This is a feature of the IDE or text editor you're using, and not a feature of the language. I did a quick search which seems to indicate you are referring to Sublime Text but other than that I don't see anything conclusive.
  3. If you want to stick with Python, Panda3D is a good choice. I'm using it. It doesn't compare well to Unity (no scene editor, packaging woes, small community, almost "dead-looking" website) but it does have everything you need to make a good 3D game using only Python and a 3D modeler (Blender is best supported but there is also support for Maya and 3ds).
  4.   I worded that clumsily. I didn't mean to make it sound like you must choose one or the other. You will have client and server code anyway but there are, basically, two ways you can serve a web based game. Browser connects to a web page and downloads all of the game in the form of html, css, js, etc. and then the player plays the game in his browser but "offline" with no further communication with the server. This is fairly straightforward and the web server can be simple since all it is doing is serving the requested files. The player can also "cheat" if they want since they have all the game logic code.   Browser connects to a web page and downloads a client (also html, css, js, etc.) which just contains code for displaying the game and communicating with the server. As the player interacts with the client-side page it sends commands to and receives updates from the server. This keeps the game logic on the server, makes cheating difficult, and potentially allows multiple players to interact with each other at the same time. The reason I recommend using a more mature framework in this case is so you can focus on the game rather than writing both a game and a web server. It is possible to write client with Pyjs and server with a Python web framework. This page shows examples how to do AJAX communication between the two. Ultimately, theres a bazillion different ways to do it in a multitude of languages. Obviously, standard advice: start small and play around with simplistic samples before diving into writing a bunch of code you don't know how to connect together.
  5. If the game is entirely client-side Pyjs is probably sufficient for your needs. It is a Python-to-Javascript compiler and widget framework. A simple database connection for saving games/stats online shouldn't be too hard, but anything more complex like multiplayer interaction you will certainly want a full server-side framework like Django.    
  6. The Stanley Parable explores the concept of free will, as well as being a clever critique of the lack of meaningful choices available in most video game narratives.
  7. I'm a little unclear on what you want exactly but I think I have the general idea. I get that you want to assign the predicate ahead of time. You can do that if the predicate is an actual function rather than just an expression. You can also pass in the change_state function as a callback. Barring some kind of event/subscriber pattern you still need to call the function to perform the check in your processing loop or wherever that is, but this eliminates the arguments and the if statement. You can also store a collection of these in a list and iterate over them calling check() on each. [source lang="python"] class ConsistencyCheck: def __init__(self, predicate, callback, count=3, total=5): self.count = count = total self.predicate = predicate self.callback = callback self.results = [] def check(self): self.results.append( self.predicate() ) while len(self.results) > self.results.pop(0) if self.results.count(True) > self.count: self.callback() # usage: def is_near(): return distance < near_threshold near_checker = ConsistencyCheck(is_near, change_state) # some time later... near_checker.check() [/source] The predicate must be a function which takes no args and returns a bool. If needed you can use functools.partial to bind arguments. I also cleaned up some overly verbose stuff and changed a few names according to personal preferences (feel free to disregard). I think "results" is more descriptive than "values", and I use "near" instead of "close" due to the latter being a homonym of another common programming task.
  8. Hollower

    Help with Modules ;[

    This is a common confusion about local variables that happens with many languages. There is also some confusion about how assignment works in Python which is different from the way it works in C++. You pass in a bool value which is then bound to a local name 'playing'. Local means that identifier only exists within the body of that function. That name comes solely from the argument in the function definition and not from the variable you pass as an argument when you call that function (<--you may want to read that sentence several times if it doesn't sink in right away). The 'playing' inside the function body is not the 'playing' from outside. It only has the same name because you used the same name, and the same value because that's what you passed in. Next you rebind that reference because that's what assignment does in Python. So basically you discard the value that was passed in without using it and create an entirely new bool. Finally you return the new value, which is True. Back in main where you called the function, you don't use that return value. But I do understand what you expected and why, I'm just trying to explain what really happens. This is going to seem trivial but, long story short, you could accomplish what you wanted like this: [source lang="python"] ... import new_game ... if 260 < mpos[0] > 32 and 402 > mpos[1] < 55: playing = new_game.new_game() # notice how I made use of the return value print ("The game state 'playing' has been set to, ", playing) [/source] [source lang="python"] def new_game(): print ("Imported new game...") return True [/source] Notice the argument for new_game wasn't needed since it didn't have any impact on the return value. There is other stuff you can do like declaring globals or modifying mutable arguments, but I think I've written enough for now.
  9. Hollower


    It's a scam. Read here:
  10. To be clear, I don't see anything in Martut's posts indicating that this is intended to be MMO or even multiplayer.
  11. Hollower

    is this possible...?

    When you say "all these bytes" what bytes are you referring to? Some section of compiled machine code? I agree with others that the better question is what problem are you attempting to solve with this so you can be given a better solution.
  12. Hollower

    New RAGE Trailer!

    Not quite clichè enough... try this:
  13. Hollower

    What Does Everyone Think About The New Site Layout?

    Testing. Testing. Testing. Hmm. I went to my control panel and unchecked the "Rich Text Editor" box. That appears to have fixed my problem.
  14. Hollower

    What Does Everyone Think About The New Site Layout?

    Are any Opera users having this problem: Here is a line. I now press enter this is the following line...pressing enter here we are again...look at all that space between lines? This doesn't happen in IE. It looks like I'm adding an extra line but I'm not. When ctrl-c it and paste into notepad there are extra lines, but not in this form. ----- removing extra space and pasting from notepad --- Here is a line. I now press enter this is the following line...pressing enter here we are again...look at all that space between lines? This doesn't happen in IE. It looks like I'm adding an extra line but I'm not. When ctrl-c it and paste into notepad there are extra lines, but not in this form. ----- Okay I have no idea what is going on. I guess I'll delete this post if it's just something wrong with my config.
  15. Hollower

    [pygame] Local variable referenced by assignment

    [font="Verdana"]Sorry. I don't have much experience with pygame so I assumed the obvious error was the error. Looking closer I see some weird stuff [/font][font="Microsoft Sans Serif"](event) = data data = (event) = (event) (event) = [/font] [font="Verdana"]...etc. None of those lines makes sense to me. [/font][font="Verdana"]They don't do anything, and I can't infer what you are trying to do with them. Get rid of all references to this "data".[/font] [font="Verdana"]The specific line with the error is: [/font] [font="Courier New"]data = ship.checkkey(data)[/font] [font="Verdana"]You're passing data before it has been assigned. But like I said all of that stuff doesn't appear to do anything. [/font] [font="Verdana"](argh, sorry now the forum software is bugging out on me and making my post formatted all weird)[/font]
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!