Announcement

Collapse
No announcement yet.

What portion of a level does one client keep track of? Or does it try to do all of it?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    What portion of a level does one client keep track of? Or does it try to do all of it?

    Before I started with UE4, I was doing my own low-level programming with C++. In doing so, I learned a lot about game loops and screen rendering. I had created the framework for a top-down 2D game where the player's camera could only see a part of the level based on the position of their character. I think this is very typical.

    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	11.7 KB
ID:	1197114

    The red box represents the player's camera/viewport. This is what the client sees. The rest of the level exists but is currently beyond the player's view.

    By default, my game loop looked through every single object in the level and drew it to the screen regardless of where the player was. This caused the draw process to slow down the game. I was unnecessarily rendering things the player couldn't even see.

    To change this, I did a distance check from the player's position to the object being examined. If it was beyond the player's view, I didn't bother to render it. The end result was this.

    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	3.2 KB
ID:	1197115

    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	3.4 KB
ID:	1197116

    I would still need to render a full object if the player could only see part of it, but it was MUCH better than before.

    Ok, so back to UE4.

    I have no idea how UE4 handles this kind of stuff.
    1. Is there anything running in the background that determines if a client needs to render an object or not? I've never heard people talk about this so I have no idea if something is done already.
    2. Should I be looking to do this manually? I'm not sure if setting the "visible" flag will even help with this .. don't know if the geometry is still sent to the video card regardless.
    3. Is there anything else I should know or take into consideration about this?


    I am not asking this as the result of performance issues, I have just always wondered how this is done since I had to deal with it myself.

    Edit: And this isn't just about rendering but other calculations too.
    Last edited by Chumble; 10-18-2016, 12:26 PM.
Working...
X