Chalice sprite MODE demo


#1

My ETC shows up later today. I got pygame running yesterday … so here is my first stab at getting some basic sprites rolling.

NO AUDIO - sorry … just a proof of concept.

Without even having the ETC in front of me … I’m thinking:

Knob 1 = rotation
Knob 2 = x direction
Knob 3 = y direction
Knob 4 = color (with full clockwise being rainbow flow, and full counterclockwise being original sprite color)

Trigger mode will make the sprite jump/scale.

The Chalice - sprites running in pygame (@distropolis)


#2

This is very cool. That chalice sprite is a png image file with transparency? Have you attempted to use image changes for sprite animation? I’m considering to buy an etc soon but want to be able to do sprite animation. Thanks.


#3

Yes. The sprite mode (now called Rainbow Sprite) does use PNG files with transparency. Pygame does not have a built in method for using animated GIFS, so you’ll just need to flip through your frames manually with a counter.

The ETC is not very powerful, so you may not be able to get that many sprites dancing around. Look into the Sprite class for more details.


#4

When you say not very powerful, what does this mean? Could I load two sprite sheets and a background image into memory? And then scroll the background and surf the sprite sheets? And then still have power for most of the built-in visual effects? Where do you see the limits? Thanks. I’ve fired up pygame on my laptop to get familiar with it.


#5

Pygame does not have a method for handling sprite sheets. You might be better off cutting the sheet into frames and labeling them for sequential playback. Just load them all in your setup function and then write some code that writes the frame you want to the screen.

The ETC doesn’t have any native effects. All the modes that ship with it are individual programs. If you like parts of what you see in a program, the code is there and you can grab snippets and copy/paste.

The ETC itself needs to run the basic OS underneath and EVERY mode you have on your ETC preloads certain data to prep itself for quick loading as you switch between modes (the setup function for all modes loads when you startup the ETC).

I’ve written a dozen or so customer modes for my live set and it is a great piece of gear. I’ve released some games, so pygame makes sense to me. The ETC isn’t going to give you the same performance as a desktop or even an average phone. I’ve been able to squeeze out some fake 3D, but it starts to chug when I get past drawing ~100 lines.


#6

In pygame on my laptop I managed to throw together something with looping parallax backgrounds and a character with a couple animation frames cut out of a single sprite sheet load. Would it be easy to integrate this kind of thing with the ETC stock programs, or should I just try to add midi controls and an audio comparator and keep going on my own? Thanks.


#7

Sounds cool! Got any links to your work with the ETC?


#8

I think developing on a laptop and hoping it will work on an ETC could lead to disappointment.

I dont have an ETC, but ported ETC to the Organelle which has the same hardware, and i think one hurdle is pygame on it doesn’t appear to have any hardware acceleration (odd as the underlying integrated GPU does), and its cpu is not that powerful compared to a laptop.

also there are some assumption made in the ‘mode loader’ (the software that invokes your pygame modes), about how the screen is refreshed and ‘blitted’ to the hardware, that might not be optimal for sprites, however, if your ‘handy’ with python (and have a wifi adapter for the ETC) , its not that hard to change the mode loader to do whatever you want - i found it pretty simple to understand/adapt.

for me (others may consider this untrue) - i think the ETC (and Organelle, rPI etc) are a fun challenge to develop for, its more like the old days where the ‘game’ was , how much can i get out of this?
rather than todays development which can be, I’ll just throw more $$$/CPU/Memory at it, and do a sloppy implementation :wink:

So Id say, if you want an ETC (due to its hardware interface e.g. MIDI/sound input/buttons/knobs) , then go for it… you obviously know Pygame/Python, so you’ll be at home… and once you get it, approach it more from a what can I do given the constraints, and also its unique properties.


#9

I picked up a cheap HDMI capture card and I’ll probably start sharing some footage soon. :slight_smile:


#10

Somehow I missed the video linked in this post! I have experimented with making my own “endless runner” mode . The biggest hurdle is managing the size of your repeating backgrounds that contain an alpha. Rendering large images with transparency or large numbers of images with alpha causes the ETC to chug. Operations of alpha and color are pretty CPU expensive. Having large, scrolling paralax backgrounds is borderline territory for the ETC. Also keep in mind that most of you imagery is preloaded into the limited RAM of the ETC (if you write it into your setup code) so that can get gobbled up pretty fast.

Another ETC related challenge (that I really enjoy) is finding the right elements to interact via MIDI/Audio. Super fun!


#11

So the etc has 512mb of ram? How much of that is usable for loading images? I read that it loads all modes at once so all images for all modes? I mean, I’m fine stretching small files. Or is the limit more on the CPU for all of the transparencies? The other thing I considered if power was an issue was to render the backgrounds as videos and use a video mixer to bring them in from another source. Obviously way more complicated though. Looking forward to seeing some of your work!


#12

The ETC reports how much RAM it is using and mine hovers around 70%-75%. I’m inly using about 30 small PNG files at the moment. It I were to drop the paralax mode back on there (with larger scrolling background images) that number would go up pretty fast.

Yes, you can hit a wall with either CPU or RAM. As thetechnobear has mentioned, you will be working within these limitations. For certain shapes, it’s bettery to use pygames draw functions, for others, you will need to bring in your own assets. Most of my work is very basic, to leave as much overhead for processing. A couple of my modes “max out” the ETC’s processor and will actually miss MIDI triggers. This has forced me to tune my modes as much as possible. Good lesson in coding I guess.