code logs -> 2009 -> Sat, 10 Jan 2009< code.20090109.log - code.20090111.log >
--- Log opened Sat Jan 10 00:00:31 2009
00:05 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has quit [Quit: <Insert Humorous and/or serious exit message here>]
00:40 Derakon[AFK] is now known as Derakon
00:58 Alek [~omegaboot@Nightstar-23762.dsl.emhril.sbcglobal.net] has joined #code
01:05 You're now known as TheWatcher[T-2]
01:12 You're now known as TheWatcher[zZzZ]
01:40 AnnoDomini [~farkoff@Nightstar-29126.neoplus.adsl.tpnet.pl] has quit [Quit: Violence is not the answer. Violence is the question. The answer is "YES!"]
01:44
<+simontwo>
unit testing question: I've got two classes that implement an interface. one is a reference implementation and the other is mine. how does a unit test ensure that they behave the same? would I simply create a unit test that ensures that both classes validate some graybox scenario?
01:46
<@Vornicus>
simontwo: what I'd do is grab as many tests as you can think of and apply them to both classes and make sure they come out the same.
01:48
<@Derakon>
Right.
01:48
<@Derakon>
Basically have a list of possible inputs.
01:48
<@Derakon>
For each input, run it through the reference implementation. Then run the same inputs through your implementation.
01:48
<@Derakon>
Compare the two. Are they different? If so, you have a problem.
01:49
<+simontwo>
right
01:51
<@McMartin>
You can't do it perfectly in general; "do these two chunks of code compute the same function" is one of the classically undecidable problems.
01:51
<@McMartin>
So just throw what you can at the wall and see what sticks.
01:51
<@Derakon>
Generally, make a bunch of normal use cases and hit every edge case you can think of at least once.
01:52
<@McMartin>
Yeah.
01:52
<@McMartin>
That's *your* edge cases, not theirs.
01:52
<@Derakon>
Though if you can find a bug in the reference implementation, that's usually good for some brownie points. :)
02:18 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Z?]
03:58
<+simontwo>
in java, when defining a private property in an abstract class, is that private property also inherited from extended classes?
03:59
<@McMartin>
No; it's only accessibly to nonabstract methods therein.
03:59
<@McMartin>
If you want it to be accessible to subclasses, make them protected.
04:00
<@McMartin>
Be aware, however, that protected APIs end up being about as public as public APIs in the end.
04:02
<+simontwo>
ah, fine
04:02
<+simontwo>
my abstract class will simply have getters, then.
04:02
<+simontwo>
(non-abstract ones, that is)
04:02
<+simontwo>
this seems in accordance with what I've seen before.
04:03
<@McMartin>
That pretty much matches the "lambdas are for ivory tower people" technique
04:03
<@McMartin>
I think the buzzword is "strategy pattern"
04:03
<+simontwo>
yup :)
04:03
<+simontwo>
I got the idea from my last assignment which was about strategy pattern.
04:04
<+simontwo>
what's the lambda reference about, though?
04:04
<@McMartin>
A construct from Lisp and its derived languages, essentially an inline callable usable anywhere an expression would be.
04:05
<@McMartin>
Python has them, too.
04:05
<@McMartin>
Java's standard library mostly fakes them with interfaces with a single function.
04:05
<@McMartin>
Where in Lisp or Python you'd have sort take a function as a parameter that was the comparison function, Java has Comparator<blah>.
04:06
<+simontwo>
sorry, I know what lambdas are, but I hadn't heard the quote before.
04:07
<+simontwo>
or rather, I know how lambdas work in programming. I haven't really had any formal education on lambda calculus, and therefore I still can't write programs in Unlambda. :)
04:08
<@McMartin>
Oh. Object-Oriented Programming fundamentalists tend to sneer at anything that isn't in their language of choice as being either superceded or more efficiently handled by some OO construct.
04:08
<@McMartin>
I have a dim opinion of them.
04:09
<+simontwo>
ah. "ivory tower people" is synonymous with, what, purists in a certain field?
04:10
<@McMartin>
The Ivory Tower is academia as opposed to anything practical.
04:11
<+simontwo>
I haven't med many OO elitists, but there are many FP elitists at my faculty.
04:11
<+simontwo>
s/med/met/
04:11
<@McMartin>
IME, OO elitists spent three years in industry and then went back to academia.
05:40 * Derakon tries to figure out why his bombs are only lasting four frames...
05:40 * Vornicus often thinks in FP.
05:42
<@McMartin>
I definitely have an FP accent
05:42
<@Derakon>
Or two frames...WTF.
05:45
<@Derakon>
It's like the bomb instance is just deciding it doesn't want to live after a few frames pass.
05:46
<@Derakon>
And it vanishes from the BulletManager's list of active bombs.
05:49
<@Derakon>
One frame in the update cycle: list of bombs is populated, bomb gets updated, bomb is not dead so bomb stays in list.
05:49
<@Derakon>
Next frame: list of bombs is empty.
05:49
<@Derakon>
Who stole my bombs?!
05:49
<@Vornicus>
looks like someone un-set up you the bomb.
05:49 * Derakon points an accusing finger at random. Reiver stole the bombs from the bomb jar!
05:54
<@Derakon>
...oh. Well. I see now.
05:55
<@Derakon>
I was setting self.bombs, not in __init__, but in spawnBullet. Whoops.
05:56
<@Derakon>
Now there's just the minor matter of my devastating bomb graphic being too distracting~
05:58
<@McMartin>
Part of the reason for screen-clearing is so that they may enjoy the devastation
05:58
<@Derakon>
Yes, but the bombs only clear out bullets within 200px of the player.
05:58
<@Derakon>
Clearly I should use this graphic for the player death explosion instead.
06:06
<@McMartin>
Vastly belated: Don't bombs go in a bag, not a jar?
06:07 * Vornicus randomly ponders what Link would look like if he were actually decked out in all the gear he gets.
06:10
<@Derakon>
http://en.wikipedia.org/wiki/File:Link_LOZ_with_items.png
06:11
<@Vornicus>
And there's not even all that many items in the origonal. Lots of stuff...
06:12
<@McMartin>
The spiked bracelet is adorable, especially since he still looks about 8.
06:12
<@Vornicus>
Reminds me of a scene from the beginning of Pyramids, actually.
06:12
<@McMartin>
The Littlest Punk Rocker
06:43
< ASCII>
he gets all that stuff and still no pants
06:47
<@Vornicus>
heh
06:48
< Alek>
next Zelda game: the Pants of Flame Resistance.
06:54
<@Derakon>
Okay, bombs have shiny graphics.
06:54
<@Derakon>
And they're of roughly appropriate sizes.
06:54
<@Derakon>
You get a small, fast explosion when you hit a bullet...every fourth hit, though, you lose a life, and get a huge, longer explosion.
07:17 Serah [~Z@87.72.35.ns-26506] has joined #Code
07:17 mode/#code [+o Serah] by ChanServ
07:49 Derakon is now known as Derakon[AFK]
07:58 Alek is now known as Alek|gone
08:40 KBot [AnnoDomini@Nightstar-29274.neoplus.adsl.tpnet.pl] has joined #Code
08:42 KarmaBot [AnnoDomini@Nightstar-29126.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
08:43 KBot is now known as KarmaBot
08:59 AnnoDomini [~farkoff@Nightstar-29274.neoplus.adsl.tpnet.pl] has joined #Code
08:59 mode/#code [+o AnnoDomini] by ChanServ
09:36 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #code
09:46 Alek|gone [~omegaboot@Nightstar-23762.dsl.emhril.sbcglobal.net] has quit [Ping Timeout]
10:02 You're now known as TheWatcher
10:42 Vornicus [~vorn@Admin.Nightstar.Net] has quit [Quit: ]
10:55 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has joined #code
10:55 mode/#code [+o Attilla] by ChanServ
12:48 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has quit [Ping Timeout]
12:52 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has joined #code
12:52 mode/#code [+o Attilla] by ChanServ
13:37 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code
13:37 mode/#code [+o gnolam] by ChanServ
16:22 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout]
16:34 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #code
16:49 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by ZLOK))]
16:49 Serah [~Z@87.72.35.ns-26506] has joined #Code
16:50 mode/#code [+o Serah] by ChanServ
16:53 Derakon[AFK] is now known as Derakon
17:40 Alek [~omegaboot@Nightstar-23762.dsl.emhril.sbcglobal.net] has joined #code
17:44
<@Consul>
Hooray for cleaning up sewage backups!
17:45
<@gnolam>
That's why I rsync all my sewage.
17:53 Gruber [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code
17:54 gnolam is now known as NSGuest-1006
17:54 Gruber is now known as gnolam
17:55 NSGuest-1006 [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Ping Timeout]
18:14
<@Derakon>
Oh, wow, the homing laser gets really unfair at high ranks.
18:16
<@Derakon>
Well, at least until the bullets start moving so fast that they can't really hit you any more.
19:20
<@Consul>
Well, the worst is over. We were able to roll back to a known good state in the basement. :-)
19:26 * Derakon makes the death explosion shinier.
19:26
<@Derakon>
See? http://derakon.dyndns.org/~chriswei/temp2/shiny.png
19:28 Vornicus [~vorn@Admin.Nightstar.Net] has joined #code
19:28 mode/#code [+o Vornicus] by ChanServ
19:28
<@Derakon>
Vorn! http://derakon.dyndns.org/~chriswei/temp2/shiny.png
19:29
<@Vornicus>
woo explody
19:30
<@Derakon>
You know it's a good sign when I'm enjoying playing my own game.
19:33
< Alek>
indeedy.
19:34
<@Vornicus>
Enjoying playing your own game is a good sign you're doing it right.
19:34
<@GeekSoldier>
I hate getting part way through a game, then realizing that it's no fun.
19:35
<@Derakon>
My only real question at this point is at what point it starts being good enough that people would be willing to buy it.
19:44
<@Derakon>
Okay, there's a minor problem with emitters that chase you...
19:45
<@Derakon>
When you rank up, the emitter is replaced, and moved back to its starting point. >.<
19:58
< gnolam>
That point is pretty hard to reach.
19:58
< gnolam>
Casual puzzle-type games are the easiest to sell, but even those don't usually break even.
19:59
< gnolam>
Unless you target a more specific demographic, like the iPhone (i.e. "too much money, too little sense") demographic.
20:35 * Derakon practices rampant score inflation.
20:35
<@Derakon>
Each frame, your score increases by your rank times the number of frames since you last got hit by something.
20:36
<@GeekSoldier>
how does rank work?
20:37
<@Derakon>
It increases steadily with time (currently, +.002 per frame). Every time you hit rank 1, you switch to a new bullet pattern and your rank resets to 0. Once you've seen all the patterns, your rank starts at 1 instead and goes to 2, etc.
20:37
<@Derakon>
Every time you pass all the patterns, you get an extra bomb.
20:38
<@jerith>
Derakon: Is there a way for us to play this game?
20:39
<@Derakon>
Here's a Mac version: http://derakon.dyndns.org/~chriswei/temp/bulletml5.tgz
20:40
<@Derakon>
And if you have pygame installed on Linux, you can just track down bulletml.py and change its shebang line and it should work.
20:40
<@jerith>
Cool, I'll try that. Thanks.
20:41
<@jerith>
Um, I won't. 59mb is a bit much over this connection. :-(
20:41
<@Derakon>
Wait whut.
20:41 * jerith is in South Africa.
20:41
<@Derakon>
Holy shit. How'd it get so big?
20:41
<@Derakon>
Ahh. Images is 52MB itself.
20:41
<@jerith>
I pay per megabyte for bandwidth.
20:41
<@Derakon>
Yeah, let's trim that down a bit.
20:41
<@jerith>
(Not massively, but still.)
20:44
<@Derakon>
The big problem is the megabomb graphic, which alone accounts for 16MB.
20:44
<@ToxicFrog>
...what format are these in?
20:44
<@Derakon>
PNG.
20:44
<@Derakon>
19 frames of large-resolution PNGs.
20:45
<@Derakon>
I can cut it down a bit (some of the frames are actually bigger than the game window itself), but not a whole lot.
20:47
<@Vornicus>
apply pngcrush to it.
20:54
<@Derakon>
Okay, I have the program...what flags should I use?
20:54
<@Derakon>
There appears to be zero documentation.
20:55
<@Derakon>
Oh, I see, it won't do in-place modifications, so I have to give it a directory to put its output in.
21:02 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Client exited]
21:06
<@Derakon>
I'm getting maybe 15KB reductions on filesizes here...
21:07
<@Vornicus>
blerg.
21:11 * Derakon shakes his fist at ImageMagick, which is steadfastly refusing to center his crop commands.
21:12
<@Derakon>
That is, unless I manually enter the appropriate offsets from the upper-left corner. '-gravity Center' should handle that for me, but instead it's only doing vertical centering, not horizontal.
21:31
<@Derakon>
Okay, I've gotten the filesize down to 21MB.
21:31
<@Derakon>
Of which 13MB is images.
21:44
<@Derakon>
Lives: -6.
21:53
<@Vornicus>
heh
22:33 AnnoDomini [~farkoff@Nightstar-29274.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
22:34 KarmaBot [AnnoDomini@Nightstar-29274.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
22:38
<@McMartin>
I should try it on Carlsbad and Windows, but it was *insanely* slow on Zinglon
22:40
<@Derakon>
Hm. How many bullets?
22:40
<@Derakon>
Some of the patterns are a lot slower than others.
22:40
<@McMartin>
Very few
22:40
<@McMartin>
We're talking 4 FPS.
22:41
<@Derakon>
Yow.
22:41
<@Derakon>
How do you profile Python games, anyway?
22:41
<@McMartin>
I *think* it might merely be console spam, which is why I'm testing it on Windows in .pyw mode
22:41
<@Derakon>
Oh, yeah, try redirecting to a file.
22:41
<@Derakon>
The amount of debug output is obscene.
22:41 KBot [AnnoDomini@Nightstar-29274.neoplus.adsl.tpnet.pl] has joined #Code
22:42 AnnoDomini [~farkoff@Nightstar-29274.neoplus.adsl.tpnet.pl] has joined #Code
22:42 mode/#code [+o AnnoDomini] by ChanServ
22:44
<@McMartin>
Might be good to eventually have a switch for that
22:44
<@Derakon>
I'm writing it now.
22:44 KBot is now known as KarmaBot
22:46
<@Derakon>
Aaand done.
22:46
<@McMartin>
OK, on Spiff, it stabilizes at 16 FPS for most patterns and 12 for the first one.
22:47
<@McMartin>
HOwever, on the third pattern, the emitter chases me faster than I can move ;_;
22:47
<@Derakon>
Hit '.' to speed up.
22:47
<@McMartin>
Oho.
22:47
<@Derakon>
And ',' to slow down.
22:47
<@McMartin>
Is there also a slow down button, or is this a ratchet?
22:47
<@McMartin>
Ah.
22:48
<@Derakon>
How old is Spiff?
22:49
<@McMartin>
It's an Athlon XP 2400+
22:51
<@McMartin>
Granted I'm playing at a substantial fraction of the original speed, but I managed to clear all three patterns untouched in the first run
22:51
<@Derakon>
Rank 1 is pretty easy for all of them.
22:51
<@McMartin>
Aaaaand my Windows build of Python is too old.
22:51
<@Derakon>
When did the 2400 come out+
22:51
<@Derakon>
?
22:52
<@McMartin>
I think it's roughly 1.7GHz
22:52
<@Derakon>
My general philosophy is that speed is a function not of gigahertz but of release date and price at launch.
22:53
<@Derakon>
So my computer was reasonably fast when it came out, but it's two years old.
22:53
<@McMartin>
It was a $700 machine four years ago.
22:53
<@Derakon>
Ah hah.
22:53
<@McMartin>
Doesn't run at all in pythonw
22:54
<@Derakon>
I suspect that if I'm going to get reasonable performance from this, it'll need to be ported to C++.
22:54
<@McMartin>
I'm not so sure
22:54
<@Derakon>
It does depend on where all my time is going,.
22:55
<@McMartin>
Zinglon is 4-12 FPS with console spam, 25 without.
22:55
<@McMartin>
I think I know where it's going. =P
22:55
<@Derakon>
Heh.
22:55
<@Derakon>
BTW I've uploaded bulletml5.tgz which has a few more features.
22:56
<@Derakon>
E.g. scoring, sub-explosions on the player death explosion, 50 frames of rest between patterns.
22:59
<@McMartin>
Yeah, that's what I've been using.
22:59
<@McMartin>
I can try to py2exe this if you want.
22:59
<@McMartin>
Once it's a little more production-ready.
22:59
<@Derakon>
Go for it.
22:59
<@Derakon>
Or you can wait. :)
22:59
<@McMartin>
In other news, the jump between Rank 2 and 3 is large.
23:00
<@McMartin>
Also pattern 3 still being around when pattern 1 starts losing its shit is pretty rough.
23:00
<@Derakon>
"Production-ready" is going to involve, at bare minimum, making some more patterns, smoothing out those difficulty spikes, adding score tracking, adding sound effects, etc.
23:00
<@Derakon>
Part of the game is managing homing bullets so they go offscreen and die.
23:00
<@McMartin>
Game over detection~
23:00
<@Derakon>
Yeah, that too.
23:01
<@McMartin>
OK, I was unclear on the fact that bullets vanish as they leave the screen. I figured they'd just rehome and blindside you.
23:01
<@Derakon>
Nope. Offscreen = ded.
23:02 * Derakon increases the rankup rate to get to harder patterns faster....but makes it too high, such that by the time the pattern would start, you've ranked up already, so you're in the break period again.
23:02
<@McMartin>
Snerk
23:02
<@McMartin>
Oh, right
23:02
<@McMartin>
You're using frame buffers in Pygame here, right? Not OpenGL?
23:03
<@Derakon>
Yeah.
23:03
<@Derakon>
Check the drawObjectAt function.
23:04
<@McMartin>
Oh, right
23:04
<@McMartin>
For the sake of the Windows release, when you're not in debug mode, print should never be called.
23:04
<@McMartin>
Doing so apparently crashes pythonw.exe
23:04
<@Derakon>
Oh, fun.
23:04
<@McMartin>
(pythonw is "run this program but don't assign any consoles to it")
23:04
<@Derakon>
I guess Windows users get to learn file IO before they can do debugging?
23:05
<@Derakon>
Ahh.
23:05
<@McMartin>
No, they run python.exe instead.
23:05
<@McMartin>
But since that pops a terminal window that, if you close it, kills your real window, it's really Not What You Want To Ship.
23:06
<@Derakon>
Gotcha.
23:11 * Derakon gets a "bad marshal data" error out of pstats while trying to profile his script.
23:20
<@Derakon>
Ahh, there we go. Of 45 seconds of CPU time, I spent 33.6 in pygame.delay, 5.25 in blit, 4.35 in update.
23:32
<@Derakon>
Dangit...I was having fun until I realized that I had -1 lives. ¬.¬
--- Log closed Sun Jan 11 00:00:43 2009
code logs -> 2009 -> Sat, 10 Jan 2009< code.20090109.log - code.20090111.log >