Anuken / Mindustry-Suggestions

Repository for Mindustry suggestions and feedback
131 stars 58 forks source link

[QoL] Show lights from night sectors in planet overview for aesthetic purpose #2090

Closed regymm closed 3 years ago

regymm commented 3 years ago

Describe the content or mechanics you are proposing. It would be nice to be able to see lights coming from those captured sectors with factories at night, in the planet overview. Just like what one could see on an airplane passing through big cities at night.

Describe how you think this content will improve the game. If you're proposing new content, mention how it may add more gameplay options or how it will fill a new niche. This will make the planet overview more colorful and makes it better to see a bigger picture of how everything's going on in each sector.

Before making this issue, place an X in the boxes below to confirm that you have acknowledged them. Failure to do so may result in your request being closed automatically.

    • [x] I have done a quick search in the list of suggestions to make sure this has not been suggested yet.
    • [x] I have checked the Trello to make sure my suggestion isn't planned or implemented in a development version.
    • [x] I am familiar with all the content already in the game or have glanced at the wiki to make sure my suggestion doesn't exist in the game yet.
    • [x] I have read README.md to make sure my idea is not listed under the "A few things you shouldn't suggest" category.
Newguy-ish commented 3 years ago

have you considered lag, data and other performance related things?

Sky4ce09 commented 3 years ago

have you considered lag, data and other performance related things?

depending on how it would be implemented (if at all) performance issues could be very unlikely, as not every block's light would be represented (that would be ridiculous)

joshuaptfan commented 3 years ago

Sectors do not run while you are not in them, for performance reasons. That means that while you are looking at the planet map, no sectors are running.

Their states are saved when you leave, and some basic things are simulated based on their last stats (resource production, enemy waves) without running the sectors.

marky0470 commented 3 years ago

I think OP meant this would be purely for aesthetics

joshuaptfan commented 3 years ago

The planet map cannot display the actual maps, it is more like a grid of links to each map. Even if you overlaid a thumbnail of each map on each sector (nevermind the huge amount of processing required to update all of those thumbnails according to their current exposure to the sun), it would look bad aesthetically, as maps are rectangular, but sectors on the planet map are hexagons or pentagons.

However, if you are talking about just generating some fake lights on nighttime sectors on the planet map based on the number of your/enemy buildings in that sector, that might be possible.

stoneRdev commented 3 years ago

I think generating fake lights based on building count is a good idea. It would make the planet screen much more visually appealing. But I'm not sure if lights should show for undiscovered sectors, might give away a enemy base you haven't discovered yet

stoneRdev commented 3 years ago

Maybe something like:

//in psuedocode
for(sector : map)
    if ( sector.renderHint == cull ) continue
    if ( sector.discovered == false ) continue
    generateFactoryLights( sector.player.buildings.count + sector.enemy.buildings.count )

where generateFactoryLights just samples some noise over a threshold and applies a mask to the sectors texture, or however would work

stoneRdev commented 3 years ago

I might just see if I can implement this, though I've never even looked at the source for this. I'll see if I can find the class that renders the planet view

joshuaptfan commented 3 years ago

You would have to modify the campaign save data to store building count for each visited sector. It would not be possible to get this count for sectors you have not visited before the implementation of this feature, even if you had previously captured them.

stoneRdev commented 3 years ago

Hmm, I didn't think about the need to store it. I figured the data would be there since the game already knows what buildings are in a sector, I figured one could just load the sector say headlessly and loop over the buildings. Maybe is it does need to be saved, it can be looped over once and have that data generated. I'm not sure honestly, I've only looked at this code for about 2 minutes now, and I know you probably have loads more experience with this codebase

stoneRdev commented 3 years ago

Well, I'll probably be better off not trying to implement this and leaving it to someone better suited. If there's any help needed, point me to it

joshuaptfan commented 3 years ago

Another solution is to not even try to get a building count, given the difficulty of doing so, and just fudge a lightDensity number based on production stats and enemy base presence, which are already available.

stoneRdev commented 3 years ago

Another solution is to not even try to get a building count, given the difficulty of doing so, and just fudge a lightDensity number based on production stats, which are already available.

Brilliant. That would also give the effect of no production = no lights even if there are loads of buildings, which I rather like the sound of

stoneRdev commented 3 years ago

@joshuaptfan Sorry for asking you directly, if you could point me to what class these production stats are stored in and what class renders the hexagons on the planet, maybe I could implement this. I was already working on a sort of alpha map generator that generates the random light spots based on a single input number to post here for anyone that wanted to pick it up. And on that note tho, I know Mindustry has a noise generator somewhere for map generation, maybe that could be hijacked for this purpose

stoneRdev commented 3 years ago

Or, maybe more efficient depending on factors I'm unaware of, an OpenGl 2d light map with a random radial sample in the limits of the sectors pixel size. Then OpenGl can work on fading the lights on a few points rather than an intensive noise loop generating it all. Any thoughts on that?

joshuaptfan commented 3 years ago

https://github.com/Anuken/Mindustry/blob/master/core/src/mindustry/type/Sector.java https://github.com/Anuken/Mindustry/blob/master/core/src/mindustry/ui/dialogs/PlanetDialog.java https://github.com/Anuken/Mindustry/tree/master/core/src/mindustry/graphics/g3d

stoneRdev commented 3 years ago

@joshuaptfan much appreciated!

stoneRdev commented 3 years ago

oof, laptop doesn't have the free space to pull. I'll start working on this tomorrow when I get home

Bohaska commented 3 years ago

O-O Someone actually tries to make a pr for his feature requests

regymm commented 3 years ago

Thanks for your kind replies. This suggestion is indeed for aesthetics.

Having a way to get an overview of what is built in each sector is another good thing to have(I often found myself clicking on sectors one-by-one to find out the desired one -- I haven't played for long though, just discovered plastinium and thorium), but would be a totally different suggestion.

itcannotbe commented 3 years ago

You might want to change the title of the suggestion consideringthe direction of the suggestion is going to.

SheepCommander commented 3 years ago

I do like this idea, I personally cannot see any actual purpose, but it does sound like a cool aesthetic feature

github-actions[bot] commented 3 years ago

This suggestion is now stale, and will be automatically closed.