6 ms·
I'm very interested in this project, because I have a student researching what good options there are for Python Game Dev at the CS1 level. We used Arcade[1] th
by acbart 7y ago
I'm very interested in this project, because I have a student researching what good options there are for Python Game Dev at the CS1 level. We used Arcade[1] this past Fall, and things didn't go very well (I'm not sold on Pyglet, and there was a lot of small "What??" issues with Arcade's design itself). Pygame Zero is a very appealing choice, but suffers from its design around global state - which is something I spend most of the semester railing against. The authors gave me a good explanation for why[2], but it still is a deal-breaker for an introductory-level university course for CS majors.
At this point, we're leaning towards making our own library to satisfy our purposes. We're still looking at other options though - hey, if you have one, feel free to suggest it :)
[1] http://arcade.academy/ http://arcade.academy/
[2] https://github.com/lordmauve/pgzero/issues/174 https://github.com/lordmauve/pgzero/issues/174
- WoodenChair 7y agoCan you elaborate on what you don’t like about working with Arcade?
- nnq 7y agoThere was/is Kevy for Python game dev, focused a lot on touch and mobile, dunno if it is well maintained but it seemed to have a nicer architecture/API, maybe it's what you need.
- stuaxo 7y agoKivy ?
- nnq 7y agoYes. Sorry: https://kivy.org/#home https://kivy.org/#home , https://kivy.org/doc/stable/ https://kivy.org/doc/stable/ (docs) & https://github.com/kivy/kivy https://github.com/kivy/kivy . It's not branded as an actual game framework, but it's based on OpenGL ES and that's pretty much what it is - I mean, even their first tutorial is a mini game https://kivy.org/doc/stable/tutorials/pong.html https://kivy.org/doc/stable/tutorials/pong.html .
- nneonneo 7y agoOK, so I'm genuinely confused about what your objection to global state is. You mention issues with assignment, and so on - those are issues with Python `globals` and variables in the global namespace, not issues with global state per se. A lot of Python programs use global variables in the form of imports, so I don't see anything wrong here. (Pygame Zero's implicit imports could be a point of objection - but it'd be very easy to hack a small wrapper to force students to import the names they need instead). In terms of global state, I don't see much of a distinction between Pygame Zero's globals and a god-singleton like `World`. Both feature large amounts of implicit state, just off by one layer of indirection. For the vast majority of games, it wouldn't make sense to have more than one `World`. You might want more than one game scene/level/etc. but that's distinct from the overall windowing system, graphics state, etc. which would be stored in `World`.
- chronial 7y ago> However, a major concern I have for this architecture from a pedagogical perspective is it's reliance on the global namespace. Their concerns are not specific to pygame. They are trying to teach their students to not have global state and are afraid that using pygame in its current form would undermine those teachings.
- bvrmn 7y agoThere is no difference between OS level global state and framework level global state. Students and teacher are free to create clean abstractions on top of any global state. Why are we tolerable to OS boundary and not tolerable to in-process API boundary?
- aoloe 7y agoyou might want to have a look at python play: https://github.com/replit/play https://github.com/replit/play the same goal as pygame zero but with a very different approach. and no WIDTH and HEIGHT variables...
- kragen 7y agoHave you tried teaching with it? I'm interested to hear what your experience is like.
- aoloe 7y agono, i've only tried it out for myself: https://github.com/CoderDojoZH/resources/blob/master/cards-python/play/basketball/main.py https://github.com/CoderDojoZH/resources/blob/master/cards-p... i really liked it, but i don't consider it a mature product i would use "in production". because of our approach, we can't really adopt it until it's natively supported by a "package" like mu-editor or thonny my conclusion was: as a "senior" programmer, who grew up with procedural programming, i'm still "scared" about relying on annotations and async programming. but, for kids coming from scratch and without much other experiences, i'm not sure that it will be a big stumbling stone. they will simply "learn" it in a different way: at the beginning, programming is (mostly) black magic anyway : - ) it might be even easier for them to use play, than relying on the magic update() and draw() functions... (and, no, i don't think it makes a big difference to call those function from a main loop like in pygame or having them implicit like in pygame zero) probably, the biggest issue would be that the founding blocks of play do not match what the kids will learn in most python tutorials and books (they probably won't find any reference to async or annotations in most programming books for kids or even for beginners!) all in all: i like play and i think it could be a good match if the focus is more on computer science topics... in our case, the focus is on the kids having a good time on sunday afternoons and getting them to learn to be an (active) actor in front of their computer, not just a (passive) consumer. we are not too picky about the concepts : - )
- acbart 7y agoThanks! I wasn't aware of this library, so this is exactly what I was hoping to hear as an answer. I'll add it to our list to analyze.
- bvrmn 7y ago> but suffers from its design around global state - which is something I spend most of the semester railing against. You can introduce subject as another execution environment like OS and keep globals-free "clean" code. Actually it's a great lesson. Also you can give mind-bending article[1] as alternative study material. [1] https://blog.cleancoder.com/uncle-bob/2015/07/01/TheLittleSingleton.html https://blog.cleancoder.com/uncle-bob/2015/07/01/TheLittleSi...
- echelon 7y agoCS1 isn't the place to rail against global state. The insane stuff we teach in CS1 is why so many students choose other majors. Sell your students on the magic of computers. Don't teach them arcane rules and formalisms. They'll learn that later, once they've been hooked.
- HelloNurse 7y agoAfter the students fight with global state in their first significant programming projects, they'll welcome exit strategies (even radical ones, like immutable data structures) in the following courses instead of ignoring premature preaching in introductory courses.
- echelon 7y agoBingo. Teaching ahead of the curve is a great way to confuse and bore the hell out of your students. This is why I hate intro CS education so much.
- acbart 7y agoHi, thanks for your response and your passion for CS Ed! I like talking about it too, and I want to preface any conversation we have with my appreciation that we both care about this important subject. Text doesn't always do a good job of conveying sentiment on its own :) It sounds like you are hypothesizing that my students have a motivation problem and proposing that I use an intervention of "Selling students on the magic of computers". Based on survey data collected during my past few semesters, I do not believe that my students are disinterested in the subject. This is true at the beginning and end of my course - I cannot claim that my assignments and course design (some of which is particularly oriented towards making the students interested in CS) has a big impact here, but I do not think they are being hurt by that aspect of the course design. There are potentially motivational issues related to self-efficacy, community interaction/isolation, and help-seeking behavior. However, I don't think your proposed intervention would solve those problems. Instead, I disagree that my CS1 here at the University of Delaware is not the place to discuss the topic of avoiding global mutable state. My curriculum has several learning objectives explicitly oriented around these topics (largely agreed by my colleagues) and I have several projects that I think can authentically justify their importance (particularly with regards to testing and getting enhanced compiler support). I have many anecdotal supports from friends in industry and my own experiences teaching upper division courses that students struggle with issues that can be solved by avoiding global mutable state where possible. Personally, Therefore, since CS1 is not an agreed upon well-defined subject, I think I am perfectly justified including it in my learning objectives, alongside many other important topics and objectives. If you have demonstrable evidence relevant to my teaching context that teaching global state early could impact areas where my students have other known issues (either motivational or cognitive), then I'd be very happy to read up on those. However, for now, I am doubtful that teaching global state is a serious issue.
- blueblimp 7y agoIn the context of a simple game, global state is good design. (Maybe less so in Python than in some other languages, because Python’s variable scoping is a bit odd.) This applies even in a commercial setting. If the objective is to teach the benefits of avoiding global state, it may be more effective to pick a project type for which that is a correct design choice.