Jump to content

Recommended Posts

Posted

Whenever I join another custom Dimension, the world loading takes a huge amount of time. Memory use is always low, but allocated takes full 100%.

The ChunkGenerator works the same way as the Overworld one, so that shouldn't be the problem. Also, nothing is logged in the console, only that the server is 

running huge amounts of ticks behind. 

 

https://github.com/Oeku/RPG-Mod/blob/master/src/main/java/net/zeldadungeons/world/medieval/CGMedieval.java

2018-01-09_00.28.37.png

2018-01-09_00.28.33.png

Posted (edited)

I checked this again and it seems to work just fine for Nether or end, but not the new dimension.

 

I teleport to this dimension by using World.Load event so I start there instantly after joining the world.

Edited by ArmamentHaki
Posted
25 minutes ago, ArmamentHaki said:

I checked this again and it seems to work just fine for Nether or end, but not the new dimension.

 

I teleport to this dimension by using World.Load event so I start there instantly after joining the world.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
28 minutes ago, Draco18s said:

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

And then fire another World.Load event, upon joining the new dimension.

I thought I was performing a check whether I was in overworld. However if that is true, wouldn't I be stuck in loading screen forever?

Posted
19 minutes ago, ArmamentHaki said:

However if that is true, wouldn't I be stuck in loading screen forever?

I am unsure about that.

Double check that you're only performing it in the overworld.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
56 minutes ago, Draco18s said:

I am unsure about that.

Double check that you're only performing it in the overworld.

I check whether the player is in overworld now. However,my problem stoll persists. Is this normal for a testing environment? At least I know from other mods that it is possible to have many dimensions without that kind of lag.

 

Edit: I realized that there are only few chunk updates taking place, mostly 0-10 and sometimes up to 30. In overworld, this amount is way higher.

Edited by ArmamentHaki
Posted

Not sure.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
2 hours ago, ArmamentHaki said:

I teleport to this dimension by using World.Load event

How many times have you stepped through this in the debugger to see what it's really doing? What did you discover?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted (edited)
14 minutes ago, jeffryfisher said:

How many times have you stepped through this in the debugger to see what it's really doing? What did you discover?

Debugger logs nothing special. I didn't inspect any fields as I didn't see anything wrong except for the lag. I printed out how many times a chunk event takes place and it looks like it is only happening once every 5-30 seconds.

But I have no idea what causes this lag, only thing I remember is that I had this same issue with another dimension in another project.

Edited by ArmamentHaki
Posted
18 hours ago, ArmamentHaki said:

Debugger logs nothing special. I didn't inspect any fields as I didn't see anything wrong except for the lag. I printed out how many times a chunk event takes place and it looks like it is only happening once every 5-30 seconds.

But I have no idea what causes this lag, only thing I remember is that I had this same issue with another dimension in another project.

jeffryfisher doesn't just mean using the actual debugger. He's suggesting that you take the normal debugging steps. Like profiling, printing to logger or console and such. How can people on a forum guess what is lagging your particular code? 

 

First off, you say that a chunk event is only happening once every 5 to 30 seconds. But you don't want to check how often a chunk event happens you want to check how long it takes to execute. Once every 5 seconds might actually be an indication of significant lag.

 

I think there is already some profiling (timing) code in some of the world generation, but you may need to add your own. Time how long each thing takes. If something takes too long then you've found the lag.

  • Like 1

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
2 hours ago, jabelar said:

jeffryfisher doesn't just mean using the actual debugger.

Actually I do. I want to see more people post what they see when they STEP line-by-line through their code (and affected vanilla code) surrounding mysterious run-time behavior. It's often quite illuminating. Inexplicable runtime behavior should send you to the debugger before it sends you here.

 

And yes, there are other debugging techniques to instrument your mod so you can learn what is happening inside of it.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted
6 minutes ago, jeffryfisher said:

Actually I do. I want to see more people post what they see when they STEP line-by-line through their code (and affected vanilla code) surrounding mysterious run-time behavior. It's often quite illuminating. Inexplicable runtime behavior should send you to the debugger before it sends you here.

 

And yes, there are other debugging techniques to instrument your mod so you can learn what is happening inside of it.

 

I agree. I said "just using the debugger" to imply still using it as well. The only issue I have with debugger as the primary tool is i find there are a lot of things I want to watch changing in real time (meaning in conjunction with me playing the game). If you've already got a strong suspicion about the area of code that is a problem then debugger is awesome, but if you're fishing for problems I prefer to sit back and watch logger. And honestly by the time I get a strong suspicion about an area of code the problem often becomes obvious by just looking at the code rather than needing to look at debugger. 

 

But the most important thing that I think both of us are saying is that people always post on this forum without doing ANY method of serious debugging. If you're debugging a lag problem, obviously you need to figure out what is taking the time. I don't know why people think others can magically figure it out without doing that same work which the author should have taken the time to do.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted (edited)
21 hours ago, jabelar said:

 

I agree. I said "just using the debugger" to imply still using it as well. The only issue I have with debugger as the primary tool is i find there are a lot of things I want to watch changing in real time (meaning in conjunction with me playing the game). If you've already got a strong suspicion about the area of code that is a problem then debugger is awesome, but if you're fishing for problems I prefer to sit back and watch logger. And honestly by the time I get a strong suspicion about an area of code the problem often becomes obvious by just looking at the code rather than needing to look at debugger. 

 

But the most important thing that I think both of us are saying is that people always post on this forum without doing ANY method of serious debugging. If you're debugging a lag problem, obviously you need to figure out what is taking the time. I don't know why people think others can magically figure it out without doing that same work which the author should have taken the time to do.

When modding, I often run into problems, and I use the debugger for e.g. methods that I created. But since I had this problem before and never knew what could be causing it, I thought I was doing something fundamental wrong whilst creating a dimension. Of course it is easier for more experienced people to know what cause these problems, so I thought I would post this. Before posting I usually invest hours of looking for the error and trying things out, and I am able to solve most things, but I still run into loads of things I don't know about.

 

 

Edited by ArmamentHaki
Posted (edited)

I looked into it again and found out that structure generation was taking the most runtime of all. However, even without the structure creation, I get heavy lags, which makes me think that the behaviour is related to overall generation(I believe that structures generally take long to generate compared to normal blocks). This means that I am still stuck on the problem. I researches it and a lot of posts said that it depended on whether you are in an environment or not, and it wouldn't be laggy after building the mod. However, wouldn't that mean that Overworld should be as laggy too?

Quote

If something takes too long then you've found the lag

The problem is that every single step in world generation takes too long, compared to Overworld, leaving me with guessing that there is something wrong in the World Provider. But how can I find out what is wrong if it isn't happening in the actual generation that I do?

Edited by ArmamentHaki
Posted

Okay, the other strategy in debugging is "isolating" the problem. Basically start with something that works and incrementally change it until you see what doesn't work. Like maybe start by copying all the vanilla stuff. Then do all the vanilla stuff but just add your structures. If that works, add your biomes, or whatever else. Basically create versions of the code in-between what works and doesnt' work until you narrow down which change is problematic. It can be a pain, but with some effort is a sure way to find a problem.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted (edited)
2 hours ago, jabelar said:

Okay, the other strategy in debugging is "isolating" the problem. Basically start with something that works and incrementally change it until you see what doesn't work. Like maybe start by copying all the vanilla stuff. Then do all the vanilla stuff but just add your structures. If that works, add your biomes, or whatever else. Basically create versions of the code in-between what works and doesnt' work until you narrow down which change is problematic. It can be a pain, but with some effort is a sure way to find a problem.

That is the exact problem, I was already only using the Overworld chunk generator(copy), as stated above, and it is laggy. It only works(still laggy) when I stop the Overworld generator from creating structures like the usual villages or mineshafts. That means that the problem is not the world generation taking place in my class itself, but something which isn't in the chunk generator. This is why I posted it, it is even laggy with the usual Generator, and I have no hints where to start looking after the problem.

Edited by ArmamentHaki
Posted
9 hours ago, ArmamentHaki said:

That is the exact problem, I was already only using the Overworld chunk generator(copy), as stated above, and it is laggy. It only works(still laggy) when I stop the Overworld generator from creating structures like the usual villages or mineshafts. That means that the problem is not the world generation taking place in my class itself, but something which isn't in the chunk generator. This is why I posted it, it is even laggy with the usual Generator, and I have no hints where to start looking after the problem.

 

Okay, except comparing your code to the vanilla Overworld chunk it seems you have some relevant changes. I expect that many of these are changes you've done while debugging but I just want to make sure. Some things that are different from vanilla:

- in the generateChunk() method you have removed all the parts where it generates most features like caves, ravines, villages, monuments, mineshafts, etc.

- in the populate() method you have removed the woodland mansion generation.

- your code has a method called getScatteredFeatureSpawnList() which in my Forge Reference Library seems to now be getMonsters(). I guess they changed that between your version of 1.12.2 and mine. 

 

None of the above should be an issue and I assume you probably did the removing of features as part of the debug, right?

 

Okay, looking further at your code, in your WPMedieval class you are associating a biome provider for a single biome that is your custom Generizer.MEDIEVAL. Since that isn't a copy of vanilla I wonder if your problem is actually with your biome stuff. I'm not that experienced in custom biomes, but I'd suggest greatly simplifying that as a debug step. Only register one biome and don't remove any vanilla, or maybe even just do nothing in terms of new biomes, and see if the problem still exists.

 

Now one thing that I always run into trouble with regarding world gen is that the relationship between classes is very convoluted. It is possible you're running into such trouble. For example in your WPMedieval you specify that the DimensionType is OVERWORLD, but if you look at OVERWORLD it is defined to have a WorldProviderSurface. In other words your world provider is pointing to a dimension type that says it has a different world provider. I have no idea if that is an actual problem, but doesn't seem "healthy". Frankly the way that the world gen classes over-reference each other can cause some weird things like that. You might want to try creating a custom DimensionType that properly points to your world provider and clean up any other such things you might find.

 

Similarly you might want to try making a custom WorldType instead of using the vanilla one because again it might have references to a different IChunkGenerator or other stuff that conflicts with your stuff.

 

You also have two custom IWorldGenerator classes registered. Have you tried isolating to see if they are causing trouble? -- like don't register them and see if issue goes away.

 

Also, in your IWorldGenerator classes you end up calling the CustomGenMinable class which extends the WorldGenerator class. So you're kind of mixing the Forge IWorldGenerator class with the vanilla WorldGenerator class. I don't know if that is a problem, but I think the idea is modders should use IWorldGenerator purely.

 

Just some ideas. 

 

 

 

 

 

 

 

  • Like 2

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
On 1/11/2018 at 8:11 AM, ArmamentHaki said:

The problem is that every single step in world generation takes too long

If one of those long steps includes a call to another method, then step INTO it instead of over. Drill down until you find yourself somewhere you shouldn't have gone (like loading and unloading huge piles of the same data again and again).

 

Do whatever it takes to get over your debugger-phobia. Stop making excuses; just get inside the bloody program to see what it's doing while it's doing it. Learn the features of the debugger so you can use it effectively instead of giving up with a vague "every step takes too long". What was it doing? Why didn't you step into the call(s) to see why? Get in there again and drill down until you find the problem.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted (edited)
On 12.1.2018 at 7:36 PM, jeffryfisher said:

If one of those long steps includes a call to another method, then step INTO it instead of over. Drill down until you find yourself somewhere you shouldn't have gone (like loading and unloading huge piles of the same data again and again).

 

Do whatever it takes to get over your debugger-phobia. Stop making excuses; just get inside the bloody program to see what it's doing while it's doing it. Learn the features of the debugger so you can use it effectively instead of giving up with a vague "every step takes too long". What was it doing? Why didn't you step into the call(s) to see why? Get in there again and drill down until you find the problem.

As i said I was doing that before, please believe it. Debugging stuff is what I need do most of the time anyways. It was as expected, the World Provider was causing problems, I just needed help to know what these errors were, and it was because the Provider was pointing to the Overworld Dimension Type. That was because the DimensionType can't be accessed directly but only by a method.

Edited by ArmamentHaki
Posted (edited)
1 hour ago, ArmamentHaki said:

 it was because the Provider was pointing to the Overworld Dimension Type. That was because the DimensionType can't be accessed directly but only by a method.

 

Cool. Yeah I really hate the convolution between all these classes. they have classes that point to each other, classes with similar names, and overall it is hard to tell what really matters. I find that going "full custom" (i.e. make your own version of everything) is safer than pointing to vanilla classes.

 

Glad you got it sorted out.

Edited by jabelar
  • Like 1

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.