Monday, 2007-07-02

*** tpb has joined #tp00:00
*** ChanServ sets mode: +o tpb00:00
tpbtpb has joined on worldforge00:00
mithrostill no dmpayton :/00:50
mithroDystopicFro: ping?00:58
mithronash: ping?01:02
nashmithro: Going through the list? ;-)01:02
mithro~seen dmpayton01:04
tpbmithro: dmpayton was last seen in #tp 4 days, 1 hour, 11 minutes, and 10 seconds ago: <dmpayton> gnight01:04
*** nash has quit IRC03:31
*** llnz has joined #tp04:32
llnzhi all04:50
*** mithro has quit IRC05:08
*** mithro has joined #tp05:25
llnzhi mithro05:29
mithrohey llnz05:29
llnzfun random strings05:42
mithroso it's no longer your root password?06:29
llnzit's not a root password06:31
mithroso when will be able to play a game on tpserver-cpp? (IE Have working persistence)06:40
llnzyou can play now without persistence06:41
llnzit might be a bit before persistence is fixed06:41
llnzshould finish chaning PlayerView (etc) before it is fixed06:41
mithrollnz: well, without persistence all our hard work is lost if the server crashes or gets reset06:43
llnzi know06:43
* llnz sighs06:59
* llnz wanders off07:03
llnzlater all07:03
*** llnz has quit IRC07:03
jothamso what was the deal with using Epyon's ships?08:43
mithrojotham: they are GPLed09:26
*** tuna-fish has joined #tp09:35
DystopicFromithro: pong?10:02
mithroDystopicFro: ping!10:02
mithroseen all your cool progress!10:02
mithroI wanted to chat to you about a couple of things10:03
mithro 1. Doing the generation for tpserver-py10:03
mithro 2. Making the panel stuff work nicer10:03
mithroDystopicFro: got some time to chat about it?10:04
DystopicFroaye, just sitting down to cereal and coffee, so I've got plenty of time10:04
mithrowhich do you want to do first?10:05
DystopicFrowell, for the panels, I'm working on that right now, but I'd like to hear your thoughts on that10:06
mithrookay, I don't understand why are you creating/destroying the panels rather then just populating them with data?10:07
DystopicFroyes, that was lazy of me, it was the first thing that I got working when I was starting out with wx10:08
mithroahh okay10:08
DystopicFroand since it never had a performance impact for me I just put it on the back burner10:08
mithroactually, the best way I think you could solve this problem is with a magic property10:09
DystopicFroahhh, intead of an explicit getter function, yeah?10:09
mithroso you can just go "property_panel.object = abc;"10:09
mithrowere object is10:09
mithrodef object(self, value):
mithroor similar10:10
mithroin fact I would probably go as far as to do the following10:11
mithrocreate a "ParentPanel" which has a magic property which did something like10:11
mithrodef object(self, value): if isinstance(value, Component): self.component_panel = value;
mithrothe idea is that you manager which lets you select objects doesn't care about the object's type10:13
mithroor how you are going to go about displaying them10:13
DystopicFroRight...think I get the idea, I haven't done a whole lot with properties, but I'm pretty sure that I see where you're going with that10:14
mithroproperties are like setters/getters in Java10:15
mithroexcept you don't have to worry about being explicit10:15
DystopicFroyea, I just need to get a feel for them by using them I guess, I'm still not fully immersed in the looser pythonic way of doing things10:17
mithroproperties are very nice, because it allows you to change your class transparently10:17
mithroIE The person using the class doesn't need to care that you are using properties10:18
mithrosay you do something like10:18
DystopicFroare there any examples of that kind of use of properties in your code that I could look at?10:18
mithroDystopicFro: I do some late loading in tpserver-py which might be helpful10:18
mithro        def ruleset_get(self):10:19
mithro                """\10:19
mithro                Return the Ruleset (object) this game uses.10:19
mithro                """10:19
mithro                try:10:19
mithro                        return self.__ruleset10:19
mithro                except AttributeError:10:19
mithro                        exec("from tp.server.rules.%s import Ruleset" % self.rulesetname)10:19
mithro                        self.__ruleset = Ruleset(self)10:19
mithro                        return self.__ruleset10:19
tpbdisconnected from worldforge: Ping sent at 2007-07-02T10:17:44 not replied to.10:20
mithrothen of course I have the10:20
mithro    ruleset = property(ruleset_get)10:20
mithrowhich means the person can just do a10:20
mithrog = Game(9)10:20
mithroprint g.ruleset10:20
mithroand the ruleset is automatically loaded10:20
mithrobut if they never access g.ruleset, the data is never loaded10:21
mithrothat is a fairly common python pattern10:21
DystopicFrook, cool, I've got an idea of how to work that in now10:22
mithroyou should never really have something like "abc.set_peanut(True)"10:22
mithroI think you have been fairly good in that regard10:23
mithrooverall, your code seem very good10:23
DystopicFroIt's hard for me to let go of the habits that I've acquired with C++ and Java with everything needing to be explicit10:23
DystopicFrothanks o.O10:23
mithroO btw, do you know about the dictionary method of string interpolation?10:24
mithrofor example the following code10:25
mithro    cpp_header = \10:25
mithro#include <tpserver/game.h>10:25
mithro#include <tpserver/designstore.h>10:25
mithro#include <tpserver/category.h>10:25
mithro#include <%s.h>10:25
mithro""" % (FILENAME , CLASS_NAME, CLASS_NAME)10:25
mithrocan be changed to the following10:25
mithrocpp_header = """\10:25
mithro#include <tpserver/game.h>10:25
mithro#include <tpserver/designstore.h>10:25
mithro#include <tpserver/category.h>10:25
mithro #include <%(FILENAME)s.h>10:25
mithro%(CLASS_NAME)s::%(CLASS_NAME)s() {10:26
DystopicFrooh I like that.10:26
mithro""" % vars()10:26
mithrovars() gives you the local namespace as a dictionary10:26
DystopicFroand that works for any dictionary in place of vars? in case I wanted to use some global variables in another class?10:26
mithroyou could have also done10:26
mithro""" % {'CLASSNAME': 'hello', 'FILENAME': 'peanut'}10:27
mithroopps I missed a _ in there - but I think you get the idea10:27
DystopicFroyes, that's a very, very cool trick10:28
mithrobtw, here is another cool trick10:28
mithrofor i, value in enumerate(my_list):10:28
mithro   print i, value10:28
DystopicFroah, python is very nice with all of the conveniences it provides10:29
mithrowxPython isn't a particularly pythonic10:30
mithroit's slowly getting more pythonic however10:30
mithro        regex = re.compile('\s*\r?\n\s*')10:30
mithro        CFILE.write("void %s::%s {\n" % (CLASS_NAME, func_name))10:30
mithro        CFILE.write("  Category* cat = new Category();\n")10:30
mithro        CFILE.write("  DesignStore *ds = Game::getGame()->getDesignStore();\n")10:30
mithro        CFILE.write("\n")10:30
mithro        CFILE.write('  cat->setName("%s");\n' %
mithro        CFILE.write('  cat->setDescription("%s");\n' % cat.description)10:30
mithro        CFILE.write('  ds->addCategory(cat);\n')10:30
mithro        CFILE.write('  return;\n')10:30
mithro        CFILE.write('}\n\n')10:30
mithroI think you can see how to make that much nicer now :P10:31
mithroanytime you have .write multiple times is very unpythonic10:34
mithrodon't need to flush files really ofile.flush() :P10:34
mithroDystopicFro: I'm really excited about your stuff :P10:35
mithrowhats >.< ?10:35
daxxarIt's a smiley!10:35
DystopicFromithro: thanks, I've been working hard to get something really usable10:35
DystopicFro>.< is eyes10:36
daxxarLike someone from South Park squeezing their eyes together10:36
daxxarOver a nose10:36
DystopicFrosort of like that10:36
daxxar(no mouth)10:36
mithroso it isn't sideways?10:36
DystopicFro --10:36
DystopicFrowhere the straight line is the off-kilter mouth10:37
* mithro is old skool smilly :)10:37
tpb<> (at
DystopicFromithro: so, how do you want to handle code generation for tpserver-py?10:38
mithroDystopicFro: well, it's probably easier and harder then tpserver-cpp10:38
mithroI would like to be able to do two things10:38
mithro - Synconise with a running Game10:38
mithro - Dump the ruleset to disk so somebody without the RDE can load a new game10:39
* DystopicFro tilts his head10:39
DystopicFroI guess I'm misunderstanding where you're going with that because that sounds like a module for the server?10:40
mithroDystopicFro: I think it might be a good idea to try and seperate out the following, GUI<->Internal Data format<->Code Gen10:40
mithroDystopicFro: well, I would like you to be able to "upload" to a running server10:41
mithrowhich is not as hard as it might sound10:41
mithroI'm wondering if the best way is to make tpserver-py just understand the file format10:42
mithrothen for "generation" you just save everything and call a command with the correct location?10:43
mithroHave I totally lost you?10:43
DystopicFroWell, I'm trying to imagine how this would be used, as I don't understand why we would want to add new properties and components to a running game? or are we talking about other things as well?10:43
mithrothe idea is that you may have long running games - kind of like a MMORPG10:45
mithroso you would need to add new content as the game continues10:45
mithrothat is one side10:45
mithrothe other would be to speed up development10:45
mithroyou could see how the changes effect the game right away10:46
DystopicFrook, I can see that, yeah10:46
mithrotpserver-py is really a thin wrapper around a SQL database10:46
* DystopicFro hasn't really poked around tpserver-py as of yet10:47
mithroas the RDE and tpserver-py are both python - we can also share code10:47
mithroso we can do two things10:49
mithro 1. You dump to some format (say CSV) and I write a CSV importer10:49
mithro 2. I just read your project files directly10:49
DystopicFroof which #2 seems more sound to me, though it would probably require some changes to the configuration files for projects, and also the XML storage for objects, maybe for a last modified date or the like10:51
mithroI was originally thinking of doing 1. - but really I think #2 would make more sense10:52
mithrobut for this to work, we need to decouple the GUI and the code which reads in the XML10:52
mithroit looks like you have gone some of the way10:52
DystopicFroyea, that's fine, I've been wanting to change that for a long time, it feels really imcomplete and patchwork to me right now10:52
mithrowhat I think you should try and do is the following10:53
mithrohave 3 directories10:53
mithrogui <- only these classes import wx10:53
mithroobjects <- these classes read in the XML and present a set of objects which can be looked at10:54
mithrocodegen <- these classes take a set of objects and produce code10:54
mithrogui <- only these classes import wx, these classes take a set of objects and display them using wx10:55
mithrosomething like that?10:55
DystopicFroI can work on refactoring it into something more like that, yes10:55
mithrolooking over the code, it looks like you have done that quite a bit already10:56
DystopicFroI've tried very hard so far to make it extremely easy to add new object types...and I was satisfied to find that adding the Category "object" was very easy on Friday10:56
mithroIE you have and a Component.py10:56
DystopicFroso it may not come out exactly like that, and I'll probably have to ask for some advice on how to separate some things because I've got things pretty set in my head right now10:57
mithrohave you ever use MVC design?10:57
DystopicFroI've never implemented the pattern myself, but it's what I'm most familiar with through using Java's Swing10:57
mithroThe idea is that you decouple your data from the way you display it, pretty much?10:59
mithroso you can rip out the GUI and replace it with something else at a later date10:59
DystopicFroI aimed for that level of decoupling between the management of game objects in the ObjectDatabase and their representation in the GameObjectTree >.<11:00
mithroyeah - it looks like you have almost gotten there11:00
mithroto me it seem that "Code Generation" should be just another "View"11:01
mithroIf you moved GenerateCode and generateEditPanel out of it seems like you would have succeeded?11:01
* DystopicFro has to take a bit of time to wrap his head around that abstractio11:02
mithroto me it seems like this11:03
mithroa "View" is just a way of displaying the data - a GUI is a way of displaying your internal data in a way that a Human can understand11:03
mithroa "View" is just a way of displaying the data - Code generation is a way of displaying your internal data in a way that the C++ server can understand11:03
DystopicFroaye, and the fact that one is visual and dynamic and the other is static data is irrelevant11:04
mithroyeah - the GUI just has the added feature that it can change your internal data too11:05
mithrosome people go as far as to decouple how you store the data on the disk and how you store it in memory - but I think that ends up being a bit silly most of the time11:06
* DystopicFro nods11:06
DystopicFrowell, I guess I've got a bit of work to do this week, then o.O11:07
mithroDystopicFro: looking at your code - I don't think it's going to turn out to be a huge amount of work11:09
DystopicFroit will take me a bit of time to really grok what I'm actually doing, I think11:10
DystopicFrothat's why it took me so long to get started initially, I was having a hard time getting a good grip on managing the data and then displaying it as well11:10
mithroI don't think it's a huge change to what you have11:11
DystopicFronar, but it's a huge change in how I've been thinking :P11:11
mithroinfact - I think it's probably just a "mv ./game_objects/* ./gui/"11:11
mithroand moving the CodeGenerate functions into a ./codegen/ directory11:12
* DystopicFro nods11:12
DystopicFroand messing with how panels are loaded and all that stuff11:12
mithroI think a good rule of thumb would be follows11:13
mithro - Game Objects,  directory should not depended on anything else11:15
mithro - GUI should depend on Game Objects11:16
mithro - CodeGen should depend on Game Objects11:16
mithroBoth Game Objects and CodeGen should not have any wx code in them11:16
DystopicFroaye, and for the most part that's how it already is11:18
DystopicFroI guess I'll work on refactoring first, and then on performance enhancements11:18
mithrohence you could possibly generate the code without ever running wx11:18
DystopicFromithro: and just a note about only allowing one category - that's how tpserver-cpp does it too >.<11:19
mithroDystopicFro: opps! :P11:20
mithrotpserver-py (and the clients) supports many categories11:22
DystopicFroI'm going to try to talk to llnz tonight (which is tomorrow morning, I guess, for you all) and find out how hard it would be to add support for multiple categories in tpserver-cpp11:23
DystopicFroit shouldn't be too hard, I don't think, and I can probably add that in fairly quickly11:23
mithroDystopicFro: cool11:23
mithrokeep up the good work11:24
DystopicFroI'm just glad it's thought of as good work :P and I'll certainly keep at it11:24
DystopicFrothe fun stuff will be getting that TPCL expression editor up and running11:25
mithroyeah, that will be pretty cool11:27
DystopicFrokk, I'm off, talk to ya laters mithro11:28
mithroDystopicFro: okay11:28
mithroDystopicFro: feel free to email me with questions11:33
mithrohrm... no niphree :/12:39
*** tuna-fish has quit IRC13:01
*** tuna-fish has joined #tp13:45
mithroEpyon: ping?14:01
Epyonmithro, pong :)14:25
mithroany chance you could give niphree a call and tell her that she is suppose to be having a meeting with me 30 minutes ago?14:27
Epyonmithro, just phoned her. She's still at the uni talking about here masters thesis, she wanted to be on time, but y'know it's impolite to break down a conversation with someone who helps you with your thesis :/. She said she'll be here ASAP.14:31
mithroEpyon: I'm afraid I have to go get a couple of hours sleep14:57
mithrocan you tell her to send me the task list via email and it would be really good if she could be around early tomorrow14:57
mithroEpyon: also sent her an email15:01
*** mithro has quit IRC15:19
*** MihaiBalan has joined #tp16:25
*** Epyon_ has joined #tp16:34
*** nash has joined #tp18:58
*** mithro has joined #tp19:07
* nash wavse19:17
mithrohey nash19:18
nashDystopicFro: *poke*19:18
mithronash: had a chat to him last night19:19
mithroshould be in the logs19:20
nashmithro: Okay19:20
nashWhere are the logs?19:20
*** mithro has joined #tp20:01
tpbTitle: Index of /~irc (at
mithroit use to be in the topic :/20:05
tpbtpb has joined on worldforge20:09
tpbmode change by on worldforge: +nt20:09
tpbdisconnected from worldforge: Ping sent at 2007-07-02T20:12:29 not replied to.20:14
tpbtpb` has joined on worldforge20:18
tpbmode change by on worldforge: +nt20:18
tpbnick change by tpb` to tpb on worldforge20:18
tpbmode change by on worldforge: -o tpb20:20
tpbmode change by on worldforge: -t20:20
tpbaloril has joined on worldforge20:20
tpbdisconnected from worldforge: Ping sent at 2007-07-02T20:31:25 not replied to.20:34
tpbtpb has joined on worldforge20:50
tpbdisconnected from worldforge: Ping sent at 2007-07-02T21:12:04 not replied to.21:14
tpbtpb` has joined on worldforge21:14
tpbtpb has quit worldforge (Read error: Connection reset by peer)21:14
tpbnick change by tpb` to tpb on worldforge21:14
DystopicFronash: ping?21:53
DystopicFroahoy nash, sorry I'm late tonight, went out for dinner with the gf and took longer than expected getting back21:57
nashI guessed something like that ;-)21:58
nashSo how goes it?21:58
DystopicFrogoing well, had a good talk with mithro earlier and got set up with things to do this week21:58
DystopicFrofirst and foremost is refactoring for separation of gui, data structures and data representations21:59
DystopicFrothen the performance issues with the panel swapping21:59
DystopicFroand then work on code generation for tpserver-py21:59
DystopicFrosince mithro wants some custom stuff there, uploading objects to a server that's already running and stuff, I'll have to be working with him on that22:00
* nash worries code gen for the python and cpp servers may be a major PITA to maintain22:00
nashWhat other major features did you want implemented?22:00
DystopicFroin the near future? none...I want to clean things up before the midterm, I figure it's a good point to refactor and refine22:01
DystopicFrothen I can get into the TPCL expression editor and convenience aspects for the UI22:01
nashRight.  So you are generally feature happy with the current code gen - just want to clean stuff up?22:02
nashI haven't played with it yet - how does your server with your code run?22:03
DystopicFroYes, I feel like I achieved everything I wanted to get done by now, and I'll probably add a few more things in22:03
DystopicFroFlawlessly so far as I can tell, although the FroShip is...slightly unbalanced22:03
nashCool ;-) Good to know... You need to try and rope some people in to try it... Epyon is probably a good person to test with ;-)22:03
nashOnly available to players named 'fro' ?22:04
DystopicFroand, yar, meh tpserver-cpp is still up running on the generated code22:04
DystopicFrolol, aye, special easter egg just for me22:04
DystopicFroyea, after I polish it I think I'll post to tp-devel with an announcement22:04
nashHave you pushed those changes then?  I'd like to see them in mainline ASAP.  Get them really tested22:05
* nash notes more then most TP code... ;-)22:05
DystopicFroI have yet to get the chance to talk to llnz :( and I can't push to the tpserver-cpp repo on the tp server22:06
nashWell I spoke briefly - he has no problem with you pushing to a branch.  Why can't you push?22:06
DystopicFroit's just a permissions error22:07
nashBlerg :-(22:08
nashI'll hassle either mithro or llnz over it then22:08
nashYou should be able to push :-(22:08
nashThen we can deprecate the old tpserver-cpp/minisec code.  Then see how far you can get into mtsec ;-)22:08
DystopicFro>.< I think I'll get my TPCL expression editor up and running first, and then use that to push mtsec forward :P22:10
nashThat's cool...22:14
tpbdisconnected from worldforge: Ping sent at 2007-07-02T22:42:14 not replied to.22:44
tpbtpb_ has joined on worldforge22:45
tpbtpb has quit worldforge (Read error: Connection reset by peer)22:45
tpbnick change by tpb_ to tpb on worldforge22:45
tpbdisconnected from worldforge: Ping sent at 2007-07-02T23:42:58 not replied to.23:45

Generated by 2.5 by Marius Gedminas - find it at!