2009-07-22T00:02:27 *** mizipzor has quit IRC 2009-07-22T00:02:33 *** Nihathrael is now known as niha_off 2009-07-22T00:16:48 *** vtchill has joined #fife 2009-07-22T00:26:55 *** aanderse has joined #fife 2009-07-22T00:32:27 *** hel-ios has quit IRC 2009-07-22T00:53:17 *** _virus_ has joined #fife 2009-07-22T01:00:07 *** totycro has quit IRC 2009-07-22T01:09:31 *** _virus_ has quit IRC 2009-07-22T01:19:33 *** LinuxDonald is now known as LinDon|afk 2009-07-22T02:28:32 *** Bretzel has joined #fife 2009-07-22T02:58:21 *** vtchill_2 is now known as vtchill_away 2009-07-22T02:59:21 *** vtchill has quit IRC 2009-07-22T03:32:14 *** vtchill_away has quit IRC 2009-07-22T03:41:45 *** Bretzel has quit IRC 2009-07-22T04:31:01 *** aanderse has quit IRC 2009-07-22T08:04:19 *** StSch has joined #fife 2009-07-22T09:50:49 *** EiMiAR has joined #FIFE 2009-07-22T10:03:01 *** Shadowrunner has joined #fife 2009-07-22T10:03:02 ave 2009-07-22T10:41:47 *** niha_off is now known as Nihathrael 2009-07-22T11:44:05 Hi Shadowrunner. 2009-07-22T11:47:26 *** Nihathrael is now known as niha_off 2009-07-22T12:29:25 *** Wr4i7h has joined #fife 2009-07-22T12:38:35 *** chew-ie_ has joined #fife 2009-07-22T13:20:37 *** Wr4i7h has quit IRC 2009-07-22T13:26:12 *** GreyGhost has joined #fife 2009-07-22T13:31:32 *** barra_away has joined #fife 2009-07-22T13:32:16 *** GreyGhost has quit IRC 2009-07-22T13:39:33 *** niha_off is now known as Nihathrael 2009-07-22T13:41:25 *** Prock has joined #fife 2009-07-22T13:47:37 *** barra__out has quit IRC 2009-07-22T14:27:25 chew-ie_: ping 2009-07-22T14:28:19 pong Nihathrael 2009-07-22T14:28:28 are you good with c++ profiling? 2009-07-22T14:29:15 nope - actually I didn't write any c++ code yet :> 2009-07-22T14:29:23 ah ok 2009-07-22T14:29:29 i was trying to optimize the rendere yesterday 2009-07-22T14:29:48 didn't have as much of an effect as i thought 2009-07-22T14:30:02 heh, yeah - that's not as easy as it sounds ... 2009-07-22T14:30:14 Helios is working on some ideas, too 2009-07-22T14:30:29 i tried setting a maximum size for the object on screen 2009-07-22T14:30:41 thus i can easily chekc if a object might be on screen or not 2009-07-22T14:31:02 and thereby eliminate a lot of instances without having to load the image for it 2009-07-22T14:33:16 mmh... I'd say a hardcoded limitation isn't the way to go ... (as for the flexibility FIFE aims to provide ;-)) 2009-07-22T14:33:43 yea, i would make that setable via some function 2009-07-22T14:33:47 it's no problem not to use the limit 2009-07-22T14:33:58 sounds hackish.. 2009-07-22T14:34:03 (still ;-)) 2009-07-22T14:34:05 how so? 2009-07-22T14:34:52 because if your game "accidently" needs more instances to be rendered on the current view, your limit is a limitation 2009-07-22T14:35:08 *** _virus_ has joined #fife 2009-07-22T14:35:12 heh... what a wordplay 2009-07-22T14:35:44 What about the cameras method to get all instances on the screen? 2009-07-22T14:36:10 can't we use it to generate a list of instances which have to be rendered? 2009-07-22T14:36:39 it's not about the number of instances 2009-07-22T14:36:42 but about their size 2009-07-22T14:37:06 besides that - didn't we talk about that not the amount of rendered instance is a problem but the way it is done? (e.g. UH won't benefit of this "optimisation" if the user zooms out) 2009-07-22T14:37:27 yea it seems like that 2009-07-22T14:37:49 we actually reduced our deep see tiles from arround 6000 to 184 2009-07-22T14:37:56 and it makes almost no difference in frames 2009-07-22T14:38:02 which i found pretty interesting 2009-07-22T14:38:09 huh? What should limiting the size do? 2009-07-22T14:38:44 currently for every tile you get the screen position, and to find out if it's on screen you need to get it's current image, to get the file size of that image 2009-07-22T14:38:55 now if you say any instance can't be bigger then 100x100 2009-07-22T14:38:57 Mmh... I don't know your client - but can you test an island with only a very small amount of tiles? 2009-07-22T14:39:14 you can check that without getting any image 2009-07-22T14:39:51 (damn i forgot x and y shift) 2009-07-22T14:39:55 oh boy 2009-07-22T14:41:15 by the way how are you handling the fife stuff, are you having a python pump function which calls fife pump? or do you use a seperate thread for that? 2009-07-22T14:42:04 Nihathrael, I think that your client wastes some fps itself - can you check the fps you have in your main menu? 2009-07-22T14:42:16 For Zero, it is 1400 fps 2009-07-22T14:42:33 ~290 2009-07-22T14:42:38 phew... 2009-07-22T14:43:23 i wonder why that is 2009-07-22T14:43:44 I guess your client is very busy although there's nothing to do... 2009-07-22T14:44:21 how so? 2009-07-22T14:44:37 *** _virus_ has quit IRC 2009-07-22T14:44:38 about Zero handling the FIFE stuff: We are pumping our gamemanager - which then pumps other managers (if necessary) 2009-07-22T14:45:19 *** _virus_ has joined #fife 2009-07-22T14:45:34 do you manually call the fife pump function? 2009-07-22T14:45:35 The calculations within these pump cycles are very low - because our design is to only react on the users actions. The only manager which is working on every pump is the timemanager. 2009-07-22T14:46:13 Everything else is caught by guards 2009-07-22T14:46:48 We use fife basicapplication which runs the main pump - this pump calls gamemanager pump and there it branches into other needed pumps. 2009-07-22T14:47:09 But e.g. our worldmanager pump is only to handle map scrolling 2009-07-22T14:47:40 AI is tied to the instance listeners - without bothering engine pump 2009-07-22T14:48:07 (from client side) 2009-07-22T14:48:33 actually when the main menu is loaded there is not alot of work going on 2009-07-22T14:48:46 almost all things that use the pump later are not created and registered yet 2009-07-22T14:49:16 mmh.. but how many checks do you have in your pump? If there are many of them, they should drain some fps ... 2009-07-22T14:50:03 our pump e.g. only checks the gamestate - and works on some queues if necessary 2009-07-22T14:50:16 1 check and one for loop that calls all registered functions 2009-07-22T14:51:23 buy the way i don't get much mor efps in zero then i do with uh 2009-07-22T14:52:03 mmh.. - what machine do you have? 2009-07-22T14:52:05 actually one could say it's pretty much the same 2009-07-22T14:52:18 dual core intel 2009-07-22T14:52:25 2.4ghz i think 2009-07-22T14:52:49 2.8 here 2009-07-22T14:52:57 mmh.. I'll do a checkout and test UH 2009-07-22T14:53:12 i get arround 180 fps for both games ingame 2009-07-22T14:53:15 at normal zoom 2009-07-22T14:56:06 the lighting looks pretty cool in zero by the way 2009-07-22T14:59:12 okay ... 2009-07-22T14:59:44 UH main menu fps is between ~250 and 900 fps on my machine 2009-07-22T15:00:10 o,O 2009-07-22T15:00:17 18 fps on demo map, then segfault... 2009-07-22T15:00:40 on full zoom? 2009-07-22T15:00:58 closest zoom 18 pfs? 2009-07-22T15:01:18 yip 2009-07-22T15:01:25 closest ~18 fps 2009-07-22T15:01:31 farest ~11fps 2009-07-22T15:01:36 wow 2009-07-22T15:01:45 for me it's like 180 on full zoom and zoomed out 22 2009-07-22T15:02:05 how many frames do you get with zero? 2009-07-22T15:02:06 wait - closest zoom is now 35 fps 2009-07-22T15:03:02 *** GreyGhost has joined #fife 2009-07-22T15:03:05 Okay, yet another correction - closest zoom about 45fps, but once the trader is moving on the screen, I get a drop of ~10fps 2009-07-22T15:03:51 For Zero: 2009-07-22T15:04:34 main menu: ~1400 fps 2009-07-22T15:04:38 worldmap: ~800 fps 2009-07-22T15:05:23 "ingame map": ~300 fps (no lighting but global light on) 2009-07-22T15:05:38 i had with lighting 2009-07-22T15:05:43 hm 2009-07-22T15:05:50 "ingame map": 170 fps with this lighting on screen: 2009-07-22T15:05:50 the differences are pretty amazing 2009-07-22T15:06:25 -> http://bilderhoster.at/upload/balmv1248275176.png 2009-07-22T15:06:42 yea i was standing at a simular place 2009-07-22T15:06:58 indeed - that big difference shouldn't be the case... :( 2009-07-22T15:07:34 mmh... 2009-07-22T15:07:36 hm 2009-07-22T15:07:45 are you setting a custom chuck size? 2009-07-22T15:07:48 so there really seems to be wrong with the rendering code 2009-07-22T15:07:53 chuck? 2009-07-22T15:07:59 chunk -.- 2009-07-22T15:08:05 chunk for what? 2009-07-22T15:08:40 there is a setting for FIFE called chunk_size - it defaults to 1, but for some machines a different size is better 2009-07-22T15:08:54 i don't think we change that 2009-07-22T15:08:55 whoops - sorry, 256 ^^ 2009-07-22T15:09:12 search turns up nothing a least 2009-07-22T15:09:14 at* 2009-07-22T15:09:19 I'm using 2048 2009-07-22T15:09:55 setImageChunkingSize(*args) 2009-07-22T15:09:58 you mean that? 2009-07-22T15:10:23 yip 2009-07-22T15:10:55 it's related to graphic cards - turned out that 2048 is better for my nvidia 2009-07-22T15:14:11 hm yea doesn't do much difference 2009-07-22T15:16:01 yip, it's no "here are 400fps +"-feature :> 2009-07-22T15:17:02 hehe 2009-07-22T15:21:42 hm maybe vtchill can make a detailed trace of the render function, then we can try to find the problem 2009-07-22T15:22:45 I'd say phokus proposal is worth an investigation -> http://wiki.fifengine.de/Proposal:Renderer_redesign 2009-07-22T15:22:46 Title: Proposal:Renderer redesign - FIFE development wiki (at wiki.fifengine.de) 2009-07-22T15:22:47 *** StSch is now known as stsch 2009-07-22T15:22:56 At least he knows FIFE quite a bit ^^ 2009-07-22T15:23:07 *** Memphiss has joined #fife 2009-07-22T15:24:00 I already talked to Helios about that, and he will have a look at it besides his other approachs 2009-07-22T15:26:09 hm but this is also about the collecting and calculating of images 2009-07-22T15:26:14 only recalculating non-static instances sounds reasonable 2009-07-22T15:26:22 yea that's true though 2009-07-22T15:26:47 as we are talking about 3D calculations, this really should to the trick... 2009-07-22T15:26:59 ... I think :P 2009-07-22T15:27:25 i'm not so sure about that, because that also sugguests that having a lot fewer instances should increase performance very much 2009-07-22T15:27:28 quadtree 2009-07-22T15:27:30 but in fact, it doesn't 2009-07-22T15:27:57 Well... for Zero it does... 2009-07-22T15:28:14 Having only 3 instances on screen results in +400 fps 2009-07-22T15:28:20 quadtree 2009-07-22T15:28:25 :P 2009-07-22T15:28:34 xD 2009-07-22T15:28:43 it does for uh too, but i wonder why reducing the water tiles didn't have a big effect 2009-07-22T15:28:51 I'm just reading the proposal 2009-07-22T15:29:06 yea quadtree came to mind, also that's already implemented i think 2009-07-22T15:29:12 Prock, afaik FIFE already has a quadtree implementation 2009-07-22T15:29:17 "Currently each frame all instance per layer are visited and checked for visibility via the a loop inside Camera.render 2009-07-22T15:29:18 " 2009-07-22T15:29:30 thats gotta be costly 2009-07-22T15:29:31 And I think phoku know about that 2009-07-22T15:29:57 Prock: yea, its a linear operation 2009-07-22T15:30:02 over all instances 2009-07-22T15:30:11 which is obviously not too good 2009-07-22T15:31:04 not at all 2009-07-22T15:31:26 the more instances (on or off screen) you have.. the worse your performace will get 2009-07-22T15:31:34 yep 2009-07-22T15:31:50 still i am not sure how effective a quadtree will reduce that 2009-07-22T15:32:07 well.. it would reduce it a lot 2009-07-22T15:32:12 as at least for the ground tiles they are pretty all over the screen 2009-07-22T15:32:17 you wouldn't have to check if an object is on screen 2009-07-22T15:32:24 how so? 2009-07-22T15:32:49 re 2009-07-22T15:33:01 all you would have to know is what "quadrants" that would be visible 2009-07-22T15:33:02 So, let's got for log n guys :> 2009-07-22T15:33:25 Prock: yea true, i wonder how to choose the size of each quadrant though 2009-07-22T15:33:26 you would only check the instances in those quads 2009-07-22T15:33:39 you can do that a number of ways 2009-07-22T15:33:50 most likely based on the number of objects 2009-07-22T15:34:00 and it can by dynamic 2009-07-22T15:34:12 although building the tree is expensive.. so it's only dynamic when you load the level 2009-07-22T15:34:17 *** Shadowrunner has quit IRC 2009-07-22T15:34:24 could also be a level designer settable option 2009-07-22T15:34:42 hm, how would you know which quad i on which part of the screen? 2009-07-22T15:35:11 based on the camera I suppose 2009-07-22T15:35:29 you can already check if an instance is on the screen... 2009-07-22T15:35:31 you could give every quad a rect of it's size and total position on the map 2009-07-22T15:35:47 correct 2009-07-22T15:36:00 It's been a long time since I've researched this subject 2009-07-22T15:36:10 but you could also break the quad trees down 2009-07-22T15:37:26 recursively 2009-07-22T15:38:04 this works really well for terrain but for objects that move around it may be a little more difficult 2009-07-22T15:40:41 actually.. I believe the quadtree would handle the rendering 2009-07-22T15:41:02 you would call something like this... quadTree->render() 2009-07-22T15:41:14 and it would recursivly render all its children... 2009-07-22T15:41:25 each "node" has 4 children... 2009-07-22T15:46:05 when you start the level you would call... quadTree->create(bounding_box); 2009-07-22T15:46:31 and then you load your tiles and add them to the quad... quadTree->addInstance(instance); 2009-07-22T15:46:52 the quad tree will put it in the correct quadrant based on the instances geometry 2009-07-22T15:52:42 mmh... I'm wondering what the implemented quadtree renderer does... 2009-07-22T15:55:16 well.. just checks which quadrant's bouding box would be "on screen" and calls the render function for that "leaf node"... that leaf node would do the same because it is also cut into 4 quadrants... 2009-07-22T15:55:20 There's a topic about that @ forums -> http://forums.fifengine.de/index.php?topic=53.0 2009-07-22T15:55:21 Title: Quadtree (at forums.fifengine.de) 2009-07-22T15:56:48 ahh yes 2009-07-22T16:01:15 phoku says "current quadtree" in his post. Do you guys know of an accurate description of that implementation? I've read some conflicting documentation. 2009-07-22T16:02:44 Prock, -> http://bilderhoster.at/upload/bpgjx1248278550.png 2009-07-22T16:03:05 Zero with activated quad tree renderer (as soon as you click on the map, the tree changes) 2009-07-22T16:03:43 i will have a look at that, sounds all very promising 2009-07-22T16:03:48 afk for now though 2009-07-22T16:04:21 later nihathrael! 2009-07-22T16:07:23 *** nessmodiah has joined #fife 2009-07-22T16:20:14 *** Nihathrael is now known as niha_off 2009-07-22T16:30:20 *** nessmodiah has quit IRC 2009-07-22T16:35:40 *** totycro has joined #fife 2009-07-22T16:37:09 *** Memphiss has quit IRC 2009-07-22T16:44:15 UnknownHorizons: totycro * r2497 content/savegame_template.sqlite: Fixed a saving bug 2009-07-22T16:55:57 UnknownHorizons: totycro * r2498 horizons/world/units/unit.py: Fixed a minor mistake 2009-07-22T16:57:02 *** mizipzor has joined #fife 2009-07-22T17:03:04 I'm looking at the code for fife... it touches every "instance" on every layer. I dont see the quadtree at work 2009-07-22T17:03:11 unless I'm blind 2009-07-22T17:03:19 which is more than possible 2009-07-22T17:04:20 but in camera.cpp on lines 491 it gets all the layers.. then it loops through all layers and loops through all instances on that layer. 2009-07-22T17:07:38 I thought that perhaps the call to the Layer::getInstances() would do the culling.. but no 2009-07-22T17:15:44 *** GreyGhost has quit IRC 2009-07-22T17:23:30 mmh... might be a good question if phoku joins the channel again... 2009-07-22T17:27:07 *** GreyGhost has joined #fife 2009-07-22T17:32:25 *** niha_off is now known as Nihathrael 2009-07-22T17:51:19 dunno.. but I'm looking at trunk. Does Zero use a modified version of FIFE? 2009-07-22T17:52:12 *** vtchill|work has joined #fife 2009-07-22T17:52:21 hello vtchill 2009-07-22T17:52:27 hey 2009-07-22T17:52:35 ping chew-ie_ 2009-07-22T18:00:24 re 2009-07-22T18:00:31 pong vtchill|work 2009-07-22T18:01:02 Prock, we are using a modified renderer for our lighting code 2009-07-22T18:01:44 whats up chew-ie_ , did you ping me yesterday, think i missed you 2009-07-22T18:01:45 But quadtree can also be enabled in rio de hola 2009-07-22T18:01:55 so the renderer takes advantage of the InstanceQuadeTree? 2009-07-22T18:02:12 er InstanceQuadTree 2009-07-22T18:02:17 vtchill|work, ah - I had a question about FIFE ResourceClass - but I figured it out by myself 2009-07-22T18:02:25 ah cool 2009-07-22T18:02:54 cause I'm looking at Camera::render() and there is nothing 2009-07-22T18:03:06 had a chance to mess with the map loading stuff in the editor of my branch? 2009-07-22T18:03:10 it leterally loops through every "instance" 2009-07-22T18:03:15 literally 2009-07-22T18:03:17 * 2009-07-22T18:03:17 Prock, I can't say that - I only know that the quadtree renderer can be made visible like in the screenshot I showed you 2009-07-22T18:03:26 ahh I see 2009-07-22T18:03:37 loops through only visible instances right? 2009-07-22T18:03:57 well.. from the looks of things it loops through every object 2009-07-22T18:04:04 http://fifedocs.boxbox.org//doxygen/camera_8cpp-source.html 2009-07-22T18:04:05 not yet vtchill|work - I was busy with this Resource-thingy 2009-07-22T18:04:07 Prock: yea that's what it does 2009-07-22T18:04:16 line 474 is the def of Camera::render() 2009-07-22T18:04:28 yea thats right loops through all instances and checks if visible 2009-07-22T18:04:32 ouch 2009-07-22T18:04:41 yes that is part of what i would like to change 2009-07-22T18:04:42 ^^ 2009-07-22T18:05:04 of course it doesn't help UH's case where the are all the way zoomed out and performance is no good 2009-07-22T18:05:16 at that point its equivalent 2009-07-22T18:05:23 yes and no 2009-07-22T18:05:27 vtchill|work: what would you like to change? 2009-07-22T18:05:41 using a quad tree style approach for instance rendering 2009-07-22T18:05:58 yea 2009-07-22T18:06:00 there would be no need to check objects with the camera 2009-07-22T18:06:02 at least partitioning the space for quick instance list retrieval 2009-07-22T18:06:03 thats all expensive math 2009-07-22T18:06:15 i might take a look at implementing that after i finish my exams 2009-07-22T18:06:28 yea i have been looking into it on and off 2009-07-22T18:06:28 Prock: if we use the quadtree, we will need to set a maximum object size right? 2009-07-22T18:06:35 i think i have a brank somewhere that i was messing with it 2009-07-22T18:06:44 *branch 2009-07-22T18:06:59 Nihathrael: I dont believe so 2009-07-22T18:07:32 you would have to set the quadtree depth though. 2009-07-22T18:07:47 how will we know that a object does not reach into the screenarea if it is in the outer quad? 2009-07-22T18:07:49 the maximum depth 2009-07-22T18:09:07 *** Shadowrunner has joined #fife 2009-07-22T18:09:09 basically test each quad node to know if if you need to go down into children 2009-07-22T18:09:12 instead of each instance 2009-07-22T18:09:43 its a good optimization and it should be there for sure 2009-07-22T18:09:48 an object would be able to exist in 2 nodes... but you would have to guarantee you dont render it more than once 2009-07-22T18:09:59 2 or more nodes even 2009-07-22T18:10:42 so you keep a list of already rendered instances sort of 2009-07-22T18:10:49 in the case you are zoomed out completely there would be only 4 tests 2009-07-22T18:11:04 from the profiling i have done the camera to instance math has not been a huge % of the render time which is why i say totally zoomed out dont expect it to help a ton 2009-07-22T18:11:19 *** wenlin has joined #fife 2009-07-22T18:11:22 ahh 2009-07-22T18:11:42 I would expect it to be a bit of a problem.. but I guess not :) 2009-07-22T18:11:53 i guess it's a part of the problem 2009-07-22T18:11:55 but its still a definite improvement, just hard to quantify without testing 2009-07-22T18:11:58 another thing to think about in OpenGL rendering is materials 2009-07-22T18:12:11 changing textures is expensive 2009-07-22T18:12:13 vtchill|work: do you know where exactly the most time is spent 2009-07-22T18:12:40 well the texture chunk generation takes a while, but isn't run too frequently 2009-07-22T18:13:00 oh so FIFE builds a master texture with all the terrain textures in it? 2009-07-22T18:13:06 used on the map 2009-07-22T18:13:21 sorry.. I'm a fife newb 2009-07-22T18:14:35 no i don't think it builds a master texture 2009-07-22T18:14:41 i think that was also a problem yonibear found 2009-07-22T18:14:54 the renderer is passed textures to often, thus has to do a lot of texture swaps 2009-07-22T18:15:09 also the glBegin and glEnd is no good when it is inside the inner most loop in glImage::render 2009-07-22T18:15:18 should only do glBegin and glEnd once 2009-07-22T18:16:07 generateTextureChunks takes a while, but only run the first time for the texture 2009-07-22T18:16:35 i am trying to dig into the renderer and start doing a bunch of testing on these kinds of things' 2009-07-22T18:16:40 takes a while though unfortunately 2009-07-22T18:19:22 FIFE: wenlin_fife * r2958 /branches/active/pathfinding/engine/core/pathfinder/routepather/ (routepathersearch.cpp routepathersearch.h): remove unnecessary destructor 2009-07-22T18:19:53 could it be that we already have a quadtree all setup and running for each layer and are just not using it? 2009-07-22T18:20:10 well there is a quadtreerenderer and quad tree 2009-07-22T18:20:16 so technically i think it is there 2009-07-22T18:20:34 is it all set up... maybe not, but the code is there i think 2009-07-22T18:21:22 yea and we have this instancetree 2009-07-22T18:21:32 and it already has getInstances for a position 2009-07-22T18:21:38 so shouldn't we be able to use that? 2009-07-22T18:21:49 findInstances rather 2009-07-22T18:22:45 UnknownHorizons: greyghost * r2499 horizons/extscheduler.py: add rem_call() 2009-07-22T18:29:56 UnknownHorizons: greyghost * r2500 horizons/gui/widgets/tooltip.py: Tooltip delay 2009-07-22T18:37:20 *** Wr4i7h has joined #fife 2009-07-22T18:51:14 instanceTree i think is going to loop through all instances within possibly within a layer 2009-07-22T18:55:23 parpg: tZee_parpg * r212 /trunk/PARPG/scripts/ (objects/action.py objects/actors.py engine.py): #70 Merged the approach functions and added a tiny action queue for the PC. 2009-07-22T19:00:03 UnknownHorizons: greyghost * r2501 horizons/gui/widgets/tooltip.py: Multi line tooltips. Add '\n' 2009-07-22T19:01:00 *** rivon has joined #fife 2009-07-22T19:02:41 vtchill|work: do you happen to know what exactly Camera.getViewport returns? Are those screencoordinates or modelcoordinates? 2009-07-22T19:03:12 I'm looking at InstanceTree. Yeah it looks like it's just meant for quickly finding objects that contain a point. I would imagine it could be extended to work for the renderer though. 2009-07-22T19:04:46 i'm currently trying to use the instancetree in the render function 2009-07-22T19:08:26 *** Memphiss has joined #fife 2009-07-22T19:09:38 screen coordinatse i believe 2009-07-22T19:11:20 parpg: tZee_parpg * r213 /trunk/PARPG/scripts/objects/ (containers.py composed.py base.py actors.py): #71 Applied Jason's patch to fix issues with Python 2.6 + fixed the issue for the WoodenCrate, too. 2009-07-22T19:18:43 *** GreyGhost has quit IRC 2009-07-22T19:25:05 vtchill|work: i'm having a litte trouble figuring out how big the screen rectangle is in map coordinates 2009-07-22T19:25:26 what i would need is a rect covering all coords on the map , that are on screen 2009-07-22T19:25:45 should be the clip area of the view right? 2009-07-22T19:26:33 http://pastebin.com/d5f11b0ff 2009-07-22T19:26:35 Title: pastebin - collaborative debugging tool (at pastebin.com) 2009-07-22T19:26:38 this is what i was trying 2009-07-22T19:27:08 the renderbackend getScreenWidth and height should be full size 2009-07-22T19:27:19 and i would think renderbackend::getcliparea should be visible parts 2009-07-22T19:32:32 hm is getcliparea in mapcoordinates then? 2009-07-22T19:34:43 i believe the code pushes the clip area as the cameras viewport 2009-07-22T19:34:58 which i would think would be in screen coordinate, but maybe not 2009-07-22T19:35:28 hm 2009-07-22T19:35:48 problem is that i have to give the instancetree a rect with mapcoordinates to get all instances in that area 2009-07-22T19:35:57 but i only have the screenarea 2009-07-22T19:36:15 and since it's all kinda rotated, it's kinda complicated 2009-07-22T19:37:23 how do you normally get map coordinates? 2009-07-22T19:37:39 camera::toModelCoordinate 2009-07-22T19:37:58 the camera is given exact model coordinates on creation 2009-07-22T19:38:00 toMapCoordinates 2009-07-22T19:38:00 so i guess that is used 2009-07-22T19:38:52 it also has a toScreenCoordinates 2009-07-22T19:38:57 *** chewi-ie__ has joined #fife 2009-07-22T19:39:50 Nihathrael: you need to somehow get the bounds of the world space visible by the camera... correct? 2009-07-22T19:40:01 rigth 2009-07-22T19:40:11 problem is the rotation 2009-07-22T19:40:51 *** Memphiss has quit IRC 2009-07-22T19:41:16 well.. you need to know the plane equation for the terrain or map or whatever you guys call it 2009-07-22T19:41:41 so you can test the intersect point of that point with the camera 2009-07-22T19:41:49 er 2009-07-22T19:42:24 you somehow have to find 4 vectors for the camera (top left, top right, bottom left, bottom right) 2009-07-22T19:42:40 and test where the intersect the layers 2009-07-22T19:42:47 or terrain.. or map 2009-07-22T19:43:13 there might be an easier way though. I need to brush up on my vector geometry again 2009-07-22T19:43:33 well one would hope that is the viewport or clip area 2009-07-22T19:43:41 well 2009-07-22T19:43:42 it's not 2009-07-22T19:43:43 ^^ 2009-07-22T19:43:43 it box that surrounds the visble part 2009-07-22T19:43:58 both viewport and cliparea have x andy always 0 2009-07-22T19:44:05 which sounds like upper left corner of the screen 2009-07-22T19:45:03 hmm... I think clip area probably refers to when everything has been translated to screen space 2009-07-22T19:47:29 yes i think so 2009-07-22T19:48:14 so you have to translate those coords back to world space.. 2009-07-22T19:51:43 *** chew-ie_ has quit IRC 2009-07-22T19:53:54 I think.. hehe. I really dont know 2009-07-22T19:56:05 *** GreyGhost has joined #fife 2009-07-22T19:56:35 *** GreyGhost has quit IRC 2009-07-22T19:57:43 well there is a toMapCoordinates 2009-07-22T19:57:55 not sure though since Nihathrael said it didn't work 2009-07-22T20:03:16 vtchill|work: how does the coordinate system lie on the map? where exactly does the 0,0 lie? 2009-07-22T20:04:25 actually thats a good question, i am not totally sure and i don't have the code at the moment 2009-07-22T20:04:31 on the wiki somewhere perhaps 2009-07-22T20:25:32 wait a second... when you click the mouse doesn't it generate a coordinate? 2009-07-22T20:26:39 *** rivon has quit IRC 2009-07-22T20:27:31 *** nessmodiah has joined #fife 2009-07-22T20:29:39 yeah it's gotta be toMapCoords 2009-07-22T20:32:21 yea 2009-07-22T20:32:25 still that wont help me all to much 2009-07-22T20:32:41 heres what i tried now 2009-07-22T20:32:58 i got the map coordinates of the screenarea 2009-07-22T20:33:16 the calculated the quad arround that screen rect 2009-07-22T20:33:37 and wanted to get the instances for that quad(which is a fife rect) from the instance tree for every layer 2009-07-22T20:33:59 sadly the instances return only fill a small part of th escreen 2009-07-22T20:34:15 even though the quad should be much biggen then the screenplace, so it should be enough 2009-07-22T20:34:15 hmm 2009-07-22T20:34:23 am i doing any major basic mistake? 2009-07-22T20:35:45 can you paste the code? 2009-07-22T20:36:42 http://pastebin.com/d6d2bfccc 2009-07-22T20:36:43 Title: C++ pastebin - collaborative debugging tool (at pastebin.com) 2009-07-22T20:36:49 is that enough or do you want the entire thing 2009-07-22T20:38:37 just going through this one 2009-07-22T20:41:29 *** LinDon|afk is now known as LinuxDonald 2009-07-22T20:42:06 what does it output? 2009-07-22T20:43:02 (-44:-60:0)108 108 2009-07-22T20:43:07 depending on the view 2009-07-22T20:43:10 zoom 2009-07-22T20:43:47 what is your screen resolution? 2009-07-22T20:44:13 Hi Nihathrael 2009-07-22T20:44:25 actually nevermind that question 2009-07-22T20:44:58 those are mapcoordinates 2009-07-22T20:45:02 the only thing I dont get is how you calculate mp_r_upleft 2009-07-22T20:45:43 I am trying to run the latest UH, started as a single player and run demo. Then I tried to plant a tree, then the program just got a segmentation fault and abort 2009-07-22T20:45:48 is this expected? 2009-07-22T20:46:03 wenlin: probably not. hehe 2009-07-22T20:46:03 haha 2009-07-22T20:46:08 yea we love that 2009-07-22T20:46:24 so we thought we'd introduce some random segfaults :) 2009-07-22T20:46:58 (planting trees works here by the way) 2009-07-22T20:47:31 Prock: i'm trying to put a rect arround the screen area, but since the map is rotated those are not equal 2009-07-22T20:47:42 so we are calculating the upper left corner of that rect 2009-07-22T20:48:20 well.. look at line 12 again.. why do you mp_downleft.x as an x coord? 2009-07-22T20:50:11 it probably doesnt make a difference as it would be the same anyway. assuming of course you end up with a square. 2009-07-22T20:51:12 what would you say that should be? 2009-07-22T20:52:09 well that value would be the same as mp_topleft.x 2009-07-22T20:52:16 correct? 2009-07-22T20:52:39 no 2009-07-22T20:52:50 why not? 2009-07-22T20:55:07 oh I see now... nevermind 2009-07-22T20:57:59 http://img517.imageshack.us/img517/8586/mapk.png 2009-07-22T20:58:12 (sorry for the size, mt_paint has me more under control then i control it lol) 2009-07-22T20:59:07 hehe no prob 2009-07-22T20:59:23 so i'm trying to get the blue rect 2009-07-22T20:59:28 and then get all instances in that rect 2009-07-22T20:59:40 yeah it makes sense.. I forgot about the way the map was rotated 2009-07-22T21:01:20 well 2009-07-22T21:01:39 you have to do a little calculation 2009-07-22T21:01:41 I see now 2009-07-22T21:03:05 the distance between mp_upleft and mp_downright is your width 2009-07-22T21:03:18 the distance between mp_topright and mp_downleft is your height 2009-07-22T21:03:56 gah 2009-07-22T21:04:18 hehe the geometry stuff makes your head explode :D 2009-07-22T21:05:09 one sec 2009-07-22T21:06:49 *** _virus_ has quit IRC 2009-07-22T21:08:40 couldn't you get the rotation from the camera and apply the functions to rotate the square you made? 2009-07-22T21:09:34 which i feel like the toMapCoordinates should do 2009-07-22T21:09:43 why would i want to rotate the square i makes 2009-07-22T21:09:43 ? 2009-07-22T21:09:45 -s 2009-07-22T21:10:14 well you want to the blue and you only have the yellow right 2009-07-22T21:10:16 the square i make lies exactly in the map, without rotation, which is what we wanted 2009-07-22T21:10:25 well we have the blue one now i think 2009-07-22T21:10:39 if it lies exactly with the map you should be fine 2009-07-22T21:10:49 yea but it seems to be to small 2009-07-22T21:10:56 it does work, but the area is too small 2009-07-22T21:11:22 could you post a screenshot nihathrael? I'm insterested to see what it looks like 2009-07-22T21:11:32 its small b/c of the bounds of the screen though right? 2009-07-22T21:13:19 http://img507.imageshack.us/img507/9528/200907222309482960x1050.png 2009-07-22T21:14:52 got to run now, but will be back later 2009-07-22T21:14:53 *** vtchill|work has quit IRC 2009-07-22T21:17:39 hrm.. interesting 2009-07-22T21:17:45 cool desktop by the way 2009-07-22T21:22:21 well I gotta run... good luck with that Nihathrael. 2009-07-22T21:22:31 *** Prock has quit IRC 2009-07-22T21:27:50 *** Memphiss has joined #fife 2009-07-22T21:37:18 *** barra__out has joined #fife 2009-07-22T21:39:18 Hi Nihathrael, just a quick question, how did u run a debugger for UH? I tried to do "gdb run_uh.py", but it didn't seem to work 2009-07-22T21:43:29 debug.py gdb --args python run_uh.py 2009-07-22T21:51:02 Nihathrael: the debugger is working now. Thanks. 2009-07-22T21:51:50 moin wenlin :) 2009-07-22T21:52:18 Nihathrael: mmm ... but it didn't crash this time while I tried to plant a tree. wierd. However, the land is full of trees that I can not even have a spot to put the tree ? is this on purpose? 2009-07-22T21:52:27 morning, chewi-ie 2009-07-22T21:53:50 there should be enough room to put one tree there 2009-07-22T21:54:10 *** barra_away has quit IRC 2009-07-22T21:57:11 btw is there any good c++ ide for linux? 2009-07-22T21:58:58 Nihathrael: I dragged the tree to an empty spot, but it still looks "shadowed red", and it didn't let me plant it. Do I miss anything here? 2009-07-22T21:59:53 did you build a branch office first? 2009-07-22T22:00:09 you have to settle on the island first before you can build something 2009-07-22T22:00:54 I followed the instruction from http://www.unknown-horizons.org/site/index.php?page=download 2009-07-22T22:00:59 Title: Unknown Horizons - Download (at www.unknown-horizons.org) 2009-07-22T22:01:18 start the game 2009-07-22T22:01:24 move your ship neer an island 2009-07-22T22:01:29 and then press the anchor button 2009-07-22T22:01:36 and build the branch office on the shore 2009-07-22T22:01:43 then you can build a tree in the marked area 2009-07-22T22:09:17 Nihathrael: i use kdevelop for c++ under linux 2009-07-22T22:10:40 Nihathrael: I think it is working now, Thanks! a newly planted tree looks very small. 2009-07-22T22:10:45 *** Memphiss has quit IRC 2009-07-22T22:14:05 yea 2009-07-22T22:14:09 it will grow to a big tree :) 2009-07-22T22:14:44 totycro: i'll try that 2009-07-22T22:16:25 *** Shadowrunner has quit IRC 2009-07-22T22:27:38 *** mizipzor has quit IRC 2009-07-22T22:34:13 *** barra_away has joined #fife 2009-07-22T22:45:31 ok i'm using the quadtree now for the instance collection 2009-07-22T22:45:36 but it doesn't really save me any time 2009-07-22T22:45:40 or give me fps 2009-07-22T22:45:55 (and it doesn't work perfectly yet) 2009-07-22T22:51:26 *** barra__out has quit IRC 2009-07-22T23:08:32 *** wenlin has quit IRC 2009-07-22T23:13:39 *** nessmodiah has quit IRC 2009-07-22T23:16:53 *** vtchill has joined #fife 2009-07-22T23:35:09 vtchill: i changed the camera renderer to use the instance tree, which uses a quadtree 2009-07-22T23:35:14 but that hardly gives any performance 2009-07-22T23:35:23 and doesn't work perfectly yet 2009-07-22T23:35:44 no performance boost when zoomed in either? 2009-07-22T23:35:56 no not really 2009-07-22T23:36:27 i guess not totally surprising, but i would have thought some 2009-07-22T23:37:08 actually it costs me frames currently 2009-07-22T23:37:20 maybe the implementation or the use of the quadtree isn't optimal 2009-07-22T23:37:41 can you draw the quadtree overlay to see exactly how it breaks up the world 2009-07-22T23:37:54 i don't use the quadtree renderer 2009-07-22T23:38:00 oh ok 2009-07-22T23:38:02 rather the instancetree 2009-07-22T23:38:10 you sure the instancetree uses the quadtree 2009-07-22T23:38:13 which uses a quadtree internally 2009-07-22T23:38:16 yes 2009-07-22T23:38:17 ah ok 2009-07-22T23:40:25 can you do a detailed profile that sures which function calles to opengl and sdl take the most time? 2009-07-22T23:41:09 i think a couple are posted on the wiki 2009-07-22T23:43:07 ah right 2009-07-22T23:43:14 i am looking for the rest of the profiles i did 2009-07-22T23:43:26 so akkording to that profile the glimage is the biggest problem 2009-07-22T23:43:41 according* 2009-07-22T23:43:42 yep 2009-07-22T23:44:03 hm sadly one can't see what the most expensive call ist here 2009-07-22T23:44:14 s/here/there 2009-07-22T23:44:42 i have some timing stuff i did where i inserted timing code into the c++ code to time each specific action within the functions that took the longest 2009-07-22T23:45:57 for instance i have some printouts that looks like this for UH 2009-07-22T23:46:05 num instances: 23872 2009-07-22T23:46:16 instance updating 47ms 2009-07-22T23:46:22 distance sorting 93ms 2009-07-22T23:46:25 rendering 33ms 2009-07-22T23:46:57 that is total updating, sorting, and rendering time 2009-07-22T23:47:05 for that # of instances 2009-07-22T23:47:28 that was in camera::render 2009-07-22T23:48:46 hm but that would suggest that removing some instances should significantly improve performace 2009-07-22T23:48:57 we removed about 6k water tiles recently 2009-07-22T23:49:04 and it had almost no impact on frames 2009-07-22T23:50:27 well fps != performance neccessarily 2009-07-22T23:50:40 they are not always related thats for sure 2009-07-22T23:51:17 yea ok 2009-07-22T23:51:18 true 2009-07-22T23:51:55 i just had a small idea, but i'm not sure if it actually improves performance 2009-07-22T23:52:18 check out glimage.cpp line 137 and add the following: 2009-07-22T23:52:49 god code blocks sucks, it doesnt allow middlemouse paste :/ 2009-07-22T23:53:56 i feel like we are really under utilizing the rendering capability most of the time, but that is a hard thing to prove with numbers from profiling 2009-07-22T23:54:24 specs/man_pages/hardcopy/GL/html/gl/bindtexture.html 2009-07-22T23:54:39 binding and then begin/end drawing should only be done once first of all 2009-07-22T23:54:48 that is a bad sign that it is inside the inner most loop 2009-07-22T23:55:05 ah sorry wrong paste 2009-07-22T23:55:13 should not have begin/end inside a critical loop 2009-07-22T23:55:30 it should be done once so you don't keep switching the internal state machine within open gl code 2009-07-22T23:55:37 if(j == 0 || m_textureids[(j-1)*m_cols + i] != m_textureids[j*m_cols + i]) 2009-07-22T23:55:55 add that before the glBindTextures 2009-07-22T23:56:59 what is that doing exactly, skipping the drawing for some reason? 2009-07-22T23:57:26 *** LinuxDonald is now known as LinDon|afk 2009-07-22T23:57:30 just skip the bindtextures if the texture didn't change 2009-07-22T23:58:11 your checking the previous texture with the current in the same list thought? 2009-07-22T23:58:13 though? 2009-07-22T23:58:50 yea 2009-07-22T23:59:55 i will have to look at it closer, cooking dinner this second