Alien Toy Factory
I love Kenney's graphics library, PyGameZero and Mu. Let's see what I can do with them :D
After some brainstorming, the game idea I've settled on is to have the player(s) manage a factory making things, using conveyors and machines to build things from raw materials. A bit like Roborally, factorio or Minecraft, but I'll try and put my own spin on it.
github.com/AnthonyBriggs/pyweek26
Awards
Scores
Ratings (show detail)
Overall: 3.0
Fun: 2.5
Production: 2.9
Innovation: 3.5
Respondents: 15
Files
File | Uploader | Date |
---|---|---|
final-1.0.1.zip
— final
Pure Python version - with updated README |
AnthonyB | 2018/10/27 15:33 |
screenshot_day7_2_final.png
One last screenshot! :D |
AnthonyB | 2018/10/27 11:51 |
alien_toy_factory_exe.zip
— final
Windows executable version |
AnthonyB | 2018/10/27 11:34 |
screenshot_day7_1.png
Does your coffee machine look like this? |
AnthonyB | 2018/10/27 00:40 |
screenshot_day6_3.png
Turntables and crossovers are in and working :D |
AnthonyB | 2018/10/26 13:38 |
screenshot_day6_2.png
Would you believe this is a cross-over conveyor? Me neither, but it works... |
AnthonyB | 2018/10/26 11:18 |
screenshot_day6_1_spongebob.jpg
HaVE yOu PLaYtEsTeD YOur GaMe yEt? |
AnthonyB | 2018/10/26 08:34 |
screenshot_day5_2.png
A proper help screen, with fancy space font and everything. |
AnthonyB | 2018/10/25 13:52 |
training_manual_test.png
A test training manual, while I get the real one set up |
AnthonyB | 2018/10/25 06:41 |
screenshot_day4_3.png
Multimachine recognised! |
AnthonyB | 2018/10/24 14:54 |
screenshot_day4_2.png
Some of the images that I'm using |
AnthonyB | 2018/10/24 12:09 |
screenshot_day4_1.png
Multi machines are now working! \o/ |
AnthonyB | 2018/10/24 04:24 |
machine_running_day3_3.gif
Das machinen is nicht fur gefingepoken und mittengraben |
AnthonyB | 2018/10/23 13:33 |
screenshot_day3_2.png
MultiMachines now clatter around semi-convincingly |
AnthonyB | 2018/10/23 13:17 |
screenshot_day3_1.png
An alien with several different machines. |
AnthonyB | 2018/10/23 10:27 |
screenshot_day2_5.png
Copper ingots being stamped into circuit boards (then loaded) |
AnthonyB | 2018/10/22 12:34 |
screenshot_day2_4.png
Copper ingots being sent to a loading dock |
AnthonyB | 2018/10/22 11:25 |
screenshot_day2_3.png
The coins go round and round |
AnthonyB | 2018/10/22 06:59 |
screenshot_day2_1.png
Conveyor belts going in different directions |
AnthonyB | 2018/10/22 05:25 |
screenshot_day1_2.png
Conveyor belts carrying copper ingots |
AnthonyB | 2018/10/21 08:35 |
screenshot_day1_1.png
An alien stacking conveyor belts |
AnthonyB | 2018/10/21 07:11 |
Diary Entries
Getting set up for PyWeek
Pygame Zero and PyInstaller working together
So I've managed to get Pyinstaller working with Pygame Zero packaging up a script, and it's actually not been too hard to get working, once I figured out a few quirks.
You can see the source code in this gist, which just loads and runs the Pygame Zero demo directly. I haven't tested this *thoroughly*, so (eg.) importing something in the main script may blow up - caveat emptor, etc.
If you're feeling brave and want to help test by running the demo itself, you should be able to download the .exe from Google Drive. Note that you'll need a gamepad with joystick that's recognised by Windows - please let me know if you manage to run it successfully.
Pre-comp todo list
TODO:
- ✓Book leave for the week
- ✓Set up entry page
- ✓Figure out how to package up a game + test that that part works (maybe make the demo above available as a test?)
- XWork out screen capture and recording software for updates. (Livestream development?) Maybe, if people ask for it
- ✓Simple agile/scrum-like workflow (one morning / afternoon / evening = 1 sprint?)
- XLook at themes from last couple of competitions + workshop them? Too late :D
Theme troubleshooting
So I spent the last hour or so brainstorming how I'm going to do this thing, and trying to come up with something that'll both fit the theme, and work within the only-use-Kenney.nl-graphics constraint that I seem to have set myself.
Here's what I've got so far, it looks like the industrial theme is the go, based on the number of ideas it triggered, but feel free to steal the other ideas :D
The theme is flow, so the first step is to go look at kenney.nl (https://kenney.nl/assets?q=2d) and think about the sorts of games I can make, and how I'm going to do this whole thing.
Wishlist:
- it should definitely be multiplayer
- use the cute aliens from the platformer pack
- use joysticks and have a couch game (but still need a single player mode)
Thoughts on the theme/graphics:
- Should we use just one or two map packs? or collate a "custom" image set?
- Platformer deluxe doesn't really fit the 'flow' theme (pipes, rivers, etc.) unless I do weird stuff with it?
Some sort of thing with pipes?
- Aliens building a pipe network for some reason? Water and/or sewage management? (https://kenney.nl/assets/puzzle-pack-2)
Or perhaps holding back a tide or river to save a town from flooding? (https://kenney.nl/assets/map-pack, or the platformer town one?)
- rain -> river flow
- build dams, plant/log trees, build sandbag walls, dig trenches, operate pumps, move water downhill or soak it into the ground.
Population or animal management?
- farm: Fences, food, crazy goat AI
- try to get animals into the right place without having your roses or crops eaten
- or a city: subway station management
- paths, different animal types don't mix (chickens + pigs)
- animals can break fences if they're left for too long near food
- more a simulation: cut down trees, plant different ones, remove weeds, encourage animals
- manage erosion, water, sun, wind
- relationships between the animals + plants, spreading seeds (poop!), eating certain types
- fencing + management while the system stabilises
- need to feed yourself, too.
- manage a production line, build conveyor belts, pick things up, run around with them
- machines which assemble parts to make 'stuff'
- ingots (copper, iron, carbon?, aluminium, biological?, glass)
-> plates, wires, cogs
-> widgets (boxes? larger parts, anyway)
-> TVs, chainsaws, toys, robots (generic items pack: https://kenney.nl/assets/generic-items) - different types of flow:
- parts, electrical, hydraulic
- multiple lines of production
- different tools for each, which you have to pick up and put down :) - limited parts (belts, pipes, wires, machines) to make it happen
- new parts arrive all the time (can order some?)
- requests for new things to make,
- refactoring production lines on the fly
- maybe stuff randomly breaks and backs up and you have to fix it?
- timed, everyone running around frantically trying to make it all hang together
- bathroom breaks required - every alien has a little yellow bar next to them which builds up over time. Maybe only one bathroom, too :D
- A manual (which you have to go run to) which will bring up lists of recipes (but pause the game?)
- Maybe you need to build the machines, too?
Workflow:
- 3 hour 'crunches' a'la agile sprints (this is the first one :) )
- 2-3 crunches per day
- - maybe 4 if a crunch finishes early
- - 2 if I have something on in the evening
- try and have an extra feature + working game at the end of each crunch
- Python-only version for most of it (just need to have Python + pygame installed), but build an .exe at key points/milestones
- recruit play testers
- - family :)
- - might be hard for a couch co-op?
- need to leave time for polish + playtesting (maybe? or just go full goat simulator)
Conveyor Belts!
Ok, so there are conveyor belts in the game now. They don't actually convey things, but you can pick them up and put them down with your alien. Spent a long time trying to tweak the UI to make it intuitive, but I'm still not 100% happy with it. Never mind, onwards, onwards - I'm sure it'll change a bit as the game goes on anyway.
There's also multiplayer, so if you have multiple joysticks, the aliens can each have a conveyor of their own.
And if anyone's testing this (I doubt it), at the moment there's a hack in the PygameZero joystick handlers to get around the numbering due to my Gamecube adapter. Let me know if you have trouble fixing it and I can help out :)
Update: Just fixed a few weird bugs and reworked how the conveyor belt moves. Now instead of having three positions, it maintains a linear distance and updates it constantly, so that the items move smoothly. A couple of bug fixes later and it seems to work pretty well. The annoying one was forgetting to return True when a conveyor accepts an item, so it was pushing (and duplicating) the same item along the belt.
Anyway, next up is making conveyors move things up, down and right to left, which I might leave for tomorrow. I've done the images, not sure they're up to Kenney's high standards though.
Conveyor Belt directions
Progress! You can now (sort of) specify which direction a belt should go, by holding down the button and pushing the stick in the four cardinal directions, then letting go.
The animations are all in there, and the positioning's mostly right, but we'll see about that once there's more than one type of item.
The conveyors still pass from left to right though, despite the visuals, and the UI/highlighting is still hot garbage :D (I have plans to radically simplify it though)
Success!
The coins on the conveyor belt go round and round, round and round, round and round...
The coins on the conveyor belt go round and round, Iiiiii fixed the bug!
After some thrashing around, I realised that I'd left a stray "self.grid_y - 1" in one of the conveyor pushing calculations, and conveyors now push things around. Yay me! This is one of the core mechanisms of the game, so I'm glad it didn't take too long to track it down.
From here, I'll need a couple of other things:
- A sink for these items (ie. a loading dock to ship things off to customers)
- Machines that'll convert some combination of items into something else.
Once those are done, then the basic core of the game will be working.
After that it'll just be a Simple Matter Of Programming all the rest of the things - a big list of recipes, fixing the UI, adding machines somehow and then adding displays to those machines so that you know which bits convert or produce or sink what items.
Loading docks
Loading docks are now in the game. Currently they just act as an item sink - they'll accept items pushed into them every ten seconds.
I also added a few more conveyors so that you can actually reach the other side of the screen, which helps. See, playtesting your game is important, kids :)
The first proper factory!
Ok, time for bed now, but I've just added the first machine to the game, which stamps copper ingots into circuit boards. A couple of conveyor belts and voila! The first working factory. Sure, it's pretty simple, but adding extra types of machine shouldn't be too hard (tm). The more ambitious goal is to have different machine *parts*, ie. 2, 3 or 4 boxes, which make different stuff depending on how you arrange them.
Tomorrow I'll have a clearer day, so I might be able to chew through some more features. Top of the list is making the UI just a little more intuitive, which has been bumped mainly because it's making the game hard to test. If *I'm* finding it annoying to play, what hope does anyone else have? :D
UI is fixed
So I spent this morning pulling out huge chunks of the UI code that I wrote, and replacing it with something simpler. The original intention was to fudge things in favour of making the game easier to use, but that kinda backfired. So, no major screenshots or anything like that this time, but the player code seems to be a bit cleaner now.
One thing I'm noticing is that the machine seems to be pretty small, so maybe that's something to fix next?
Bigger machines, and recipies
So I may have bitten off a bit more than I can comfortably chew with what I've termed "Multimachines". Basically a larger version of the current "StampyThing", they're machines composed of more than one block, with sub parts so that you can identify them. When they're arranged in the correct fashion, the Multimachine activates and starts producing stuff.
Of course, all this needs configuration and arranging and so on, plus you need to detect when a multimachine's configured, keep all the sub parts in the right spot when updating, only accept items in particular spots, output in particular spots, etc. etc.
Stopping to make dinner now, we'll see how far I can get tonight without going too mad. It's a bigger job than I thought going in, but then it usually is, isn't it? :P
Making sub machines
Split off a small bit of functionality - namely, making the Machines identifiable by gluing small parts onto them. You can see the effect in the screenshot (day3_1) - each machine has a light on top, or a control panel or window in the side. This will help when people are assembling machines from a "blueprint" to get a specific item.
None of the machines go 'ping' yet though.
Multimachines working-ish
And I'm sure there are more bugs to be found :)
Update: I've just added an animated gif of the machine running. You'll have to click the thumbnail though.
Multimachines working properly
Well, that took a while. There weren't too many other chunks I could break off, so I ended up tackling all the bugs one after the other. Multimachines now work, and can produce circuit boards from ingots, but I suspect that there are other bugs and a bunch of refactoring in the immediate future.
To be fair, I did spend some time tweaking things, like adding visible hopper entries to the machine so that it's more obvious where to send the stuff, and it seems to work well.
For now though, the bulk of the game mechanics are in and it's time to start thinking about how the game itself will work, and adding game data: levels, items, more machines, etc, etc. I don't want to get caught by leaving everything until the last minute and having to crunch overnight...
Game data (probably) complete. For now.
So I now have most of the data that I'll need to generate levels entered, and images selected out of Kenney.nl's "generic items" library. I did need to edit a few to make them fit, and created one from whole cloth using Paint.NET :D, but other than that it's been comprehensive enough to use as-is.
I've gone for a broad selection of items, with some relatively complicated build trees. Whether they can actually be built, I'm not sure, but that's what playtesting is for.
Now it's 11pm, and I'm not sure whether I should push on, or go to bed now and be relatively rested for tomorrow. I kinda want to see what the game looks like, and I don't want to get caught having to crunch, but on the other hand I was pretty tired this morning. I'll take a break and see how I feel in 10-15 minutes...
Data driven shenanigans :)
Welp, I got the data driven stuff more-or-less working, though relatively untested. It's recognising the pattern for a circuit board from data, and the whole map is generated from data too, so that's good enough for me, for now.
I was right before - I'm tired and found myself making a bunch of silly mistakes, the main one being that I misread the configuration of the circuit board machine and assembled the machines as CBA, rather than ABC. But I've broken the back of it, I think now, so I'm also glad I pushed on. Shouldn't be too much more debugging from here.
Tomorrow: Levels! :D
PS: Listened to some old school techno stuff while coding. Neville Watson, if you want a listen. Reminded me somewhat of the BBC Paul Oakenfold mix that I used to listen to while coding/getting shit done.
Debugging machines
Well, another late-ish start today, and when I tested the up/down inputs to machines, they started outputting circuit boards with no input. Took a while to work out WTH was going on, but it turned out to be direction '0' evaluating as False and not counting that machine as an input machine. Since there weren't any empty inputs, all good to go! Not.
Ok, now on to the levels :P
Whoops, I've been a bit quiet today
So over the course of today I've been making steady progress. Levels and production counts are in, though not really hooked up, and I've been spending time this evening making the UI work and look nice - excluding the temporary help page I put up earlier :D
Now there's a help kiosk and door that new players enter through, and it displays nice help text that looks like it's on a screen. Shortly(ish) it'll display the machines that you've unlocked so far through your progression, starting with the circuit board, and progressing through to TVs and computers.
A quick todo list, since time's starting to run short and I need to keep track of what's left:
- Finish the help, including figuring out a way to display the machines
- Nice text when you finish a level (drawing on the training manual work)
- Progress numbers above the loading dock, showing what you need to deliver where
- Machines should also have icons near the I/O chutes showing what they'll accept / deliver
- Fix positioning and scaling on all the items
- Time how long it takes to do each level, and overall time. Not sure about what target times should be, or if I'll have time to implement.
- Playtesting: Can you actually build the machines and produce stuff? Is multiplayer any fun? Should there be more conveyors?
- Sound (and music?) when you pick up and put down things, machines start, help is activated, things are produced, delivered, etc.
- Some sort of background image so it looks less spartan?
- Remove all the debugging points and lines
- Perhaps add a level selector (from ones you've unlocked), so you don't have to play through all the levels over and over.
- Packaging and more playtesting!
Yikes.
HaVE yOu PLaYtEsTeD YOur GaMe yEt?
So I added a bunch of features to help me (and others) playtest my game, the main one being pressing number keys to change level, instead of having to complete everything, and uncovered a bunch of bugs, and missing things that I need to add :|
In no particular order:
- MultiMachines need to not have common subsequences of machines in their layout. Having machines BD and BDC would mean that you'd have two machines in one, and they'd argue about what was supposed to be input or output. This was a relatively easy fix - I just had to write a short function to detect common subsequences
- I need to add a few more conveyors to some maps.
- I also need to add a couple more types of conveyors, to split and cross the items coming out of the chutes.
- There was something else, but I've forgotten what it was :P Oh well, I'm sure it'll come to me.
- There were a heap of small, off-by-one or mistypoed things, forgetting to filter out spaces from layouts, that kind of thing.
Almost there, just a few more features!
So turntables and crossover conveyors are now in the game, since they were required to solve most of the levels :D They went in pretty easily, which is good. I'm not 100% happy with the art for them - I had to crib something together by cutting and pasting Kenney pieces, but they're ok, and I can replace them if I get time while polishing tomorrow.
Overall I think the game's pretty much there, bar the help screen to show the player how to build the machines they need, but that shouldn't be a *huge* effort... touch wood.
Now all I need to do is:
- the machine help screens
- add nice text and icons on machines and loading docks, to make it easier to tell what you're supposed to be doing
- timing on the levels
- add sounds and a bit more polish
- remove debug points and lines
- more testing and packaging.
Tomorrow is D-day, though in theory I think I have until 11am on Sunday. Hopefully I won't have to pull an all-nighter to get this done though :)
Progress on the training manual
Ok, the help page for machines has been a little tricky, but I got there. Detangling the hard coded stuff I put in to build multimachines was a bit hard, so I ended up building a dummy game to feed into the machines when I'm creating them in the training manual. I still need to add icons for input and output feeds, but it should now just be one bit of work that'll apply to both the real machines and the training ones.
I also spent some time fixing the image for cross over conveyors, since the misalignment was bothering me. I don't think I'll have time to animate the cross over belts or the turntable, but we'll see...
Finished! ...Mostly...
Ok, so I'm finally done, even if the game's polish isn't quite there. I've definitely hit the wall this evening, not helped by some issues packaging up a pyinstaller Windows version :o Overall I'm happy with how it turned out - the game's actually playable and kinda fun, can't wait to see what other people think of it.
Instructions:
- Run the executable if you're on Windows, or install Python and Pygame and run python alien_toy_factory.py
- If you have a controller with at least one axis and a couple of buttons (ie. something like an Xbox or Playstation controller), and its recognised by Pygame, that's the most fun way to play. Up to four players should be able to play.
- Keyboard controls are WASD+space/LAlt for player 1, and arrow keys+RShift/Return for player 2.
- Hit space/RShift to pick something up and put it down
- For conveyors you can hold space/RShift and push in a direction to set which way it goes.
- Build a conveyor and machine system to convert the raw materials on the left side into products for the loading docks on the right side.
- There's a simple help system at the top, which shows recipes for all of the machines unlocked so far.
Caveats/known issues:
- cross over conveyors are not the most intuitive things in the world. I didn't have time to come up with a way to set the direction of both conveyors, so the second is just one clockwise from the first.
- I haven't added sound, and probably won't at this stage. It's been a pretty big effort to get this far :D
- I haven't thoroughly tested all of the levels, so some of them might be actually impossible to do ;)
- There probably should be an intro screen for each level, but again, time's running out.
Debug keys:
- F1 will show the first machine help page
- F3 will reduce the product requirements for the level by one
- F4 will increase the product requirements (if you're having too much fun to stop, I guess...)
- F5 will immediately finish the level
- the number keys along the top (1-8) will switch levels at will
Have fun, and let me know if you run into problems or encounter any show stoppers.