code logs -> 2012 -> Sat, 30 Jun 2012< code.20120629.log - code.20120701.log >
--- Log opened Sat Jun 30 00:00:35 2012
00:18 * Vornicus tries to figure out the "right way" to do udlr controls.
00:34 io|gone is now known as iospace
00:38 You're now known as TheWatcher[T-2]
00:42 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
00:43 You're now known as TheWatcher[zZzZ]
00:44 Derakon[AFK] is now known as Derakon
01:44
<&McMartin>
Vorn: For VOrns ahoy I think I'd have a Step event move you the drift speed and then the forward/back parts would modify that speed with a relative assignment.
01:44
<&McMartin>
Using "Down" and "Up" &c instead of "down pressed" "up pressed" which is the falling edge
01:47 Derakon is now known as Derakon[AFK]
01:56
<~Vornicus>
Okay so I'm looking at adjusting my path speed every step. I can live with that.
01:59
<&McMartin>
You'd be doing that anyway with most game types since the user may have changed their input in any given frame.
02:34 Ariii [Ariii@Nightstar-f695463f.cicril.sbcglobal.net] has joined #code
02:36
< Ariii>
Does anybody know of any good C tutorials online? I've done JavaScript and Python along with a couple things with HTML/CSS, but I just got gcc working so I think I'll start learning C.
02:38
<@ToxicFrog>
Ariii: not off the top of my head, but ##c on Freenode recommends http://www.iso-9899.info/wiki/Books#Learning_C
02:38
<@ToxicFrog>
(some of the stuff on that page is free; scroll up a bit)
02:39
<@ToxicFrog>
(Learn C The Hard Way in particular I have heard recommended)
02:39 Kindamoody[zZz] is now known as Kindamoody
02:39
<@ToxicFrog>
I would recommend the same stuff I learned on, but I was taught by my dad with a copy of K&R for looking stuff up on the side.
02:55 Attilla [Obsolete@Nightstar-8afef565.as43234.net] has quit [Ping timeout: 121 seconds]
03:38 Kindamoody is now known as Kindamoody|afk
03:40
<~Vornicus>
I learned C partly from some random textbook and mostly by osmosis
03:41
< Ariii>
Oh, I heard O'Reilly made good programming books.
03:47
<@ToxicFrog>
They generally do, yeah
03:47
<@ToxicFrog>
That said, everything of theirs I've read has been reference stuff, not teaching stuff
03:53
< Ariii>
Oh.... I tried to learn JavaScript through his JavaScript: The Definitive Guide by him but I ended up just using internet guides anyways. What I've found on the internet for C surprisingly wasn't as good though.
03:54
<@ToxicFrog>
O'Reilly isn't a guy, it's a publisher
03:54
<@ToxicFrog>
And yeah, O'Reilly books, in my experience, are more aimed at experience programmers who want a convenient reference for some technology
03:55
<@ToxicFrog>
As for C, I am not at all surprised that there's a lot of terrible stuff out there
03:55
<@ToxicFrog>
It's been around for a long time, multiple language revisions, multiple, often incompatible compilers
03:55
< Ariii>
ToxicFrog: Oh.... thanks!
03:56
<@ToxicFrog>
And then on top of that it's a low-level language, lots of sharp edges, lots of places with undefined or implementation-defined behaviour
03:56 * celticminstrel kinda assumed O'Reilly is/was a guy as well as a publisher.
03:56
<@ToxicFrog>
And at the same time it's so common that there's a lot of people using it, and a great many of them aren't as good at it as they think they are.
03:56
< celticminstrel>
Heh.
03:56
<@ToxicFrog>
Yes; it was founded by Tim O'Reilly in the 70s.
03:58
<@ToxicFrog>
I don't know if he still does any of the writing, though.
03:59
< Ariii>
Oh... I know he wrote a couple good articles, though.
03:59
<@ToxicFrog>
Ariii: anyways, give the ##c recommendations a look.
04:00
<@ToxicFrog>
They probably know what they're talking about.
04:00
<@ToxicFrog>
I hope.
04:00
< Ariii>
Oh, okay. Thanks!
04:00 iospace is now known as iospacedout
04:01 * Vornicus is not good at C.
04:01 * Vornicus can sometimes pretend he is, but he's really, seriously not.
04:09 Vash [Vash@Nightstar-e8057de2.wlfrct.sbcglobal.net] has joined #code
04:09 mode/#code [+o Vash] by ChanServ
04:22
<@ToxicFrog>
I would say that I'm good at C, but that would pretty much guarantee some kind of embarassing and hard to track down bug related to VA type promotion or something when next I'm working on my thesis~
04:22
<~Vornicus>
heh
04:27
<@ToxicFrog>
More seriously, I'm not a C expert, but between my thesis and Lua interop I do a lot of C programming and can probably answer questions about it.
04:29
< celticminstrel>
I'd say "ditto" but I'm kinda more C++...
04:30
<@ToxicFrog>
I have also done a lot of C++, but that's rustier and it's a more complicated language on top of that.
04:31 * Vornicus would say he's the local python guru but is pretty sure Rham and Der know it better at this point.
04:49 SmithKurosaki [smith@Nightstar-1748d158.home1.cgocable.net] has joined #code
04:57 Kindamoody|afk is now known as Kindamoody
05:20 SmithKurosaki [smith@Nightstar-1748d158.home1.cgocable.net] has quit [Ping timeout: 121 seconds]
05:33 Ariii [Ariii@Nightstar-f695463f.cicril.sbcglobal.net] has quit [Client closed the connection]
06:02
< Rhamphoryncus>
There's a terrible lot of information on C that's simply *wrong*, including the majority of books
06:03
< celticminstrel>
Okay, so... dynamic_cast<Derived&>(dynamic_cast<Middle&>(*ptr)) throws an exception, but dynamic_cast<Derived>(*ptr) works. Why? (Note that Derived inherits from Middle and Middle inherits from the static type of ptr.)
06:03
< Rhamphoryncus>
How to correctly approach undefined behavior is the worst of that.. which is disturbing considering how security sensitive it is in C
06:04
< Rhamphoryncus>
references vs pointers vs simply the object?
06:04
< celticminstrel>
Hm. I just remembered something.
06:04
< celticminstrel>
auto strips references. I bet that has something to do with it.
06:06
< celticminstrel>
Yup, that was it.
06:06
< celticminstrel>
If I'd been actually changing the object's properties I would've noticed this sooner. <_<
06:07
< celticminstrel>
Need auto& instead of auto.
06:07
< celticminstrel>
(Random note. It seems auto& is required for iterating a multidimensional array using range-for.)
06:08
< celticminstrel>
So yeah, copy contructor must've been getting called and... what do you call it... slicing or something?
06:11
< Rhamphoryncus>
In python slicing is doing foo[3:10]. C++ doesn't have the equivalent that I know of
06:12
< celticminstrel>
It does actually, for valarray. But I was referring to the other slicing.
06:13
< celticminstrel>
Derived a; Base b = a;
06:13
< celticminstrel>
That.
06:13
< celticminstrel>
The kind you don't want. :P
06:46
< Tarinaky>
Python serialisation.
06:46
< Tarinaky>
What are my options.
06:47
< Tarinaky>
Inb4 fopen
06:47 Kindamoody is now known as Kindamoody|breakfast
06:49
< Tarinaky>
I understand Pickle is bad(tm), so what should I be using?
06:59 celticminstrel [celticminst@Nightstar-05d23b97.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
07:02 Derakon[AFK] is now known as Derakon
07:05 Vash [Vash@Nightstar-e8057de2.wlfrct.sbcglobal.net] has quit [[NS] Quit: I lovecraft Vorn!]
07:06
< Tarinaky>
I'm having a little trouble figuring out how to use json in python. >.<
07:10
< Tarinaky>
I'm having trouble getting it to do... even a simple test case in ipython :/
07:12 * Derakon copies from Pyrel: http://pastebin.com/g72n0NrE
07:12
<&Derakon>
Here classType is a class instance that takes a single record from a JSON list as its first argument.
07:13
<&Derakon>
And here's an example file loaded by that code: http://pastebin.com/t6JvHYgu
07:16
< Tarinaky>
And now my laptop has decided it doesn't want to load anything.
07:17
< Tarinaky>
I'm not touching the 'file' part yet.
07:17
< Tarinaky>
I'm just trying to get it dumping stuff to stdout.
07:17 * Derakon heads to bed.
07:17 Derakon is now known as Derakon[AFK]
07:18 * Tarinaky still doesn't understand how to get it to dump data in the first place :/
07:26
< Tarinaky>
It's not even giving me an exception.
07:26
< Tarinaky>
it's just printing 'null'.
07:26
< Tarinaky>
Which isn't very helpful.
07:26 Kindamoody|breakfast is now known as Kindamoody
07:41 * Tarinaky is really struggling to figure out htf he's supposed to use this :/
08:58
< Tarinaky>
Why are all the serialisation libraries for Python a bit shit?
08:59
<@Tamber>
All software sucks.
09:00
< Tarinaky>
Ahah!
09:00
< Tarinaky>
Huston, we have serialisation.
09:01
< Tarinaky>
Unfortunately it isn't with one of the standard python libraries... -.-
09:08 You're now known as TheWatcher
09:15 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
09:15 mode/#code [+o himi] by ChanServ
10:02 Rhamphoryncus [rhamph@Nightstar-5697f7e2.abhsia.telus.net] has quit [Client exited]
10:02 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
10:15 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
10:15 mode/#code [+o himi] by ChanServ
10:52 Kindamoody is now known as Kindamoody|afk
11:34 Attilla [Obsolete@Nightstar-8afef565.as43234.net] has joined #code
12:46 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
12:47 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has joined #code
12:47 mode/#code [+o PinkFreud] by ChanServ
13:22
<&jerith>
Tarinaky: What are you trying to serialise?
13:22 * jerith uses JSON quite successfully.
13:23 * gnolam too.
13:23
< Tarinaky>
In the end I managed to get it to work using jsonpickle.
13:23
<&jerith>
Pickle is horrible.
13:23
< Tarinaky>
jsonpickle isn't pickle.
13:23
<&jerith>
Are you trying to serialise arbitrary Python objects?
13:23
< Tarinaky>
Yes.
13:24
<&jerith>
Then you're probably going to struggle.
13:24
< Tarinaky>
What is the point of a serialisation library if it can't automagically handle arbitrary objects?
13:24
<&jerith>
Can you turn your data into a combination of lists, dicts, strings and numbers?
13:24
< Tarinaky>
Not easily.
13:24
<&jerith>
json isn't a serialisation library.
13:26
< Tarinaky>
jsonpickle seems to do the job without the flagrant arbitrary execution of code issues pickle has.
13:27
<&jerith>
How does it reconstitute arbitrary Python objects, then?
13:27
< Tarinaky>
It stores the class as an attribute.
13:28
<&jerith>
So you can execute arbitrary code.
13:29
< Tarinaky>
No, I mean it stores the name of the class it's supposed to be.
13:30
<&jerith>
And that "class name" can be an arbitrary Python callable.
13:30
< Tarinaky>
That would be silly.
13:30
<&jerith>
As long as it's at the top level of a module.
13:31
<~Vornicus>
I don't know if you can reliably tell the difference between a class and a function
13:31 iospacedout is now known as iospace
13:31 * Tarinaky goes have a look at the output...
13:33
< Tarinaky>
"py/object": "model.faction.Faction"
13:34
<&jerith>
jsonpickle.decode('{"py/object": "sys.exit"}')
13:34
<&jerith>
Arbitrary code execution.
13:35
< Tarinaky>
Well that's silly.
13:35
<&jerith>
That's what a generic serialisation library needs to be able to do.
13:36
< Tarinaky>
So what's json supposed to do that fopen isn't then :/
13:38
<&jerith>
You need to write the code to represent each of your serialisable objects as JSON-compatible data structures, and to recreate the appropriate state for that representation.
13:55
<&jerith>
Tarinaky: http://pastebin.starforge.co.uk/528
13:56
<&jerith>
Something like that.
13:57
<&jerith>
It's a bunch of extra work, but it makes everything explicit and you get to handle things like loading old versions that are in a slightly different format.
13:58
<&jerith>
(Using something like jsonpickle, any change in your objects breaks horribly.)
13:59
<&jerith>
You might even want to go a step further and separate the internal representation of state from the serialised form completely.
14:00
<&jerith>
Then you can have different (de)serialisers for different formats and not have to break everything if you refactor your internal objects for some reason.
14:00
<&jerith>
Also, version your format.
14:54
<~Vornicus>
gnah, per frame really doesn't work for some of the behavior I have here.
14:57
<~Vornicus>
I'm pretty sure I want on-state-change but
15:06 Ariii [Ariii@Nightstar-f695463f.cicril.sbcglobal.net] has joined #code
15:07
< Tarinaky>
I'm still getting null out of json :/
15:07
<&jerith>
Pastebin your code?
15:08
< Tarinaky>
http://pastebin.com/7YrP0Hgg
15:09
< Tarinaky>
Oh wait, depr.
15:09
< Tarinaky>
Nope...
15:10
< Tarinaky>
Never mind.
15:10
<&jerith>
You need to return something from pack()....
15:10
<&jerith>
Also, you have a lot of global state floating around.
15:11
< Tarinaky>
That's because you can't play more than one game at a time.
15:11
< Tarinaky>
That would be silly.
15:11
<&jerith>
Yes, but having it global makes it hard to track down what's touching it.
15:12
< Tarinaky>
Answer: everything.
15:12 Kindamoody|afk is now known as Kindamoody
15:13
< Tarinaky>
If you want to be really pedantic, the stuff that's importing that particular module is touching it.
15:13
< Tarinaky>
Which is everything except about 3 files.
15:13
< Tarinaky>
Admittedly, not everything is -writing- to it...
15:13
< Tarinaky>
But everything is reading from it.
15:13
<&jerith>
So, my games do it like this.
15:14
<&jerith>
There's a game object that gets passed around where it's needed instead of being global.
15:15
<&jerith>
When you create a new game object, it creates everything it needs, and passes itself in as a parameter.
15:15
< Tarinaky>
I have the game module set up as a singleton.
15:16 Attilla [Obsolete@Nightstar-8afef565.as43234.net] has quit [[NS] Quit: ]
15:16
<&jerith>
When you try to load a game, a new game object is created from the saved state and is guaranteed to be free of leftover cruft.
15:17
<&jerith>
If the load fails, you don't lose the game in-progress.
15:17
< Tarinaky>
Guarenteeing it to be free of leftover cruft is easy.
15:17
< Tarinaky>
There's three datastructures you just have to clear.
15:18
<&jerith>
And what about things holding references to stuff in those structures?
15:18
< Tarinaky>
I... can't see any way that normal program flow could get into that situation.
15:19
< Tarinaky>
Particularly as nothing has a reference to things in those structures.
15:19 Attilla [Obsolete@Nightstar-8afef565.as43234.net] has joined #code
15:19 * jerith couldn't either, until he was bitten by it.
15:19
< Tarinaky>
Nothing has a direct reference to things in the structures.
15:20
<&jerith>
Not yet.
15:20
<&jerith>
How do ships and factions and planets know about each other?
15:20
< Tarinaky>
ships, factions and planets are the three datastructures you have to clear/blank.
15:20
<~Vornicus>
right but
15:21
< Tarinaky>
If you delete them what they're pointing to doesn't matter.
15:21
<&jerith>
"if ship.faction == faction:"
15:21
<&jerith>
A ship has a reference to a faction.
15:21
< Tarinaky>
A ship doesn't exist outside game though.
15:21
< Tarinaky>
Excluding for-each loops
15:21
< Tarinaky>
Because they're on the stack.
15:22
< Tarinaky>
Or whatever the Pythonic equivalent thereof is.
15:23
<&jerith>
Also, why are you looking at each faction to see if it's the one the ship has instead of just taking the one the ship has?
15:23
< Tarinaky>
Because I'm a moron?
15:24
<&jerith>
Same with all the world stuff. :-)
15:25
< Tarinaky>
But yeah. Nothing outside of the game module holds a permanent/long-term reference to anything in the game module.
15:25
< Tarinaky>
That's the point of having the game module.
15:25
<&jerith>
Anyways, there are very, very few legitimate uses for singletons.
15:25
< Tarinaky>
To put all my global state in one place.
15:26
<&jerith>
Still, it's easy enough to make it non-global.
15:26
< Tarinaky>
I am reliably informed by someone who writes games for a living that game state is one of them.
15:26
< Tarinaky>
:)
15:27
<&jerith>
What language does he write them in?
15:27
< Tarinaky>
C++ I think.
15:27
<&jerith>
That would probably explain it.
15:28
<&jerith>
Having a non-global game object and creating a new one when necessary makes a bunch of things easier.
15:29
<&jerith>
You don't have to worry about cleaning stuff up or replacing it.
15:29 * jerith shrugs.
15:29
<&jerith>
But it's up to you.
15:30
< Tarinaky>
The important thing is not to mix them up.
15:30
< Tarinaky>
Because then bad things happen.
15:30
<&jerith>
Mix what up?
15:30
< Tarinaky>
Singletons and passing around a pointer.
15:30
< Tarinaky>
If you do both you have all the drawbacks of both and none of the advantages.
15:30
<&jerith>
If you don't have a singleton, you can't mix them up.
15:31
< Tarinaky>
If you don't have a pointer you can't mix them up>
15:31 celticminstrel [celticminst@Nightstar-05d23b97.cable.rogers.com] has joined #code
15:31
<&jerith>
You can get a reference to your singleton very easily.
15:32
<&jerith>
Anyways, my more recent games don't actually have "new game" code paths.
15:32
<&jerith>
You create a new game by loading the "new game" state.
15:33
<&jerith>
That also makes a bunch of stuff easier.
15:34
<~Vornicus>
note that sometimes you can't do that - procedural generation means you have to actually create the state in the first place
15:35
< Tarinaky>
Stupid question...
15:35
< Tarinaky>
How do I create an object from a __dict__ I've ripped out of it?
15:35
< Tarinaky>
Given that I know the object's type ahead of time.
15:35
<&jerith>
Vornicus: That's orthogonal, unless the only place you ever so generation is in the new game case.
15:35
< Tarinaky>
Can you assign to __dict__?
15:36
<&jerith>
Tarinaky: You can, but I think you're trying to do the wrong thing.
15:36
<&jerith>
What are you after?
15:36
< Tarinaky>
In the pastebin I sent I'm sticking the game state into a SaveFormat object and then turning its internal dictionary into json...
15:37
< Tarinaky>
I am now trying to write the load method.
15:37
< Tarinaky>
By turning the json into a SaveFormat object I can 'unpack' into the game state.
15:37
<&jerith>
Why are you turning its __dict__ into JSON?
15:37
<&jerith>
Why aren't you packing it explicitly?
15:37
< Tarinaky>
Because Python doesn't have structures?
15:38
<&jerith>
Python has dicts.
15:38
<~Vornicus>
and objects, but dicts are more on point.
15:38
<~Vornicus>
(the difference between a class and a struct in C++ is that a class has its members private by default)
15:38
<&jerith>
__dict__ contains a whole lot of stuff you shouldn't be storing.
15:39
< Tarinaky>
That doesn't appear to be true, looking at the dumped string.
15:39
< Tarinaky>
Also: objects are OO. I like OO.
15:40
<&jerith>
Tarinaky: You're doing this the wrong way.
15:40
<&jerith>
You shouldn't be trying to store exact replicas of your game objects.
15:41
< Tarinaky>
I'm not.
15:41
<&jerith>
You should be trying to store a representation of your game state.
15:41
< Tarinaky>
I am.
15:41
<~Vornicus>
but looking in __dict__ says that you're doing the former.
15:41
<&jerith>
Then why are you trying to muck about with __dict__?
15:41
< Tarinaky>
Because I'm putting my 'representation of my game state' in an object.
15:42
< Tarinaky>
And that object is the OO representation of the JSON output.
15:42
<&jerith>
Why not put it in a dict, which is the thing you're going to turn into JSON?
15:42
< Tarinaky>
Because dicts can't have methods.
15:42
<&jerith>
Correct.
15:43
< Tarinaky>
It'd also make the code really hard to read.
15:43
<~Vornicus>
If you've got all sorts of functions on your (units) for instance, it shouldn't be too hard to put a function that extracts only the data you want into a dict
15:43
<&jerith>
But you can very easily write a class that has methods that operate on a dict.
15:43
<~Vornicus>
I mean, jeez
15:43
< Tarinaky>
If I make SaveFormat a dict I'm going to have dicts in dicts and it's going to be unreadable.
15:44
< Tarinaky>
>.<
15:44
<~Vornicus>
It's a savegame. Live with it.
15:44
<~Vornicus>
HUman readability is secondary.
15:44
<&jerith>
Let me rewrite your pasted code for you quick.
15:44
< Tarinaky>
Of my code.
15:44
< Tarinaky>
Not the save file
16:04
<&jerith>
Tarinaky: http://pastebin.starforge.co.uk/529
16:06
<&jerith>
I restructured it a bit while still keeping the basic process the same.
16:09
< Tarinaky>
That still doesn't help with the unpacking :p
16:10
<&jerith>
It show how you can operate on a dict nicely.
16:10
<&jerith>
You just do the same thing in reverse.
16:10
< Tarinaky>
I've written this damn thing 4 times now :/
16:10
<&jerith>
This is where it's handy to have a non-singleton game object.
16:10
< Tarinaky>
Do I really have to do it again?
16:11
<&jerith>
You don't really have to do anything if you don't want to.
16:11
< Tarinaky>
That's a lie.
16:12
<&jerith>
I'm trying to help you do this in a way that isn't going to cause you lots of pain later.
16:13
< Tarinaky>
Also, lines 5 to 14 I don't get.
16:13
<&jerith>
I'm guessing the reason you've done it four times is that you haven't gotten it right yet.
16:13
< Tarinaky>
self._pack_foo don't seem to be doing anything?
16:15
<&jerith>
I did it that way because you liked the "OO" way of doing things, which involves modifying instance state.
16:15
< Tarinaky>
I wasn't criticising.
16:15
< Tarinaky>
I was asking a question.
16:17
<&jerith>
There are two kinds of methods there. _pack_foo() builds a dict representation of the object you give it. _pack_foos() collects objects from the game state and puts their dict representations into self.state.
16:17
< Tarinaky>
Oh, I see.
16:19 * jerith does it a bit differently, using a mechanism that doesn't involve modifying anything on the faction.
16:23 * Tarinaky can't stand python any more >.>
16:24
<&jerith>
Why not?
16:24
< Tarinaky>
Because I am sick of it.
16:31
<&jerith>
Anyways, here's a version closer to how I've designed it myself, with the start of unpacking: http://pastebin.starforge.co.uk/530
16:39
< Tarinaky>
It's giving me null -.-
16:39
<&jerith>
Did I forget to return state or something?
16:40
<&jerith>
(I haven't actually run that code at all, since that would involve creating a bunch of fake state.)
16:40
< Tarinaky>
There we go.
16:40
< Tarinaky>
There were a couple of attribute names wrong so I copied it out by hand to make sure it was right >.>
16:40
< Tarinaky>
Obviously I forgot a return statement.
16:40
<&jerith>
Cool.
16:42
< Tarinaky>
I am going to eat something before I murder someone trying to puzzle out unpack >.>
16:43
< celticminstrel>
I assume by null you mean None. :P
16:44
<&jerith>
celticminstrel: He's calling json.dumps() on it, so he's getting 'null'. :-)
16:44
< celticminstrel>
Oh.
16:51 iospace is now known as io|gone
16:57
< Tarinaky>
How can I sort my factions by the ID I give them? (their order in the list matters and has to be preserved >.>)
16:58
< Tarinaky>
Or will it be in the right order anyway?
17:00
<&jerith>
You're both reading and writing sequentially.
17:00
<@rms>
Give sort a custom cmp function.
17:01
<&jerith>
So they'll be listed in the JSON data in their original order, and read out again in the same order.
17:01
<&jerith>
Why does order matter, though?
17:02
<&jerith>
(Not saying it shouldn't, but maybe the reason is something that can be fixed easily.)
17:12
< Tarinaky>
The order matters because of an early oversight in schema.
17:12
< Tarinaky>
The order in the list is the order people take their turns in a hotseat game.
17:14
< celticminstrel>
Well, you could refactor that out, couldn't you?
17:14
< celticminstrel>
Possibly -re.
17:17
< Tarinaky>
Although I'm not sure what I'd refactor in.
17:18
< Tarinaky>
Lists are good for sequences.
17:22
< Tarinaky>
Okay.
17:22
< Tarinaky>
It seems to be working.
17:23
< Tarinaky>
http://pastebin.com/YjrRN1yf This is what I have now.
17:31
<@ToxicFrog>
Tarinaky: I think the question was more "why are you sick of it"
17:42 Kindamoody is now known as Kindamoody|out
18:26 * celticminstrel wonders how much work it would be to create a new IRC client... probably a lot...
18:27
<&jerith>
celticminstrel: A very lot.
18:27
<&jerith>
And IRC /bot/ is much easier.
18:27
< celticminstrel>
Yeah, a bot is fairly easy.
18:27
< celticminstrel>
I suppose the interface is really the hardest part.
18:27
<&jerith>
Clients have a lot of UI stuff.
18:28
<&jerith>
Also, they need to track all the state, not just some of it.
18:28
< celticminstrel>
State meaning...?
18:28
<&jerith>
Channels, modes, various numerics, etc.
18:29
<&jerith>
Bots can just ignore stuff like motd and whatever.
18:29
< celticminstrel>
Of course, there's always the option of forking an existing one...
18:30
< Tarinaky>
ToxicFrog: I... really can't get in the right headspace to do Python.
18:30
< Tarinaky>
But I need to get this project finished.
18:45
< Tarinaky>
Stupid question: now that I have a human-readable JSON save file...
18:45
< Tarinaky>
How do I obsfucate it?
18:49
<&jerith>
Tarinaky: You kind of don't.
18:49
< celticminstrel>
Remove all line breaks?
18:49 Derakon[AFK] is now known as Derakon
18:49
< celticminstrel>
And whitespace too maybe.
18:49
< celticminstrel>
I dunno.
18:49
<&jerith>
Why do you want to?
18:50
< Tarinaky>
Imagine it was a PBEM game.
18:50
< celticminstrel>
I suppose you could try compressing it, though that sounds pointless to me.
18:50
<&jerith>
You could probably push it through some kind of crypto.
18:50
< celticminstrel>
Unless it's an unimaginably huge file.
18:50
< Tarinaky>
If you peek in the save file you can see things you, perhaps, ought not to.
18:50
< celticminstrel>
Oh yeah, encrypt it.
18:50
<&jerith>
It's the DRM problem, though.
18:51
< celticminstrel>
I dunno. Are you looking for security, or obscurity?
18:51
<&jerith>
You need to have the tools to decrypt it so the game can have it.
18:51
<&jerith>
Which means the tools can be extracted from the game.
18:51
< celticminstrel>
I imagine that wouldn't be easy though.
18:51
<&Derakon>
Obfuscation/encryption is a version 2 feature.
18:52
<&Derakon>
For version 1, assume your users are not assholes.
18:52
<&jerith>
If you want secure PBEM, you need to completely rearchitect for partial state.
18:52
< celticminstrel>
I already have encryption on my game.
18:52
< celticminstrel>
Only for the level passwords, but that's beside the point.
18:52
<&Derakon>
CM: I mostly just meant that you should ignore any features that are not absolutely required.
18:52
<&Derakon>
The game is perfectly playable even if people can cheat, so don't bother trying to stop them for the moment.
18:53
< celticminstrel>
I'm guessing it's not very secure since Python says Mersenne Twister isn't suitable for cryptography, but I don't really care.
19:02
<@ToxicFrog>
If it's singleplayer, obfuscating the save files means that I will cut you. If it's multiplayer, and people can gain advantage by reading or editing the saves, you have bigger problems.
19:03
< celticminstrel>
What about singleplayer and obfuscating level files?
19:05
<&Derakon>
Same deal.
19:05
<&Derakon>
If people want to cheat in single-player games, that's their business.
19:09 Kindamoody|out is now known as Kindamoody
19:14 Kindamoody is now known as Kindamoody[zZz]
19:15
< Tarinaky>
Pft, there's money to be had selling cheats to your customers :p
19:15
< Tarinaky>
That's the Free to Play model!
19:24
< Tarinaky>
So... Victory conditions...
19:24
<&jerith>
You should totally have some.
19:26
< Tarinaky>
Last Man Standing, 66% of the map colonised...
19:26
< Tarinaky>
Victory points and Research Victory tie in with enhancements further down the line.
19:28 * celticminstrel doesn't really see an issue with making save/levelfile editing non-trivial.
19:30
< Tarinaky>
There will be fog/vision limits later on.
19:30
< Tarinaky>
These lose their potence if you can simple save and inspect a text file for the position and quantity of enemy ships.
19:50 rms is now known as Masako
19:59 ShellNinja is now known as Nikolaas
20:01
<@ToxicFrog>
celticminstrel: well, first of all, why go to that extra effort when there is no reason to?
20:01
<@ToxicFrog>
Secondly, it makes it harder to mod the game, harder to cheat, harder for players to implement cool things like KSP-Kessler
20:02
<@ToxicFrog>
It is a pointlessly dickish move
20:02
<@ToxicFrog>
Also, it makes your job as a developer harder, since it's another hoop to jump through in order to examine the save structure and whatnot.
20:03
< celticminstrel>
A hoop to jump through?
20:04
<@ToxicFrog>
If your saves are obfuscated, you need to deobfuscate them if you want to examine the save structure being generated, or edit the save to test something.
20:04
<@ToxicFrog>
Fundamentally, the question I want to ask here is: why do you want to do this? It's more effort; what's the tradeoff? What do you get in exchange?
20:06
< celticminstrel>
In my specific case, it's a) smaller filesize (granted that's probably not terribly significant <_< ) and b) if you want to skip a level you can't just look in the level file to see what the next level's password is.
20:07
< celticminstrel>
You could see it as a small encouragement to solve it yourself.
20:08
<@ToxicFrog>
(a) can actually be significant (look at Supreme Commander's saves sometime), but you can just run it through gzip or whatever.
20:08
<&jerith>
Why do you care if people skip levels?
20:08
<@ToxicFrog>
(b) I am trying hard not to react to with profanity.
20:08
< celticminstrel>
I don't care that much. I just don't see any reason to make it trivial to do so.
20:09
<&Derakon>
People get the game to play it.
20:09
<@ToxicFrog>
Why does it matter to you so much that you will expend extra effort to make it harder to do so?
20:09
<&Derakon>
If they decide they don't want to play a particular part of it, you should not prevent them from playing the rest of it.
20:09
<@ToxicFrog>
Why are you so invested in people playing through every single level in order that you will do this?
20:09
<@ToxicFrog>
What is wrong with you?
20:10
<@ToxicFrog>
If someone hits a level they enjoy but are stuck on, they'll probably keep working on it until they solve it, or, if they can, skip it and return to it later.
20:10
<@ToxicFrog>
But if they hit a level they aren't enjoying, they're either going to skip it or stop playing.
20:10
<@ToxicFrog>
And if they can't skip it? Your game is getting uninstalled.
20:11
<@ToxicFrog>
And of course, none of this affects you in the slightest if it's a singleplayer game anyways!
20:11
<&Derakon>
This is, incidentally, why games like the Super Mario Bros. series have warps and shortcuts and so on.
20:12
<&Derakon>
So you can skip the parts of the game you don't like.
20:14
< celticminstrel>
It'd still be possible to skip. You could edit the level so that when you start it it'll be solved immediately.
20:14
<&Derakon>
Then why even bother obfuscating the save file?
20:14
< celticminstrel>
I'm only obfuscating a tiny part of it, which is the password.
20:14
<&Derakon>
There's no point putting a lock on your door if it's not mounted to the hinges in the first place.
20:15
< celticminstrel>
(And compressing the actual tile data, which could count as obfuscation I suppose, but that was to reduce size.)
20:15
<&Derakon>
Compression shouldn't be mucked with until you have everything else sorted out.
20:15
<&Derakon>
It's nice to have smaller filesizes, sure, but disk space is cheap.
20:16
<&Derakon>
You can get a 3 terabyte drive from Costco for $130.
20:17
<&jerith>
Compression can help performance if the data's biggish, too.
20:17
<&jerith>
But still, doesn't matter for small stuff.
20:18
< celticminstrel>
I actually have the compression disabled at the moment, too. >_>
20:20
<@ToxicFrog>
So, wait
20:20
<@ToxicFrog>
You're willing to spend extra time and effort and make your program more complicated
20:21
<@ToxicFrog>
To make sure people play this single-player game the way you want rather than the way they want
20:21
<@ToxicFrog>
Using a technique that you already know is wholly ineffective?
20:21
<@ToxicFrog>
And, in fact, is so in at least three ways?
20:22
< celticminstrel>
I don't really care that much if they cheat, but putting a password in plaintext in the level file doesn't feel right.
20:22
<&Derakon>
Because?
20:22
<&jerith>
It's not a password. It's a piece of data.
20:22
<&Derakon>
Would it be different if it was a bit indicating if the player has access to a given level?
20:23
< celticminstrel>
I dunno.
20:23
<&jerith>
It's not an authentication token.
20:24
< celticminstrel>
It's a password to access the level.
20:24
<@ToxicFrog>
<jerith> It's not an authentication token.
20:24
<@ToxicFrog>
It's barely even an authorization token.
20:25
<@ToxicFrog>
Also, there will be a complete list on GameFAQs within a week of the game's release anyways.
20:25
< celticminstrel>
I kinda assumed that.
21:14 io|gone is now known as iospace
21:20 celticminstrel [celticminst@Nightstar-05d23b97.cable.rogers.com] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
21:37 Rhamphoryncus [rhamph@Nightstar-5697f7e2.abhsia.telus.net] has joined #code
22:11
<~Vornicus>
There are iirc something like 7 1/3 levels in super mario brothers that you can't skip
22:13
<~Vornicus>
ANyway: if you're doing "levels" I think the best way is to allow (universal) passwords to hop to each specific level, and then just keep track of what levels they've solved separately.
22:14
<~Vornicus>
Heck, I'd put the full list in spoilers.txt.
22:17
<&Derakon>
Vorn: and in SMW, there's 12 levels, I think, counting Bowser's castle.
22:17
<&Derakon>
Sadly the Star World doesn't let you do the worlds out of order.
22:18
<&Derakon>
Just jump to Bowser and access the Special Zone.
22:18
<~Vornicus>
This is more for puzzley games. For games like tetris I'd just put in a mania selector with the ones you've done highlighted, or so
22:19
<~Vornicus>
Is this with or without speedrun talent
22:20
<&Derakon>
I did it as a kid.
22:20 Nikolaas is now known as ShellNinja
22:20 Masako is now known as rms
22:20
<&Derakon>
Yoshi's Island 2, 3, and 4, then Iggy's castle, then Donut Plains 1, Donut Secret 1, Donut Secret Ghost House, then 4 secret Star World exits, then Bowser's Castle.
22:21
<&Derakon>
Getting Star World 4's secret exit without the ! blocks is tricky but by no means impossible.
22:23 * Vornicus should try that
22:23
<&Derakon>
(In fact I don't think the ! blocks are ever required for anything)
22:24
<~Vornicus>
(some of the places are extraordinarily difficult to get to without them though. something in vanilla dome, iirc...)
22:25
<&Derakon>
Ah, yeah, could be.
22:25
<~Vornicus>
(that tall place)
22:26
<&Derakon>
It's been ages since I played that game...
22:37
<~Vornicus>
yeah, vanilla secret 1, to get to the star road entrance for some reason you are practically guaranteed to need the blue switch.
22:38
<~Vornicus>
WEll, no, I guess you can technically do it with the cape
22:39
<&Derakon>
You might also be able to get Yoshi up there by jumping off of enemies, and then use him for a double jump.
22:39
<&Derakon>
Or get a blue Yoshi and simply fly.
22:40
<&Derakon>
It's kinda weird that that Star Road entrance, and the one right after it (Cheese Bridge?), are so hard to access compared to the others.
22:42
<~Vornicus>
oh god Cheese Bridge
22:42 Vash [Vash@Nightstar-e8057de2.wlfrct.sbcglobal.net] has joined #code
22:42 mode/#code [+o Vash] by ChanServ
22:42
<~Vornicus>
So ridiculous.
22:43
<&Derakon>
Have fun flying between buzzsaws!
22:43
<~Vornicus>
Flying over them works.
22:43
<&Derakon>
But you have to be low enough to fly under the gate.
22:43
<~Vornicus>
It's the bit where you have to manage to get just enough height at just the right moment that's the problem
23:03 Ariii [Ariii@Nightstar-f695463f.cicril.sbcglobal.net] has quit [Client closed the connection]
23:07 Ariii [Ariii@Nightstar-f695463f.cicril.sbcglobal.net] has joined #code
23:15 Ariii [Ariii@Nightstar-f695463f.cicril.sbcglobal.net] has quit [Client closed the connection]
23:23 * TheWatcher hairpulls at this makefile
23:26
<@TheWatcher>
The rule to build the damned .rc file is there, I am pointing at it, you useless piece of code
23:27
<@rms>
Check the timestamps?
23:27
<@rms>
Also check the dependancies
23:30 Vash [Vash@Nightstar-e8057de2.wlfrct.sbcglobal.net] has quit [[NS] Quit: I lovecraft Vorn!]
23:35 Derakon is now known as Derakon[AFK]
23:36 * TheWatcher eyes
23:37
<@TheWatcher>
"File `obj/script_res.o` does not exist. Must remake target `obj/script_res.o`. Successully remade target file `obj/script_res.o`." ... except there's nothing there
23:41 Ariii [Ariii@Nightstar-f695463f.cicril.sbcglobal.net] has joined #code
23:52
<@Alek>
sounds like a pathing problem. or there's a writeblock on the folder, and the program doesn't check for success.
23:53!Deepthought.NY.US.Nightstar.Net *** jerith invited Bluefinger into the channel
23:53 Bluefinger [bluefinger@Nightstar-0a7066eb.home.otenet.gr] has joined #code
23:54
< Bluefinger>
hi hi
23:55
<&jerith>
Hey Bluefinger.
23:55
<&jerith>
This is where the hackers hack.
23:55
< Bluefinger>
I promise to not touch the wires
23:56
<&jerith>
No, touch the wires.
23:56
< Bluefinger>
ooo
23:56
<&jerith>
Just not the dangerous ones.
23:56
< Bluefinger>
hmm...
23:56 * Bluefinger touches a glowing red one
23:56
<&jerith>
(We'll get around to marking which ones are dangerous eventually.)
23:58
< Bluefinger>
but yeah, don't mind my php craziness, it is just my job as mostly a front-end web-dev
23:59
< Bluefinger>
not currently in the business for custom built sites
23:59
<&jerith>
It just makes me sad to see people using PHP when there's so much wrong with it.
--- Log closed Sun Jul 01 00:00:27 2012
code logs -> 2012 -> Sat, 30 Jun 2012< code.20120629.log - code.20120701.log >

[ Latest log file ]