Hello Simon,
On Day 75, the stairwell was added. I noticed that in my MoveEntity
I had added a check to ensure the colliding entities had the same Z coordinate. However, I had to remove this check for the SpeculativeCollide
to work.
Now, my hero collides with walls in the layers above and below the layer he is on because the TestWall
function only checks in X and Y. I am not sure how in the actual Handmade Hero code this is not happening. Ill just compile the code I got from the pre-order and step through that to figure out how its avoiding this.
I had a guess that the way I'm constructing the SimRegion
is wrong. Do you by any chance happen to remember or just know how thick the simulation region was in the z direction? For me it goes thick enough to grab entities from the layers above and below. I think the bug must be there, because it doesn't probably make sense to grab entities from the other layers. I get 5 chunk layers from above and below (total 10 layers). If this is the intended volume, can you tell me why it was made like that?
Also, can you tell me what the SpeculativeCollide
was doing here?
(AbsoluteValue(Mover->P.Z - Ground) > StepHeight) // StepHeight = 0.1f
Does this mean to say: "If the hero has not moved a lot in the z-direction then collide with the stairwell". With the intent that if you are on the floor, then you have not moved in z and should collide. If you enter from the ends, you will be moved due to the lerp in z and will not collide. Basically then this is saying, turn off collision with stairwell when there has been movement in z-direction during the collision loop. So I could possibly jump into the stairwell from the side?
Actually Simon, I think that issue exists in the original codebase too. I compiled the day75 code from the pre-ordered files
I am not able to get out of that opening to the right when Im in the layer above 0. And I think its because its colliding with the walls in the layer below.
For my code, in the random numbers I generated the spawn layer has two rooms and I get spawned in the room without the stairwell, which is why I noticed this problem. Because I can't even get to the stairwell without going into the next room. This is not the case with the original code where the stairwell is in the first room where the hero spawns.
As you see, my first stairwell is in the other room. Luckily I had that check which let me get the code implemented :P. Ill just do day76 as I think the title says we will do 3D collisions which should solve this issue.
I do see that even in the original code, the simregion has 5 layers above and 5 layers below. Why is that? We shouldn't need to worry about entities in the layers above and below right? Im thinking the hero is only ever going to interact with things in his own layer?
Often when working on a new features, other things might brake, that's expected and generally fixed in later episodes.
I don't remember why the sim region has that size but I remember that one of the idea was that the world is constantly updating (things that are far are updated less often than things that are close to the player, although I don't think this was ever implemented). So the size might be so that entities that are close can still move around.
things that are far are updated less often than things that are close to the player, although I don't think this was ever implemented
This was the plan when the vision was to have high and low entities. And high entities would be simulated at full time resolution, whereas low entities will be simulated more sluggishly. But then the simregion idea was introduced where the plan was to just have a secondary sim region that was independent of the camera and which scanned the world, updating it as it went. I have not reached far enough to know if this scanning sim region was implemented.
I have heard Jonathan Blow talk about how in the witness it was important to see all across the island. And recently while playing the game I saw some of these very very far entities being important to the gameplay. Although in the witness nothing really ever moves so I guess there wouldn't be too much to sim even if there are a lot of entities. The only ones to simulate would be the river, the windmill, the laser beams and anything the player is interacting with. Is that how, keeping the entire world engaged with the gameplay and therefore needing to be simulated at "high frequency" work? i.e. by having them not do too much when left alone?
I don't know but I assume it depends on the game. It's not uncommon to see NPC animated at half frame rate or less when they are far from the camera (but visible), but I don't think most game simulate far entities at low frame rate.
I think games like Zelda, Elder Scrolls... use in game time of day and some stored state to know where a NPC should be and what they should be doing.
I recently played Kingdom Come: Delivrance, and it looked like they are simulating entities positions for NPC involved in quest, because if an NPC has to move from one town to another, you can encounter them on the road.
Hey Simon I was doing day 78 and
Basically then this is saying, turn off collision with stairwell when there has been movement in z-direction during the collision loop. So I could possibly jump into the stairwell from the side?
casey muratori did jump in from the side into the stairwell today 😃