Re: Multiple State Menus?

2020-08-12 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
Re: Multiple State Menus? Hey all,I don't actually have anything useful to say at this point, but I wanted to thank the OP for asking the question, and all the awesome answers, because I'd forgotten about state-driven game development, and that was bad of me.Thanks for makin

Re: Multiple State Menus?

2020-08-12 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Multiple State Menus? To be honest this thread is now well into the territory of overengineering.  Only have one stack of states, make those states know how to call methods on the player or manipulate the game directly, and call it a day.  If you've understood that much, you

Re: Multiple State Menus?

2020-08-12 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: Multiple State Menus? To clarify, you suggest either having a class which observes the player, or allow for the player to have some callbacks to check for the necessary environment events? URL: https://forum.audiogames.net/post/560695/#p560695 -- Audiogames-reflector mailing list

Re: Multiple State Menus?

2020-08-12 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
Re: Multiple State Menus? Yeah, I always have game characters keep a reference to the game world, because I try to have the character class handle as much as possible when it comes to its activities and interactions.I also have the game itself keep a reference to the current map, and any

Re: Multiple State Menus?

2020-08-11 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
Re: Multiple State Menus? Objects are not necessarily entirely isolated, since by their very nature they have to interact with other elements of the program. The player class for example may have to be aware of the environment for collision or interaction purposes, or vice versa, the

Re: Multiple State Menus?

2020-08-11 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
Re: Multiple State Menus? Objects are not necessarily entirely isolated, since by their very nature they have to interact with other elements of the program. The player class for example may have to be aware of the environment for collision or interaction purposes, or vice versa, the

Re: Multiple State Menus?

2020-08-11 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: Multiple State Menus? So, another question. This one is caused by a book, game programming patterns to be specific. The chapter in question can be found here. I am planning to model my test game like this: the main class is a state within itself, having a stack  onto which it is going

Re: Multiple State Menus?

2020-08-11 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: Multiple State Menus? So, another question. This one is caused by a book, game programming patterns to be specific. The chapter in question can be found here. I am planning to model my test game like this: the main class is a state within itself, having a stack  onto which it is going

Re: Multiple State Menus?

2020-08-07 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Multiple State Menus? @21yes, along those lines.  Then you define a class Menu which is the same for all menus and which takes choices and callbacks in the constructor, and just make an instance and push it on whenever you need a menu.  Can pass the game into the instance of the menu

Re: Multiple State Menus?

2020-08-07 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: Multiple State Menus? So I have one more bit of clarification:@camlorn, you mentioned passing in item handlers to the items when it comes to the menu. Am I correct in the assumption that you had something like this in mind?class Game: def __init__(self): self.state_stack

Re: Multiple State Menus?

2020-07-29 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
Re: Multiple State Menus? I agree with camlorn, I did not really get a good grasp on state machines until recently, and it has driven me nuts, and I did not really feel like I could design a game with out that understanding. That is definitely not true, I just enjoy code design, and a

Re: Multiple State Menus?

2020-07-28 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: Multiple State Menus? I think I understand it now, it's just going to be a matter of me carrying this over into code. Thank you. URL: https://forum.audiogames.net/post/556465/#p556465 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com

Re: Multiple State Menus?

2020-07-28 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Multiple State Menus? @17Almost.  I would say it like this: there is a state machine that is currently active, and any state machine can change the currently active state machine to another one.  Every menu is a state machine.If you do "the currently active state machine" as

Re: Multiple State Menus?

2020-07-28 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: Multiple State Menus? So an update with a clarification:Menus hold other menus. States hold other states. Is that literally it?If so... yup I feel dumb. URL: https://forum.audiogames.net/post/556426/#p556426 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin

Re: Multiple State Menus?

2020-07-28 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Multiple State Menus? @15Immutable.js isn't much better.  While that's not O(n) on copying, it's pointer chasing like you wouldn't believe and rather a large increase in ram usage.  That doesn't matter so much here, but it certainly does matter for JS.Immutabl

Re: Multiple State Menus?

2020-07-27 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: Multiple State Menus? @12 I think you are right that for that case you provided a mutable data structure is more convenient than a namedtuple. But the same in case of namedtuple isn't much worse to be considered impractical.About copying most of the world on each state update. I

Re: Multiple State Menus?

2020-07-27 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: Multiple State Menus? Thank you all for the responses. I will post on this again if something seems unclear after I had time to process it URL: https://forum.audiogames.net/post/556184/#p556184 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com

Re: Multiple State Menus?

2020-07-27 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
Re: Multiple State Menus? Hi, this is the implementation I am using for my state machine. I am using this for python, but it does not have to be.I took my implementation of my state machine from here:http://howtomakeanrpg.com/a/state-machines.htmlIt is still a bit of a work in progress as

Re: Multiple State Menus?

2020-07-27 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Multiple State Menus? The only way to make a game work on top of namedtuples is to copy most to all of the world on every update.  This is slow enough that I would hesitate slightly to do it in C++, and very much more in Python.  You're right that _replace exists, but that's

Re: Multiple State Menus?

2020-07-27 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: Multiple State Menus? @10 namedtuples are actually very convenient and ergonomic. If you want to create a new namedtuple that just has a subset of fields different from another namedtuple, you can use the _replace method like this:GameState =namedtuple('GameState', ['hp

Re: Multiple State Menus?

2020-07-27 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Multiple State Menus? @9Convenience and ergonomics matter.  Namedtuples aren't super convenient if you're going to change a bunch of fields all the time.  Also, the performance penalty is probably higher than you're giving it credit for, though I haven't spec

Re: Multiple State Menus?

2020-07-27 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: Multiple State Menus? @6 just a small note. not sure why namedtuples being immutable means they dont apply. for me, namedtuples are really the best go to for defining composite data types, not just for less boiler plate but also specifically for their immutability. Immutable data

Re: Multiple State Menus?

2020-07-27 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
Re: Multiple State Menus? OK, so I copied this menu implementation from my Earwax project, which probably does all the menu stuff you want, assuming you're happy to use Pyglet.I removed all of the imports, since they will probably just confuse the issue.@attrs(auto_attribs=True)

Re: Multiple State Menus?

2020-07-26 Thread AudioGames . net Forum — Developers room : kjsisco via Audiogames-reflector
Re: Multiple State Menus? Okay I understand. URL: https://forum.audiogames.net/post/555879/#p555879 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Multiple State Menus?

2020-07-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Multiple State Menus? @5Kind of.  In the sense of object oriented programming, sometimes, depending what you're doing.  For example RPGs often map well to that model.But you don't have to use classes because you're thinking in object oriented programming.  They're

Re: Multiple State Menus?

2020-07-26 Thread AudioGames . net Forum — Developers room : kjsisco via Audiogames-reflector
Re: Multiple State Menus? I am a bit new to game development but I've been writing software for a while and I can't help but think that the methods put forth are to object-heavy.  Is this common in creating games? URL: https://forum.audiogames.net/post/555779/#p555779 --

Re: Multiple State Menus?

2020-07-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Multiple State Menus? But the key insight that I think Amerikranian is missing is that things are much easier if it's not a finite state machine.  Model your game as a stack of input handlers:class InputHandler: def on_input(event): pass def on_active

Re: Multiple State Menus?

2020-07-26 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
Re: Multiple State Menus? I'm confused. Why not just have a standardized menu class, and make all the menus instances of that class? Generally, menus have two types of items in them: things you activate, and things with adjustable values. There are several ways to handle that, bu

Re: Multiple State Menus?

2020-07-26 Thread AudioGames . net Forum — Developers room : philip_bennefall via Audiogames-reflector
Re: Multiple State Menus? I had to implement something similar a little while ago. I did it in C++ so I'm not sure how it translates to Python, but I had a generic menu class and a factory. The factory would populate the menu with its options, and would use function objects (us

Multiple State Menus?

2020-07-26 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Multiple State Menus? So as I have been working more with states, one question arose. Right now, I have to create individual classes for pretty much everything. Pause menu, main menu, options menu, etc. My question is... can I generalize those states and make them all fall into a category

Multiple State Menus?

2020-07-26 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Multiple State Menus? So as I have been working more with states, one question arose. Right now, I have to create individual classes for pretty much everything. Pause menu, main menu, options menu, etc. My question is... can I generalize those states and make them all fall into a category