ospaceteam / outerspace

Outer Space is turn-base 4X multiplayer on-line strategy game.
GNU General Public License v2.0
20 stars 10 forks source link

Max Scanner effective radius overlay causes graphic update lags at ridiculously high values. #172

Closed temuchin- closed 6 years ago

temuchin- commented 6 years ago

Seems building deep space scans scales up insanely, to the point it becomes easy to make an effective scanner radius of a really large number, exceeding the radius of the galaxy by a ridiculous amount. Discovered this by playing the pirate race (very useful for finding the breaking points in the game). Had them Deep space scan (actual production is 55K +) for a while on autobuild. Became unable to pan / move around / select a planet as each click was accompanied by 30 seconds of delay while writing display updates. Turned off scanner overlay & everything worked except for moving ships, which also had a 30 second delay when attempting to issue an order.

I can not imagine actual scan radius needing to be more than 2 times the galaxy radius, Nor the effective radius overlay being the same way. Maybe define an upper limit on scanner radius value?

--- Can attach a self contained game data file (server & client files @ 56 MB) if you ask (slow connection)

temuchin- commented 6 years ago

"Python int too large to convert to C long" so 2,147,483,647 to 9,223,372,036,854,775,807 is the maximum scanner radius value.

Yes we need to bound scanner radius to 1.5 to 2 galaxy radii *(which should be less than 2Billion). If the radius boundary gets too large it crashes the client, even if scanner area drawing option is off. Problem Identified !!!! Solution, tentatively fingered.

dahaic commented 6 years ago

Ah, did I forgot to comment ,when I was closing the other one as a duplicate? Darn. Sorry for that.

This is simply a display bug. Because of how the optimization during scan evaluation is made, we cannot have scans spanning more than some 20 parsecs, if I am not mistaken. So your scan, effectively, won't even span across whole galaxy.

But the right solution in this case is to prevent multiplication of deep space scan.

temuchin- commented 6 years ago

it is more than a display bug. If you jack the deep scan up to over 200K ish, the client never will start, it begins to calculate the scan multiplier & pukes at trying to convert the int to C long int.

With that said, yeah stopping / limiting scan multiplication is a must. (this also leads into a need to revisit how scanning currently works vs what it is meant to do vs how you desire it to function.) Right now 5k production & even spread of scanners, pooof you see the whole galaxy. Conversely you can only do morale improvement on a local level making it never worth using.

Ahem as said yeah that will be tackled later & elsewhere.

temuchin- commented 6 years ago

A snippet of the client thrashing like a corpse (note the error keeps repeating, kinda zombiesque)

2018-05-18 14:34:30 DBG -- Processing exception 2018-05-18 14:34:30 WAR -- OSCI Exception in event loop

Traceback (most recent call last): File "/home/frank/Downloads/Empires_and_Influence_Work/outerspace-0.5.72-testingvideoresolutionsonclient/client/main_client.py", line 403, in runClient update() File "/home/frank/Downloads/Empires_and_Influence_Work/outerspace-0.5.72-testingvideoresolutionsonclient/client/main_client.py", line 114, in update rects = gdata.app.draw(gdata.screen) File "/home/frank/Downloads/Empires_and_Influence_Work/outerspace-0.5.72-testingvideoresolutionsonclient/client/pygameui/Application.py", line 277, in draw rect = window.draw(surface) File "/home/frank/Downloads/Empires_and_Influence_Work/outerspace-0.5.72-testingvideoresolutionsonclient/client/pygameui/Window.py", line 90, in draw changed = MetaWidget.draw(self, self.surface) File "/home/frank/Downloads/Empires_and_Influence_Work/outerspace-0.5.72-testingvideoresolutionsonclient/client/pygameui/MetaWidget.py", line 135, in draw rect = widget.draw(self._widgetSurface) File "/home/frank/Downloads/Empires_and_Influence_Work/outerspace-0.5.72-testingvideoresolutionsonclient/client/osci/StarMapWidget.py", line 150, in draw mapSurf, self._actAreas, self._actBuoyAreas = self.star_map.draw(mapSurf) File "/home/frank/Downloads/Empires_and_Influence_Work/outerspace-0.5.72-testingvideoresolutionsonclient/client/osci/StarMap.py", line 674, in draw self.drawScanners(mapSurf) File "/home/frank/Downloads/Empires_and_Influence_Work/outerspace-0.5.72-testingvideoresolutionsonclient/client/osci/StarMap.py", line 719, in drawScanners pygame.draw.circle(mapSurf, (0x00, 0x00, 0x60), (sx, sy), currRange, 2) OverflowError: Python int too large to convert to C long

2018-05-18 14:34:30 DBG -- Processing exception 2018-05-18 14:34:30 WAR -- OSCI Exception in event loop

adnosium, adnosium

dahaic commented 6 years ago

I have fixed it by introducing scanner power cap. I have set it to 150 (this is after EMR, thus hard limit), which is the same as fully upgraded High Energy scanner Human has on TL6. I feel that bigger scanner span would produce silly results.

In general, my best experience with Outer Space was when confronted with unknown. And I would like to make the unknown part of design. Thus this limitation is in line with that. (And yeah, I know scout waves needs to be dealt with as well)