|
More efficient way to capture mouse position? |
Mishtiff
Member #15,776
October 2014
|
pkrcel said: Even thou, seems performances drop anyway...we'll have to look elsewhere. I honestly have no idea where to look now. i guess i could try to see how long it takes for the tree to collect all of the units that are in a node? I feel as though it should be faster than it is... But i am pretty new to a lot of this stuff, so im just happy about where I am now i suppose. my problem with the Boost addition: My path file is messed up with the microsoft directx SDK path. here is a link to what the problem is: I have the exact same problem, but i cannot figure out how to get the "" out of the path file. i have tried what he suggested but it didnt work. Im not sure how to edit the path file outside of the .bat file though. |
Aikei_c
Member #14,871
January 2013
|
Mishtiff said: Im not sure how to edit the path
You can edit path this way (under windows 7 at least): |
Mishtiff
Member #15,776
October 2014
|
thank you Aikei, i had no idea where that was. Its all running now! |
pkrcel
Member #14,001
February 2012
|
Mishtiff said: I honestly have no idea where to look now. i guess i could try to see how long it takes for the tree to collect all of the units that are in a node? I feel as though it should be faster than it is... But i am pretty new to a lot of this stuff, so im just happy about where I am now i suppose. Well, your code should be profiled as me and Trent suggested, or maybe you can try first to switch to Boost implementation of the r-tree instead of this adaptive quadtree, which should be at least efficinet and robust (the Boost introduction gives times to build the tree and to query the index that shoould very well be under your timing constraints), since usually Boost is. I too think you're hitting the ceiling too fast. For example how do you handle gfx? are those primitives or bitmap? In the latter case is bitmap drawing held? Maybe you could setup a git repository for us to look at? I guess your actual code coudl be shared... It is unlikely that Google shares your distaste for capitalism. - Derezo |
Mishtiff
Member #15,776
October 2014
|
person said: maybe you can try first to switch to Boost implementation of the r-tree instead I plan on implementing this now, with much thanks to Aikei for all the help on getting it started. already in the works! person said: For example how do you handle gfx? are those primitives or bitmap? In the latter case is bitmap drawing held? Everything is primitives. so, during drawing this is literally it: Bases: Ships: the program has to render around 200-400, but i dont see that being a problem if they are just primitives... person said: Maybe you could setup a git repository for us to look at? I guess your actual code coudl be shared... of course, would gitHub be a good place to store it? |
Aikei_c
Member #14,871
January 2013
|
Mishtiff said: would gitHub be a good place Which reminds me that GitHub has been banned today in Russia for "suicide propaganda", and I'm not joking. . |
Mishtiff
Member #15,776
October 2014
|
thats crazy Aikei! Im getting around 25 errors now that i have everything implemented. Granted, I may not have everything correct, since i have been up for about and hour or two messing and recoding. Ill put my stuff up on gitHub once i wake up. No idea whats going on or if i have things in the right place. |
Aikei_c
Member #14,871
January 2013
|
What is the first error you have? It is usually the one which causes everything to crash. |
Mishtiff
Member #15,776
October 2014
|
ok sounds good ill post there instead. well i closed the program for a little while, and now its running fine... odd? all of the boost errors went away. game runs fine, but the pRTree is not working correctly im sure, since its saying that there are all objects returned as colliding. I have set the bounding box, not sure why it is returning all as colliding. EDIT: it does seem to have a problem with: BOOST_GEOMETRY_REGISTER_POINT_2D(Vec2,float,cs::cartesian,x,y); saying: Name followed by '::' must be a class or namespace name. something to do with cartesian |
Aikei_c
Member #14,871
January 2013
|
Do you include <boost\geometry\geometry.hpp> (or just boost\geometry) ? EDIT: If it compiles, though, you should be fine. Visual studio is sometimes wring with its on-the run error detection. Show your code. |
pkrcel
Member #14,001
February 2012
|
Mishtiff said: the program has to render around 200-400, but i dont see that being a problem if they are just primitives... There was some debate about that actually. I'd like to see if going the bitmap route may make any difference. IIRC you come from Mike Geig's tutorial, try to draw your circle into a bitmap (one for base, one for ship) like Mike does for the spaceship at program setup, an then use THAT bitmaps instead of drawing primitives. Might also use al_hold_bitmap_drawing() when there. Of course you should solve the Boost rtree implementation before. And bitbucket is as good as anything else for this matter I guess. It is unlikely that Google shares your distaste for capitalism. - Derezo |
Mishtiff
Member #15,776
October 2014
|
I have my files up on bitbucket. not sure how to link them, but heres a shot: https://mishtiff@bitbucket.org/mishtiff/basegame.git bullet is currently unused, but may be used in the future. i cant figure out how to remove Arial, all it is is the font used. |
Thomas Fjellstrom
Member #476
June 2000
|
Try and find the public git address, not your personal read/write address -- |
Mishtiff
Member #15,776
October 2014
|
Ill be honest im not sure how to find it. I assumed that was the one, since i could get to it without being logged in |
pkrcel
Member #14,001
February 2012
|
might be as simple as bitbucket.org/mishtiff I'll have a look. It is unlikely that Google shares your distaste for capitalism. - Derezo |
Aikei_c
Member #14,871
January 2013
|
I haven't looked at it closely, by judging from this line: al_draw_rectangle(bb.center.x - bb.topLeft.x, bb.center.y - bb.topLeft.y, bb.center.x - bb.bottomRight.x, bb.center.y - bb.bottomRight.y, BaseColor, 1); You think that topLeft and bottomRight values are relative to the center. They shouldn't be. They should be absolute positions. If all of your bounding boxes are, like, (-15,-15) to (15,15) there is no wonder they all collide... Also, there is a mess in the Object class. You only need bounding box, that is all. You don't need any additional x, y, boundx, boundy, all this should be represented by your bounding box... |
Mishtiff
Member #15,776
October 2014
|
Yeah this seems to be the correct link i hope! https://bitbucket.org/mishtiff/basegame/src sorry if not. Aikei, I was just following your big post earlier i did do some profiling and found that all of my blocks were returning a -1.5 and 1.5 for their topLeft and Bottom right. I assumed it was a mistake i just havent fixed it in my coding yet. I wasnt aware until then that i needed to save the topLeft and bottomRight Vec2's as their actual position, and not just the bounding position. |
Aikei_c
Member #14,871
January 2013
|
Mishtiff said: I wasnt aware until then that i needed to save the topLeft and bottomRight Vec2's as their actual position I however told you that and even provided a method to move your actor: Aikei_c said: When you move your actor, you set its new position with the SetPosition() method. Which means, each time you change position of your object, due to its movement or anything, you use SetPosition(). No x = x+velx and that kind of shit! You only use SetPosition() method to set position, nothing else. And you don't need those boundx, boundy, x, y, etc. You already have your position. |
pkrcel
Member #14,001
February 2012
|
Just for the record, but how do you resolve collision? I see you get the result vector back but you don't seem to do anything with it apart from checking if it's size is bigger that 1. Anyway I can't seem to find a reasonable reason (ah!), or at least a not subtle one for a slowdown to happen. (apart from batching draw calls into a single al_draw_prim call of course...but that's not the point here I guess) I'll have to compile it myself, but I am unable right now.... EDIT: ah btw Aikei is right, your code needs further cleanup...at least for clarity, with this disorder one can't rule out some camouflaged gotcha in the code It is unlikely that Google shares your distaste for capitalism. - Derezo |
Mishtiff
Member #15,776
October 2014
|
@aikei yeah you did, I just have been so busy I haven't been able to spams the time needed to clean up my code. I do plan on talking away the unused x, y, bx, by. Sorry, I just wanted to get my code up so you could see where I am at now. I will program as much as I can tomorrow before work and post an update! |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I think what your code could use is a few more functions. You need to separate out functionality and purpose into smaller units that you can then combine. For example, Collision(), Cull(), CheckScore(), things like that. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Mishtiff
Member #15,776
October 2014
|
@Edgar of course, I just need to start working towards it. I just need to sit down and take the time to figure out how to pass the information around. But splitting my code up so that my game loop isn't a wall of text would be spectacular. As I said just before this, I'm trying to clean my code up, it's just hard to accomplish without messing something else up, or paying the right information. Something I'm learning to do |
pkrcel
Member #14,001
February 2012
|
Mishtiff said: I thought that by running the check through boost (where I send it the actors location and bounds) that it would return whatever classes with said object. It sure does, but as long as I am not missing something obvious you aren't doing anything to the collided objects, am I wrong? It is unlikely that Google shares your distaste for capitalism. - Derezo |
Mishtiff
Member #15,776
October 2014
|
Yeah that is correct, I was only checking to see if I had implemented the tree correctly by seeing how many objects were returning as collided UPDATE: I have fixed a bunch of code! Everything is running as intended. I did have to switch a couple lines, but we can talk about it once i get the code uploaded to gitbucket. Im still having some framerate drop, but its only 10-20 frames at most, so not too bad. It was handling 500 units at about 40 frames. So we just need to see if my collision detection code is too heavy. Still working on cleaning up my code, so i will not be updating it for at least another day or two. In the mean time, what are the commands to update my remote files with my local ones? I cant seem to find a solid answer (or at least, one that worked when i tried it). Thanks guys! |
Aikei_c
Member #14,871
January 2013
|
Mishtiff said: So we just need to see if my collision detection code is too heavy.
If your objects are rectangles, you probably don't need any other specific collision detection code, apart from the RTree. Also, make your Rects actual retangles, with width and height parameters instead of just size which makes them squares. Quote: In the mean time, what are the commands to update my remote files with my local ones? Commit, then push. Depending on the client you use, you probably need to select files first when commiting. |
|
|