Auburn's noise

    Auburn

    Game Developer
    Joined
    Feb 5, 2016
    Messages
    41
    Reaction score
    51
    Hi everyone!

    I'm a new(ish) member of Schine working as a game developer. Having recently finished my degree in "BSc (Hons) Computer Games (Software Development)" I've started working full time on StarMade.

    Over my last few years of coding I have become addicted to voxel environments and coherent noise generation, I have gone deeper and deeper into these technologies and learnt I huge amount on the way and it has become a passion of mine to work and innovate in every area possible. (See some of my projects here)

    My current main goal with StarMade is to improve on the performance and quality of the procedurally terrains and the recent upgrade to asteroids has been the first step I've been working on. I had originally planned on using the noise library I had written FastNoise but shortly after this I discovered the power of SIMD instructions and feel in love. This lead to my creation of FastNoise SIMD with a similar feature set as FastNoise but wielding the power of SIMD. This new library is what I have been integrating with the StarMade engine over the past few weeks and it is what powers the new faster generation of asteroids.

    Technical breakdown of how SIMD works and how I used it for noise generation:
    SIMD stands for Single Instruction Multiple Data, the simple explanation of this is instead of calculating numbers 1 at a time it allows groups of 4/8 numbers to be calculated at once while still being the same speed as doing it 1 at a time. In noise generation this equates to generating 4/8 voxels worth of noise at around the speed it would traditionally take to generate just 1.

    These SIMD instructions work on low level CPU codes and not all CPUs support the same codes so I had to build several levels of SIMD instructions into the noise library in order to support every CPU whilst also making use of the newer/faster SIMD instruction sets.

    The levels of SIMD support in FastNoise SIMD (slowest to fastest):
    • Scalar (no SIMD usage)
    • SSE2
    • SSE4.1
    • AVX2 & FMA3
    The fastest supported instruction set is detected at runtime to ensure unsupported codes won't run and crash the game (hopefully). With AVX2 being the fastest by a margin of around 100% if you are looking to host a larger server try to use a CPU supporting this. Finding out what SIMD support your CPU has can be done easily through programs such CPU-Z.

    As mentioned in the last update notes this SIMD code must reside in C/C++ due to it's low level interaction with hardware, so a native library has been used to link it with the Java code of StarMade. Unfortunately native libraries lack the portability of Java so I have been coding and testing them for the 3 main operating systems Windows, Linux and MacOSX. Since the update I have been trying to provide support and bug fixes to all the players with issues. While there have been some compatibility problems due to all the different Linux distributions and this being the first native library required to host a server, I feel that the benefit SIMD provides to the majority is something that opens new levels of possibility for the game in the future.

    Thanks to all for welcoming me into the community,
    feel free to ask/suggest/praise, I'll be watching this thread.
     
    Last edited:
    Joined
    Jun 22, 2013
    Messages
    1,183
    Reaction score
    614
    • Competition Winner - Stations
    • Competition Winner - Small Fleets
    • Legacy Citizen 10
    First off, glad to see you joining Starmade and already making major contributions to the game. Second, I was checking out your website and saw your spherical voxel planet... when can we expect this in Starmade? ;)
     
    Joined
    Jul 20, 2014
    Messages
    285
    Reaction score
    100
    Welcome man, great to see the shine team expanding. the new asteroids are freakin awesome! they have a much more realistic feel which is very much welcome. Cant wait to see what you have in store for us next! ^^
     
    Joined
    Jul 29, 2013
    Messages
    1,173
    Reaction score
    494
    • Competition Winner - Small Fleets
    • Top Forum Contributor
    • Legacy Citizen 5
    Amazing stuff. It's really cool to know that Schema brought on somebody with your very particular skillset.
     
    Joined
    Sep 10, 2014
    Messages
    226
    Reaction score
    398
    • Supporter
    • Master Builder Bronze
    • Competition Winner - Small Fleets
    Welcome Auburn.

    You really did a good job with the asteroids. The results set the expectations quite high for upcoming stuff. Do yourself a favor and don´t get too used to praises because the community can be quite critcal and there are always people who don´t like it. :P

    Starmade looks like the perfect game to use your skills. I´ve seen your voxel planet demo even before you were part of shine and already thought that it would fit. I was quite surprised when i realized that you are the the new dev guy. I hope you can contribute a lot to the game.

    Now to the question part. If you use SIMD for calculating more numbers at a time to ramp up the asteroid generation wouldn´t it be even better to use the GPU to process even faster? I mean GPUs are made for parallel calculations. Is there any reason to not use it?
     
    Joined
    Jun 27, 2013
    Messages
    896
    Reaction score
    166
    Since the update I have been trying to provide support and bug fixes to all the players with issues. While there have been some compatibility problems due to all the different Linux distributions and this being the first native library required to host a server, I feel that the benefit SIMD provides to the majority is something that opens new levels of possibility for the game in the future.
    Portability is a nice thing to have. I'm running an OpenBSD server, and until now Starmade ran stable and flawlessly... I haven't updated to the latest release there, so I can't yet tell how BSD likes the Linux binaries.
    With OS specific libraries, the fear never fully goes away that one day the single developer stops updating, the less popular versions usually die first. Looking at it from the bright side, do you (as a team) have any plans for ARM/ARM64 support?

    Cool stuff eh?
    Yes and no, bit of a mixed bag really, see above.

    there are always people who don´t like it
    Guess that would be me then... at least not unconditionally :)
     

    Auburn

    Game Developer
    Joined
    Feb 5, 2016
    Messages
    41
    Reaction score
    51
    Now to the question part. If you use SIMD for calculating more numbers at a time to ramp up the asteroid generation wouldn´t it be even better to use the GPU to process even faster? I mean GPUs are made for parallel calculations. Is there any reason to not use it?
    Calculating noise on the GPU has it's own set of problems, the main one being backwards compatibility, only newer GPUs support sending data back to the CPU. Sending data back is also very slow due to the GPU having to freeze the data so the CPU can copy it. The SIMD library supports back to SSE2 which was first introduced in 2001 so it is very unlikely that anyone won't have it and even if they don't there is a simple fallback to scalar types.

    Portability is a nice thing to have. I'm running an OpenBSD server, and until now Starmade ran stable and flawlessly... I haven't updated to the latest release there, so I can't yet tell how BSD likes the Linux binaries.
    With OS specific libraries, the fear never fully goes away that one day the single developer stops updating, the less popular versions usually die first. Looking at it from the bright side, do you (as a team) have any plans for ARM/ARM64 support?
    When the native library has become fully established it won't need changing too often, this means as long as we have access to a selection of Linux distributions even just through a VM we can simply compile a version for each. Currently I'm still making changes to the library and don't want to have to compile it on 10 different machines every time :P. I know that ARM have their own instruction sets for SIMD but it is not something I've looked into.
     
    • Like
    Reactions: MAVYKINS
    Joined
    Jun 26, 2013
    Messages
    5
    Reaction score
    1
    • Legacy Citizen 2
    Calculating noise on the GPU has it's own set of problems, the main one being backwards compatibility, only newer GPUs support sending data back to the CPU. Sending data back is also very slow due to the GPU having to freeze the data so the CPU can copy it. The SIMD library supports back to SSE2 which was first introduced in 2001 so it is very unlikely that anyone won't have it and even if they don't there is a simple fallback to scalar types.



    When the native library has become fully established it won't need changing too often, this means as long as we have access to a selection of Linux distributions even just through a VM we can simply compile a version for each. Currently I'm still making changes to the library and don't want to have to compile it on 10 different machines every time :p. I know that ARM have their own instruction sets for SIMD but it is not something I've looked into.
    More on this, there are close to zero affordable hosting services that support nodes with GPU's for high density solutions. The size of a GPU alone is about the same as a full dual processor blade. For dedicated hosting, this makes them very undesirable. If you want to go high density with GPU or Co-processor solutions, you have to order blade systems with specially designed packages for them that are exorbitant in cost. The number of cases where this type of use would be beneficial to Starmade players is practically nonexistent. The entire playerbase would benefit much more from Auburn dedicating his time towards implementing AVX instructions and similar optimizations for other game systems that almost all servers and players can benefit from.

    Further on the subject, ARM processors are not going to be in popular use or practical for hosting Starmade in the near future. If Auburn had to focus on hardware to make optimizations for, processors with AVX2 was entirely the right choice. I personally would like to see a priority for optimization of linux based systems. but any and all optimization for the game right now is desperately needed.
     
    Joined
    Jul 12, 2014
    Messages
    511
    Reaction score
    57
    • Purchased!
    • Legacy Citizen 5
    Well, I can only say, Auburn, this looks very very promising and welcome to the hopefully ever growing StarMade family. ;)

    Also nice to read through some real C/C++ code in this Java universe. :D

    Greets,

    Jan
     
    Joined
    Feb 1, 2016
    Messages
    299
    Reaction score
    84
    ooooh! you like terrain things...
    So will you be working on making less ugly planets then? :D
     

    Auburn

    Game Developer
    Joined
    Feb 5, 2016
    Messages
    41
    Reaction score
    51
    I personally would like to see a priority for optimization of linux based systems. but any and all optimization for the game right now is desperately needed.
    What kind you Linux focused optimisations would you be referring to?
     

    Crimson-Artist

    Wiki Administrator
    Joined
    Sep 10, 2013
    Messages
    1,667
    Reaction score
    1,641
    • Video Genius
    • Competition Winner - Stations
    • Wiki Contributor Gold
    yo Auburn thanks for the new asteroids. Are you gonna work on fixing some of the procedural generated structures? like cities on Terran planets and pyramids on desert planets? when they spawn they are pretty weird atm.
     
    Joined
    Jun 30, 2015
    Messages
    50
    Reaction score
    18
    • Purchased!
    • Community Content - Bronze 1
    I was wondering who was behind that wonderful update. I can't wait to see what you can do with planet generation.
     
    Joined
    Aug 5, 2013
    Messages
    405
    Reaction score
    140
    • Community Content - Bronze 1
    So...basically if I am upgrading my PC.
    For starmade optimize, I should go for....

    i7-6700k $344
    z170 board $140
    1070 $550
    total $1034

    instead of
    i5-6500 $206
    H170 board $100
    1080 $890
    total $1196

    Go all money on cpu first?
     

    Auburn

    Game Developer
    Joined
    Feb 5, 2016
    Messages
    41
    Reaction score
    51
    So...basically if I am upgrading my PC.
    For starmade optimize, I should go for....

    i7-6700k $344
    z170 board $140
    1070 $550
    total $1034

    instead of
    i5-6500 $206
    H170 board $100
    1080 $890
    total $1196

    Go all money on cpu first?
    The i5 will still be plenty powerful enough and supports the same SIMD instruction as the i7. The whole point of these optimisations is that you don't need such a powerful CPU to run a server.