Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Optimizing worldgen XYZ directions
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
moronwmachinegun

Optimizing worldgen XYZ directions

By moronwmachinegun, November 3, 2017 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

moronwmachinegun    1

moronwmachinegun

moronwmachinegun    1

  • Tree Puncher
  • moronwmachinegun
  • Members
  • 1
  • 4 posts
Posted November 3, 2017 (edited)

Hello,
  I am looking at orevein generation performance in GT5U.  Currently I am seeing numbers around 100-300ms to fill an orevein. 

I have pulled the logic into a standalone test harness, and it seems to run fairly fast, about 600uS to fill a vein (without 
any minecraft-related function calls, just randomization and loop control). I have optimized that a little, shaving off about 
60uS, but that's clearly not where the major culprit is located.

 

I was wondering if anyone has done any performance comparisons on how to step through a chunk.  Based on my read of
https://minecraft.gamepedia.com/Chunk_format it seems like doing a full Y layer at a time is the most CPU cache-friendly 
since you wouldn't jump up and down between sections.  Also, it would be ideal to order XZ so that the memory accesses
are linear and won't cause cache collisions (TMI: http://www.aristeia.com/TalkNotes/ACCU2011_CPUCaches.pdf). The current code
does looping as

  • for X
    • for Z
      • for Y

so there might be some benefit to swapping Y to the outermost loop. And possibly a benefit to swapping order of X and Z.

 

It might all be re-arranging deck chairs on the Titanic though.  My suspicion is that the major time-sink is turning the victim block into a tile entity. I'm going to try adding some measurement code to see how much of the overall time is spent doing that.  If that's the case, there isn't much to really do except lower the number of blocks converted by making veins smaller, reducing their density, or optimizing World.setBlock().

 

Also, if anyone has a more fleshed-out command line test harness for worldgen, that would be great (a fake chunk would be awesome). The variance when
testing in-game is so high it's hard to tease out if improvements actually matter.  If not, can someone point me to the Chunk class file so I can make a better simulation?

Thanks for any help!

Edited November 3, 2017 by moronwmachinegun
  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Choonster    1624

Choonster

Choonster    1624

  • Reality Controller
  • Choonster
  • Forge Modder
  • 1624
  • 5050 posts
Posted November 3, 2017
6 hours ago, moronwmachinegun said:

 If not, can someone point me to the Chunk class file so I can make a better simulation?

 

You should have the Minecraft and Forge source code available in the forgeSrc-<version> referenced library, so you can either browse to the Chunk class inside of it or use your IDE's Navigate To Class (IDEA, Ctrl+N)/Open Type (Eclipse, Ctrl+Shift+T) feature to open the Chunk class directly.

  • Quote

Share this post


Link to post
Share on other sites

moronwmachinegun    1

moronwmachinegun

moronwmachinegun    1

  • Tree Puncher
  • moronwmachinegun
  • Members
  • 1
  • 4 posts
Posted November 4, 2017

Thanks, I'll give that a shot.

  • Quote

Share this post


Link to post
Share on other sites

moronwmachinegun    1

moronwmachinegun

moronwmachinegun    1

  • Tree Puncher
  • moronwmachinegun
  • Members
  • 1
  • 4 posts
Posted November 17, 2017

Well, I decided i didn't want to have to re-implement half of Minecraft just so I could set a XYZ value, so I just make my fake "chunk" be an array of ints.  I have placed my "fake" oregen command-line simulation code up on my Github at https://github.com/richardhendricks/GT-standalone-oregen if it is of interest to anyone.

 performancetest.java has the basic skeleton of what I needed.  There are a couple of sample tests in there, one using a non-chunkified worldgen to generate ores, one using a chunkified worldgen that remembers generated oreveins in a hashtable, and a chunkifed GT stone boulder generator that has random XYZ dimensions skewed towards making skinny pipes instead of bland round balls. The printout is very primitive, just a text printout of the chunks.

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • DaemonUmbra
      Forge 28.1.10 won't show on launcher + 28.1.0 fails to work

      By DaemonUmbra · Posted 5 minutes ago

      Where are you looking in the launcher? I suspect you are looking at Profiles/Installations rather than Versions
    • Simon_kungen
      [1.14.4] Sync ItemStack Capability Data + Multi-Capability Provider casting error

      By Simon_kungen · Posted 14 minutes ago

      So yeah... looks like none of my questions has been answered lately. Should I give up on capabilities for now?
    • TheGreenSquarez
      Forge 28.1.10 won't show on launcher + 28.1.0 fails to work

      By TheGreenSquarez · Posted 53 minutes ago

      here's the screenshot.
    • TheGreenSquarez
      Forge 28.1.10 won't show on launcher + 28.1.0 fails to work

      By TheGreenSquarez · Posted 55 minutes ago

      I'm quite sure it just updated to the latest version.
    • DragonITA
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA · Posted 1 hour ago

      Ok, i want try Something, pls wait.
  • Topics

    • TheGreenSquarez
      4
      Forge 28.1.10 won't show on launcher + 28.1.0 fails to work

      By TheGreenSquarez
      Started Yesterday at 11:21 AM

    • Simon_kungen
      1
      [1.14.4] Sync ItemStack Capability Data + Multi-Capability Provider casting error

      By Simon_kungen
      Started 23 hours ago

    • DragonITA
      33
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA
      Started Monday at 10:06 AM

    • jun2040
      1
      Game crashing when the block is activated

      By jun2040
      Started 1 hour ago

    • Prasodym
      7
      produces unregistered item minecraft:wooden_door

      By Prasodym
      Started April 28

  • Who's Online (See full list)

    • DaemonUmbra
    • Cerandior
    • Choonster
    • Simon_kungen
    • DragonITA
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Optimizing worldgen XYZ directions
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community