Use the GPU

    Valiant70

    That crazy cyborg
    Joined
    Oct 27, 2013
    Messages
    2,189
    Reaction score
    1,168
    • Thinking Positive
    • Purchased!
    • Legacy Citizen 4
    Starmade doesn't seem to make any use of the $300 GPU in my gaming rig. If it did, the number of blocks I could render at good frame rate would be greatly increased. CPU-only rendering works for Minecraft, but unless you're going to emulate the quality of Minecraft's rendering and per-block lighting, it's not going to cut it for a space voxel game. It works, sort of, but it doesn't begin to compare to other similar games.

    I don't know all of the challenges associated with GPU use. Chances are the game would need a whole new rendering engine. If that's what it takes, that's what the game needs. Maybe not now, but probably before beta.
     
    • Like
    Reactions: alij331
    Joined
    Jan 28, 2015
    Messages
    492
    Reaction score
    149
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen 3
    Starmade doesn't seem to make any use of the $300 GPU in my gaming rig. If it did, the number of blocks I could render at good frame rate would be greatly increased.

    You are mixing a few things. StarMade is a "real" game not virtual. Everything you see is computed in real time by the CPU with very complex calculations.

    Frame rate IS done on your Graphics Card and a stronger Graphics Card will give you a higher frame rate. But it will not and can not help you to load the chunks faster.

    There is one comfort though as future newer CPU's get stronger so they can handle StarMade better. As such StarMade is future proof. If StarMade made better use of todays CPU multi cores then that would help drive performance a head much faster.
     
    G

    GDPR 302420

    Guest
    Absolutely agree with this, running calculations for a game using a CPU just isnt going to cut it.

    Schine seem to be extremely resistant to the very idea of multithreadding, I wonder if they will be resistant to using the GPU as well? :thinking:
     

    JumpSuit

    Lost-Legacy Director
    Joined
    Feb 5, 2015
    Messages
    343
    Reaction score
    93
    100% Agree with all posts within this thread. 'Nuf Said.
     

    PLIX

    Thats XCOM baby!
    Joined
    May 17, 2016
    Messages
    113
    Reaction score
    38
    What spec pc (an R5 cpu with a Polaris card runs it on max everything with above 60 FPS even when loading large ships)
     
    Joined
    Jun 20, 2013
    Messages
    2,827
    Reaction score
    1,181
    • Video Genius
    • Legacy Citizen 4
    • Top Forum Contributor
    Ummm, my Vega 64 goes to 100% when big ships are being rendered.
     

    Valiant70

    That crazy cyborg
    Joined
    Oct 27, 2013
    Messages
    2,189
    Reaction score
    1,168
    • Thinking Positive
    • Purchased!
    • Legacy Citizen 4
    Ummm, my Vega 64 goes to 100% when big ships are being rendered.
    Well... that's interesting. My GPU is showing activity now. It never used to while I was running Starmade. It used to behave exactly like Minecraft.
    [doublepost=1512582306,1512582068][/doublepost]
    It's all very inefficient it seems.
    Well yes. It certainly seems that way. I don't know exactly how much of that is the program's fault and how much is the sheer number of voxels this game uses. Minecraft uses more blocks, sure, but its lighting is infantile compared to Starmade. I really would like to see a breakdown of the factors limiting graphics performance in the game right now.
     

    Exozen

    C-D SOLDIER
    Joined
    Jul 7, 2013
    Messages
    151
    Reaction score
    230
    • Purchased!
    • Competition Winner - Small Fleets
    • Legacy Citizen 4
    Absolutely agree with this, running calculations for a game using a CPU just isnt going to cut it.

    Schine seem to be extremely resistant to the very idea of multithreadding, I wonder if they will be resistant to using the GPU as well? :thinking:
    Feels like MultiThreading has been the future of rendering and computing for a decade or so now, it's completely insane that anyone would choose to make their game so intentionally obsolete


    Also, it's sad that even with the stuff rendered on CPU, everything still looks like shit
     
    Last edited:
    Joined
    Aug 25, 2013
    Messages
    180
    Reaction score
    43
    The GPU is certainly being used. My GPU and VRAM is maxed out while running StarMade.
     

    schema

    Cat God
    Joined
    Feb 17, 2012
    Messages
    1,552
    Reaction score
    2,604
    • Schine
    Absolutely nothing is rendered on the CPU in starmade. Everything is rendered on the GPU. It even uses the GPU extensively to unpack vertices. Else the chunks would take up a huge amount of space more in VRAM. If you like you can check that in the data/shader/cube directory. The only thing that is done on the CPU is precalculating the lighting (which is done multithreaded), it doesn't render it. it simply calculates the accumulated lighting for blocks. The GPU handles the actual light and renders it. This is only done once and then doesn't have to be done again until there is a change in the chunk. This saves a huge amount of processing, especially with a huge amount of lights. One major problem of doing lighting on the GPU is that while it looks nice, it cannot support hundreds of lights very easily. What I'm aiming for in the future is a hybrid system where it would use precalculation only for things that are far enough away to not matter, and use nicely looking deferred lighting close up. I opted for the more performant approach for now (especially for older systems). Precalculation is planned to be moved into the C++ section of the code also to further optimize it.

    As for multithreading itself, starmade makes use of multithreading in a lot of areas. These include loading/generating chunks and calculating the grouping, as well as a lot of multiplayer code to receive and send. I will extend that as much as can to physics and other things, but there is a common misconception with multithreading: You cannot just put something into threads and expect it to run faster if it is a procedure that depends on other things to be synchronized. In this case the amount of processing that would go into synchronizing the threads alone would make multithreading slower. This is why some things cannot be multithreaded, and other things are extremely hard to multithread.
     
    • Like
    Reactions: alij331
    Joined
    Mar 30, 2013
    Messages
    729
    Reaction score
    281
    • Purchased!
    • TwitchCon 2015
    • Legacy Citizen 5
    Hey schema are there any config file changes that players with high-end GPUs & CPUs can do to possibly get more performance? Like modifying chunk request pool, G_VBO_BULKMODE_SIZE, etc?
     

    schema

    Cat God
    Joined
    Feb 17, 2012
    Messages
    1,552
    Reaction score
    2,604
    • Schine
    You can increase the bulk mode size, and it would help in a specific area, although i doubt that it is your bottleneck.

    Most optimizations for newer GPUs I'll implement at later stages. My first goal was to make it compatible, and then to add all the specific upgrades that newer cards support. The new update has some of them, and there are a lot more to follow.

    There will be a new level of detail system coming to allow faster rendering for huge amounts of blocks.
     
    Joined
    Jul 10, 2013
    Messages
    626
    Reaction score
    486
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 7
    I've seen the changes lately in the dev builds.
    I use AMD A10-5800K APU with Radeon(tm) HD Graphics × 4 and 8GB of ram on linux to render all of my graphics and i've dropped to around 25 fps where i was at 55 pre dev. And i run low graphics details on the game with fast lighting.
     

    schema

    Cat God
    Joined
    Feb 17, 2012
    Messages
    1,552
    Reaction score
    2,604
    • Schine
    kikaha you get less fps now in the dev build? Are you using antialiasing?

    A drop like that shouldn't happen. It should be faster if anything. Be sure to avoid checking in build mode, since for a few versions the added GUI things had a bit of an impact on graphics in buildmode.
    There are a lot of factors though that might cause this. In the new version there was definitely nothing added that would take more power to render, so this must be a bug of some sort. If this persists, please contact Lancake so we can make some tests to fix this.
     
    • Like
    Reactions: alij331

    Valiant70

    That crazy cyborg
    Joined
    Oct 27, 2013
    Messages
    2,189
    Reaction score
    1,168
    • Thinking Positive
    • Purchased!
    • Legacy Citizen 4
    Absolutely nothing is rendered on the CPU in starmade. Everything is rendered on the GPU. It even uses the GPU extensively to unpack vertices. Else the chunks would take up a huge amount of space more in VRAM. If you like you can check that in the data/shader/cube directory. The only thing that is done on the CPU is precalculating the lighting (which is done multithreaded), it doesn't render it. it simply calculates the accumulated lighting for blocks.
    It wasn't always like this was it? My GPU redlines in the dev builds, but I don't think it was really doing much previously, just like Minecraft. When I get a chance, I'm going to grab a massive build off the dock for testing and load it up in a few different versions. Maybe I'm not remembering correctly, or there was something weird with my GPU monitor. In any case when I loaded the game up with a planet yesterday, it was working better than I remembered.

    One major problem of doing lighting on the GPU is that while it looks nice, it cannot support hundreds of lights very easily. What I'm aiming for in the future is a hybrid system where it would use precalculation only for things that are far enough away to not matter, and use nicely looking deferred lighting close up.
    That sounds like a really good idea.

    Precalculation is planned to be moved into the C++ section of the code also to further optimize it.
    Shouldn't all of the rendering ideally be handled in C++?

    In this case the amount of processing that would go into synchronizing the threads alone would make multithreading slower.
    Yeeeaah... And I'm guessing the overhead from Java isn't helping matters?

    You can increase the bulk mode size, and it would help in a specific area, although i doubt that it is your bottleneck.
    Do you know of any settings that I should change to help maintain frame rate with massive numbers of blocks on an AMD Radeon RX 580?
     
    • Like
    Reactions: JumpSuit

    schema

    Cat God
    Joined
    Feb 17, 2012
    Messages
    1,552
    Reaction score
    2,604
    • Schine
    StarMade always used hardware rendering with OpenGL. You can check the same shaders in older versions ranging back to the very early days of the game. Minecraft also never used software rendering as far as I know. At the very start they used an older way to draw things in openGL (Display lists), which may not be the best for huge amounts of vertices, but to my knowledge they never used software rendering.

    StarMade's rendering is done on the GPU, so the programming language used is pretty much irrelevant for performance (unless there is a bottleneck with too many calls, which would affect all languages).

    Basically what you do is load things onto the graphics cards (e.g. chunks, textures etc), and then tell the graphics card to render it (specified by openGL settings and the shaders used). These are relatively simple calls like glBindTexture or glDraw*, which are sent directly to the driver. All the actual processing and rendering of graphics is done by the hardware, so at that point, the language used to make the calls doesn't matter, since they all speak directly to the same library (in StarMade's case OpenGL).

    Software (CPU) rendering would be the slowest thing in pretty much any thinkable way, and you would probably not even get more than a fraction of a frame per second with it. Not only that, but you also would have to actually reimplement a core graphics library like openGL or directX into software which would be insane. So even if I wanted to, I couldn't even use software rendering.

    In terms of synchronization of threads, it's also not really about the programming language. If synchronization is taking so much that it becomes a problem it doesn't matter what language you use, even if that other language would be technically faster. It's still a bottleneck that would slow down in the end. This is the case for a lot of other things in general. In projects of this scale, the speed of the language itself matters less and less, because the performance is determined by bottlenecks. In small benchmarks it's easy to see a difference in language performance. In millions of lines of code, it is no longer that easy.

    What you probably experienced are things that bottlenecked the CPU in the past, causing your GPU to have less to do. A lot of these things have been removed, and more will come. A simple example would be switching from a chunk size of 16 to 32. Since this means 8 times less chunks it allowed processing the pure amount of chunks much more quickly, removing bottlenecks for huge amounts of chunks iterated through on the CPU. This made the game a lot less CPU bound and therefore you would experience a speed up, since generally gaming PCs focus more on GPU than on CPU for good reasons.

    The game is still very CPU bound in a lot of regions, simply because of its nature: Fully editable vast amount of blocks with a dynamic block level physics. Compared to first person shooters that have mostly static geometry it is a completely different requirement. A lot of the things we did in the game was widely uncharted territory at the time. There haven't been any established 'this is how it's fastest' ways of doing things in a lot of cases.

    As for settings, there has been another set of small improvements for the new version. The new LoD system will be part of the universe update which will likely be one of the biggest single boosts to performance.


    All I can say is that I will continue to improve the performance. The game was written in a way that things can be switched to c++ if it makes sense, and things can be multithreaded if it makes sense. A lot of these things are planned for the beta, because once they are switched, changes will take a lot longer. And there are optimizations to be made that will have a much bigger benefit than a switch will ever have. So I rather do those first, and then switch in the end to squeeze out that little bit of extra performance.

    My current goal is to develop features and at the same time keep bugfixing and improve the performance. Once the main features are complete, the focus will then completely shift onto performance and fixing, but also to make the game look better on higher end systems.
     

    Ithirahad

    Arana'Aethi
    Joined
    Nov 14, 2013
    Messages
    4,150
    Reaction score
    1,330
    • Purchased!
    • Top Forum Contributor
    • Legacy Citizen 8
    LoD for lighting, LoD for entity rendering, LoD for all the things! Awesome! \o/

    Good to know that these things are still planned.
     
    • Like
    Reactions: Valiant70

    JumpSuit

    Lost-Legacy Director
    Joined
    Feb 5, 2015
    Messages
    343
    Reaction score
    93
    I still have hope for StarMade, need proof of that? I Pre-Ordered it (y)
     
    • Like
    Reactions: MacThule