2021-05-17 08:19:10

Hi, all.
I know this has probably been asked before, but I'm looking at a complete redesign of my games and I want to try out a Python framework.
There is Lucia, there is Mason's framework, there are probably a few others, hence my question. I would like something that is cross platform and I'm going to use Synthizer as the audio backend.
I've done a lot of Python coding at work lately, so I want to give it a chance for making games. A few years ago I found it very slow, but I'm sure it was due to the fact that the game I tried was very clunky. So I'd like to give it another go and see what happens.
I do need cross platform though, because I work on a Mac most of the time.

If anyone else has found themselves in this situation it would be great to talk and find a solution that works.

Cheers.

ReferenceError: Signature is not defined.

2021-05-17 08:56:03

There's earwax. That's the only other one I can think of.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2021-05-17 10:22:11

as far as i know, synthizer does not work on mack yet, but lucia should work.

best regards
never give up on what ever you are doing.

2021-05-17 12:05:54

I'm kind of torn between Lucia and Mason's framework, myself. From where I'm standing, Mason's audiogame framework does seem to contain a little bit more, though there's also the problem of well, Mason. I guess it would theoretically be possible to just import modules from both as necessary, but...

2021-05-17 17:03:22 (edited by amerikranian 2021-05-17 17:04:59)

@haily_merry, go read through Mason's framework thread. It's just Lucia with a few "enhancements" like a different menu. It suffers from poor encryption practices last time I checked so that is a thing to keep in mind when making your decision.
But honestly, and I'll probably get some backlash for this, don't use any of them. Seriously. Those frameworks are just wrappers for pygame and you'll have to fight with them if you want anything out of the ordinary. Most of them also make it difficult if not downright impossible to follow traditional game patterns (not that most would care for it, but still). The only one I'd even consider recommending is Earwax, though you should find its thread on here and read through posts 165-66 to see what you're in for before making a commitment. It's a lot.
I don't understand why we need a "framework" for game creation when its selling feature is simplifying stuff to key_pressed and key_down. I mean, sure, I've been in the realm of "I need this", but I cannot explain why. If you want to route events to a specific listener, you'll have to change the framework. If you want to preprocess events and filter out keys for your input, you'll have to change the framework. The only advantage I personally see is the sound wrapping bit, and even there Lucia fails because I didn't realize that you needed caching (I was new and honestly probably shouldn't have released the code), Earwax has few documentation on its sound support, and Mason's framework has a BGT-like names with some interesting decisions concerning slots and ids.

2021-05-17 18:27:24

Yeah, honestly just write your own.

2021-05-17 19:47:55

Or you can, you know, just not use a framework at all and just use a game engine that's been proven to work? I mean, there's a huge difference between, say, bevy or UE4, and the frameworks we've created here. UE4/Bevy/Unity/... actually add features that are actually useful in games. These frameworks... Don't really do that

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2021-05-17 22:19:14

well I can't use UE 4 or Unity because neither of them is screen reader friendly, unless this has chagned very recently.
You guys make a good point about not using frameworks, I think it's a better idea to write your own stuff. I haven't really looked at EArwax though it seems to be very popular around here lately.

ReferenceError: Signature is not defined.

2021-05-18 00:17:44

@8, to my knowledge their accessibility hasn't changed. But write your own. At least then it ties in with what your trying to do and you don't have to dig into the frameworks guts just to get anything unusual out of it.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2021-05-18 15:47:36

yeah, as one of the people that helped write Lucia I honestly have to agree with Americranian here.

There are definitely going to be pieces you can pull out and have work, but it's messy and wasn't backed by as much professional experience as good wishes. Our intent was to make it easy for BGT folks to hit the ground running in a new language with semantics that made sense to them, and in that respect we succeeded. However, you're probably going to hit a wall when attempting anything out of the ordinary, and Synthizer didn't exist during the Lucia days.
I'm honestly presuming though. Lucia was good enough for titles like Perilous Marathon, so it may be good for what you want to do, but I'm pretty sure Perilous Marathon was ported from BGT so that's probably why. If you're starting from scratch, best not to bother.

I hadn't taken the opportunity to investigate Mason's framework until now, but I'm not even a minute in and I see a derivative of some insecure code I wrote when I was fourteen. Who would have known that the idea of storing a static initialization vector would have been so popular?

The Rotation class is predictably the same one you'll find in Lucia and everyone's BGT projects.

Here's some more code I wrote in a private project copied verbatim, how flattering. Rest assured that you'll at least be getting a decent textbox out of it though.

We have functions like directory_create, directory_exists, file_exists, find_directories, file_copy and others that appear to wrap os.path. This is superfluous, and a pretty terrible idea for obvious reasons

The speech class is painfully minimal, so expect to have to call out to underlying APIs or AO2 if you want to stop speaking, get/set rate on platforms other than Linux or even check if a screen reader is running in the first place.

There is a lot more I haven't touched on, but I should get going and I think I've made my point. The overarching theme here seems to be that Mason wrote this framework for Mason's games, and as such it lacks the features and customization you would expect out of a typical engine. If you foresee something very small (likely under 1500 LOC) that fits into the existing audiogame landscape, this framework may be for you. Otherwise, do yourself a favor and don't bother.

2021-05-18 15:51:50

Perilous Marathon barely even used Lucia, actually. I think it used it for window creation and keyboard handling, and, that's about where it ended, it even used a custom menu class I believe.

2021-05-18 15:51:57

I would love to make some kind of framework of my own, but... i am stuck on how to handle keyboard input and showing the window.
I could probably make use of pygame, but... lol

best regards
never give up on what ever you are doing.

2021-05-18 15:59:46

Honestly? Pygame + sound_lib + accessible_output2 / tolk and you'll be just fine. You've got Americranian's sound_pool if you're new, even if it does have some issues with caching that Lucia may even have fixed by now, so you could just copy the sound pool out of there if you're really, really, really worried about that.

2021-05-18 16:05:03

I was thinking i would try and write a wrapper of synthizer for my needs.
For screen readers, i thought i would use tolk.
So with sound and speech out of the way, i want a way to check if a key is pressed from pygame, the same way lucia does it...
so that you can just do if key_pressed (key), how ever i know of pygame.event and how to do that.
I am not sure if i am allowed to copy the key_pressed function from lucia and use it...

best regards
never give up on what ever you are doing.

2021-05-18 16:24:38

checking for key down events.
keys=pygame.key.get_pressed()
if keys[K_SPACE:
do something.
checking for key presses.
for event in pygame.event.get():
if event.type==KEYDOWN:
  if event.key==K_SPACE:
   do something.
You'll have to remember that keydown is key pressed, and get_pressed() is actually checking for keys that are currently being held every iteration of your loop. It's weird and confused the fuck out of me at first, but there you go. Been awhile since I've touched pygame, so this may be far from perfect, but hopefully it works.

2021-05-18 17:35:32

thanx, i'll try it out.

best regards
never give up on what ever you are doing.

2021-05-18 17:54:51 (edited by bhanuponguru 2021-05-18 17:55:39)

you can even follow americranian's python guid on keyboard handling tutorial on articles room. there the article explains about how to do key presses and key downs using pygame it self. you can write a wrapper based on those info given in americranian's article

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2021-05-18 18:26:40

Or, how about we stop writing BGT wrappers for every language and use the methods they provide for us?

2021-05-18 19:37:41

The problem with writing wrappers is that they have a serious potential to limit the way your code works. For example, writing key_pressed only offers *one* key without any KMOD stuff (Shift, Control, etc). You could include those, but what if you need to get input from the user now? You have to hook into the pygame events themselves, sort of defeating the purpose of your key_pressed. What if you want to route events to a specific listener? Wellp, you kind of can't now without writing a wrapper over a wrapper, which sort of defeats the point.
If you are confused as to why you'd even want to route events, I encourage you to look up stuff like the state pattern. That, or just browse through my post history, I provide a lot of examples of what not to do when working with states.
If you want to see state in action, I recommend looking up PyAge, written by Highjacker. I believe that he even posted a thread on here. A pity it doesn't get a lot of recognition, though that's because it doesn't offer so many bells and whistles, choosing to instead focus on flexibility rather than coding features for a specific subset of games.

2021-05-18 20:46:38

Agree with 18, why do we need to make BGT-isms for every language? Seriously guys, get off of BGT-isms and just use what the libraries provide. Your life will be much eaiser and you can truly express your game ideas without hitting brick walls every time you want to do something unconventional. Get out of your comfort zones for once.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2021-05-18 21:49:14

here's the thing. Yes you *can* make one of these.  Unity is proof of that.  But it will itself be 20 or 30 times more complicated than any game anyone ever writes with it and it takes a full-time dev at least to keep it going.  It's technically possible but practically impossible.  I have written the first few hundred lines of my MMO thing and it's already specialized to my MMO thing even though it's just a generic compressed array thing for tilemaps (you'll hear moree about it after Synthizer 0.9 and when it gets a bit further along I plan a devblog of some sort but we'll see).  You have to write small libraries that handle one problem, be opinionated and write specifically for a specific sort of game, or have the kind of resources someone like unity has.  Every other attempt I've seen at this in audiogames land has failed, including mine.  You run into the complexity problem and then it snowballs and either you push through and end up with a giant mess or you realize that actually you can't do this so easily as it seems and stop.

Also w.r.t. Lucia, unless something changed, Amerikranian has said that the sound stuff is broken in the "every time you play the sounnd it re-reads it from disk" sense.  Which turned into literally blaming Python for being slow in at least one thread that I don't have the link to anymore.  I haven't code reviewed it.  I don't know how good or bad it is for sure.

Earwax got used in at least one game by Chris but Chris has moved onto Dart for a variety of reasons including that Dart makes accessible cross-platform mobile apps, and frankly if they get their desktop accessibility together (which they appear to be doing) I'll probably also head in that direction for the UI parts of the MMO thing (don't do as I do here: unless you're experienced multi-language projects are a nightmare).

My Blog
Twitter: @ajhicks1992

2021-05-19 15:40:21

That's true, i was just wondering.
But thanx.
Yeah, i'll admit BGT has made me lazy and i should just get out of it lol.

best regards
never give up on what ever you are doing.

2021-05-20 19:52:38

@21
Yes, sadly, Earwax was a great idea, and I still like some if the ideas therein. Glad I got the whole decorator thing out of my system, but actually it turns out that you and others were right: Enforcing object inheritance is the right way to go for anything larger than Lucky 13.

Currently wrapping SDL in Dart. I know Rust has a wrapper already, but I'm not learning yet another language because my head's in danger of exploding, and they have a weird thing where you need .unwrap() after every call.

Anyways. I'm not sure how Dart + SDL | Flutter + Synthizer + Tolk will work out, but I have tentatively high hopes.

-----
I have code on GitHub

2021-05-20 19:58:28

@23
Rust doesn't need unwrap after every call.  If you're putting unwrap after every call you're using it wrong, because unwrap crashes your program on failure.  I honestly don't think Rust is for you for a variety of reasons, but you probably didn't get as far as the ? operator.  You're supposed to use something like error-chain or failure and then use ? everywhere, and then it's just basically "replacing" exceptions.

Work's codebases have an implicit no unwrap policy as part of a wider no panic policy and it's not a problem; you're supposed to only really use it in tests or when you're really really extra super sure that it can't go wrong.

My Blog
Twitter: @ajhicks1992

2021-05-20 23:11:04 (edited by Ethin 2021-05-20 23:13:15)

To add to 24: the reason the SDL2 bindings in Rust return Result<T, E> is because the SDL2 library returns an error code in every function minus a couple that have void as their return type, or return void pointers, which also needs error checking to ensure that the pointer isn't NULL. So that's why there's so much .unwrap()/?/if let Ok(...) = ... in the library. You'd have that in a lot of other libraries too. Result<> is not an uncommon pattern in Rust. If your making a Dart API for SDL you will want to use Dart's appropriate error handling functions -- do not handle errors in your bindings. If Dart has an equivalent to Result<T, E>, use it.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github