LD4 log
(All times are CDT, UTC-5)
April 16:
[These took place between 20:00 and 23:30 CDT, didn't stamp at the time]:
20:00: Theme was announced: "Infection." A little disappointed at first (I was hoping for "Colors" or something a bit more abstract) but I've got an idea, something straight out of Biology class.
-- Got preliminary Cell class done, complete with properties to interface between the pygame rect and the Cell's location (the Rect is automatically re-centered when x or y is changed). Pretty schweet.
-- Ok, here's the low-down on the game: you are a white blood cell, a variety called a "Helper" T-cell. Your job is to stop the spread of a virus or bacteria (I will call it pathogen) by shooting little protein markers at the pathogen cells. The markers stick to the cell, and when a 'Killer' T-cell (another type of white blood cell) 'smells' the marker, it attacks the marked cell, trying to kill it.
This crazy stuff actually happens inside your body! Wacky.
-- Touched up the Cell class, and added 3 little subclasses (empty right now), WhiteCell, Helper, and Killer. Added update() func to update the Cells' locations.
-- Did little graphics for Red Blood Cells and Markers. Basically a red circle with some shading, and a smaller green circle with some shading, respectively. That said, they look pretty good! w00t.
-- Added Marker class, for the little protein the Helper shoots out. Originally it wasn't going to be a base of Cell, but those properties are just too handy to ignore. I changed the __init__ to get rid of the args that don't make sense for the marker (hp, groups), added check_group arg, which will be the Sprite Group to check for collision with.
-- Graphics for Helper (yellow bumpy thing), Killer (yellow bumpy thing with spikes with blue on the end), and Pathogen (smaller, green bumpy/spikey thing)
-- More work on Marker. Renamed it to Mark, added collision checking in update(), mark() will sync the Mark to the velocity of the Cell it is stuck to, and do Cell.mark_me(), which adds to the Cell's marked counter and adds the Mark to its personal "things that are stuck to me" list :P
-- Ack, the Killer and Pathogen graphics are much bigger than their 'solid' parts, I will need two rects, one for drawing, one for collision. But pygame sprites only use one, Sprite.rect :(
-- Aha, a solution: a quick cry on the #pygame channel on freenode.net, and you get brilliant ideas like modifying the collision function to use a different named rect. Copied the spritecollideany() function out of pygame.sprite, and changed it to use collide_rect instead of rect. Yay!
[started timestamping]
23:30: Taking a break from coding to write in my log, but I don't have exact times for anything before this. Oh well, added a note up top.
April 17:
00:00: Done updating the log... hopefully I will remember to add to it, and to timestamp it :-o Back to coding!
00:32: Ugh, website all set up, log is uploaded, finally get to do more coding.
00:39: Adding a die() method to Cell, which will kill the Cell and also kill all the Marks attached to it (otherwise, would get a lot of Marks eating up memory!) Also fleshing out the Helper and Killer classes. Also I am going to change Mark back to Markers, it rolls off the toungue better.
00:50: Not done with the last thing yet. But doing a bit of refactoring. Markers being subs of Cells bothered me, so I made a new, more generic class, Bulk (that is, a physical object), which Cells and Markers inherit from. A much cleaner solution, imo. Bulk will have the handy properties.
00:56: Done converting to Bulk. I'm going to bed so I can get up bright and early tomorrow morning.
01:07: Hahaha just kidding.
01:27: Did a simple background. Yay The GIMP. Looks like the inside of a bloodstream, alright.
02:05: More fleshing out of Cell, Helper, and Marker, specifically working to add the ability for a Helper to create and launch a Marker. Had to send the gimp (the other one) after Knio for being a pirate. And not a scurvy one, if you catch me drift. Yarr.
02:45: Still more work on Cell. Starting to get tired, I am really going to bed now.
10:51: yaaaaaaaawn Day 2 begins... strectch
10:55: Too tired to code... gonna write up a more detailed description of the game. Go go gadget google search!
11:41: A bit of biology source reading and processing, and I am done with a good description of the game. Gonna upload and link to it on the site.
12:44: Lots of work on Killer, and bugfixes in Helper as they came up. Killer will check each frame for a near-by marked cell. Actually, it would be better to only check every 30 milliseconds or something... perhaps the Killer will have an attention span, and chase after something for at least that long. Ooh, that is a good idea.
13:06: Done with the attention span thing. The Killer will attempt to find a new target (or at least confirm the old one) occasionally, but it will still move towards its target every frame. Used one of pygame's sprite groups, GroupSingle, to hold the target sprite.
13:54: Working on getting a little demo running, to take a few nice screenies. Copied the load_image function from the pygame Chimp example, into a new module, load. load.image() can do colorkeys, I also made a load.alpha_image() function to load images with per-pixel alpha.
14:21: Markers no longer belong to the Cell that created them or to the Cell that they are attached to; they now have their own group. This was necessary to properly draw and update them. Helpers are passed a group when they are initialized, and all Markers that they create are added to this group. The group exists outside the Helper, so it can be updated in its own right.
15:47: Got a brief tutorial on the RenderUpdates group from piman (draw() returs all the rects that need to be updated), and now have a somewhat-working game screen, although it is only the background with you in the middle. Unfortunately, Helper cells have to have a huge number of arguments passed to them, because they have to create Markers. Hrmmm... I could make a factory function, I suppose.
16:23: Sortof tricky business, but I managed to create a function that would create a Marker with the proper velocity and add it to the right group. I can now shoot Markers with the left mouse button!!
16:47: I added a few Killer Cells to the game, and made them markable. It is really funny to stick a bunch of protein blobs to a cell and watch the nearby cell float towards it :)
17:40: Boy, time flies ...just over 26 hours left. Working on the Pathogen class, which will be based off of Killer, since they really do the same things with different targets. Got rid of WhiteCell class, there is no point for it. Helper and Killer are now directly based off of Cell. Looking pretty good, although the background is a bit dull. We will see how it looks when there are more Cells floating around.
18:11: Added a wrap-around map. The map is 2000x700, and the screen is 800x600. Still finishing up Pathogen.
18:22: Refactoring Killer so that I can replace a few small functions for Pathogen. For example, it now has a function that returns True if the passed sprite is a valid target for the Killer. If I change that small function, the Killer will chase different things. Pretty cool.
20:36: Ah, took a break for dinner and a shower. T-24:24 til the end.
21:10: Woohoo! I have a sample game with 2 Killers and 2 Pathogens. If you shoot the Pathogen with the protein markers, nearby Killers will come and destroy it!! Going to clean it up a bit, and then take some screenies. :)
22:02: Alright, I set up the RedCells, now the Pathogens have some-thing to chase after. The Pathogens chase after the RedCells and infect them, then die. At the moment, RedCells don't do much from infection except slowly die. I have a graphics file ready for the infected RedCell, aka an IllCell. I am going to make another factory function, like I did with the Markers, except it will be used by IllCells to create more of the Pathogen that infected them.
22:52: Nice, the Pathogens attach to the RedCells, damage them to 50 hp, infects them, then die. The infected RedCell changes to the 'ill' image, and incubation begins. After the incubation period is over, the IllCell dies and a couple more Pathogens appear. Unfortunately, the Killers (and Pathogens by inheritance) are not detecting targets except in a very close range.
23:15: Converted Bulk's position to internally use floats. Now I get smoother animation and I can shoot in more directions! w00t. Alas, still haven't fixed the target detection. Also, you can fire too many shots too quickly, there needs to be a goodly delay between them. I already programmed in a delay, but it isn't working.
23:58: Target detection works now that I have increased the range. I also changed the quick proximity test for finding potential targets. It will now detect anything inside a square that is double the scanning range on each side. Since cells should be fairly spread out, this is still pretty effective at narrowing down the number of more expensive checks I have to do.
April 18 -- 20 HOURS REMAIN
00:00: Status report: The basics of gameplay are all there, all that remains is to make it into an actual, fun, game. This will consist mostly of one or more of: A) awarding points when IllCell or Pathogen is killed by a Killer, B) running a timer and seeing how long it takes to contain the infection, C) losing if a certain percentage of RedCells are infected. Probably a combination of B and C.
Also need to do some bugfixes:
- markers attach too far from cells, doesn't look right
- markers come loose from Pathogens when it moves
- Pathogens' markers should transfer to infected RedCells
- fix the delay on shooting Markers
Also, it is pretty boring to just stand still, perhaps allow the player to move around in the screen, or even (though it would be hard) to move to anywhere in the map. This would be fairly easy to implement, because the player is a Bulk just like any other thing, so it has position and velocity. Perhaps use the arrow keys to move around. If the player can explore the whole map, I could either write a 'scrolling' Render-Updates class (which would apply an offset to all renderings, and render the edges next to each other where the loop connects) or merely change the velocities of all the nonplayer Bulks when the player 'moves.' The background doesn't even need to be shifted, because it is the same horizontally.
It also would be good to have 'levels' that you could beat, and the next level would have tougher, faster Pathogens. Maybe after the contest, add AI Helpers to, well, help you.
00:40: Going to bed now, tomorrow I will take one last crack at the above issues.
13:03: Ugh... too much sleep. Oh well. I decided on a name last night before I fell asleep: T-Cell. (Helpers and Killers are two kinds of T-Cells.) First thing on the agenda: more RedCells. Second thing: moving the player around the screen.
14:10 5:50 to go... Added more RedCells, which caused a rapid drop in framerate... perhaps I will start with a smaller number of cells, and slowly add them in. Also, I am splitting the cells into two groups for updating, each will be updated half as often, but given the time change for both periods. I also moved all the .py files except main.py to a new directory, src, and changed the import statements in main.py to work with the new location. Now to implement a real clock and finish the RedCell stuff.
18:05: In the last rush right now, not much time to update the log. Throwing together a Level system, already added customizable keybindings for moving the Helper around. It should be very easy to add more levels, even though I won't have very many.
Source: thelag.net archive