EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   General::General Discussion (https://www.eqemulator.org/forums/forumdisplay.php?f=586)
-   -   EverQuest in Unity Engine project (https://www.eqemulator.org/forums/showthread.php?t=35658)

Tyen05 06-26-2016 07:13 PM

Slots done, time for op_moveitem

http://i.imgur.com/OryBaW5.jpg

Tyen05 06-27-2016 06:31 AM

moveitem, first pass

https://youtu.be/f2hjaJlJ6Zc

Tyen05 06-27-2016 08:26 PM

moveitem, second pass

https://youtu.be/V1M0RJUs4Rw

Tyen05 06-28-2016 05:12 AM

moveitem, third pass

https://youtu.be/986EFhB0O9g

Tyen05 06-29-2016 06:30 AM

draggable windows

https://youtu.be/ShEI1PasP_g

Tyen05 06-30-2016 05:52 AM

something for increasing FPS.

Need to change a list to a dictionary so instead of the array going "Element 0, element 1, etc" i can change the element name to spawnId in objectpool.cs

Using "Where" or "Find" hurts performance. I'm trying to find a way to just define a gameobject without having to search for it first. I use this a lot in handleworldmessages.cs. Biggest thing is op_clientupdate uses this 100% of the time, and it is sent from the server to the client every 30milliseconds.


in a script other than objectpool.cs, i use the below line to define a gameobject thats in a list array:
GameObject temp = ObjectPool.instance.spawnlist.Where(obj => obj.name == spawn_id.ToString()).SingleOrDefault();

Id like to do something like below in a dict array, cutting out the search using the spawnId as the element# in the array, so I don't have to search by name:
GameObject temp = ObjectPool.instance.spawndict[spawn_id];


In the pc editor, it's np @ 60 fps. in firefox it's 30fps. In chrome, it's like 17-23 fps. (from what i've noticed). Pretty sure this is causing it.


http://i.imgur.com/cEEapHw.png

Tyen05 06-30-2016 07:07 PM

The "where" wasnt killing my fps, but changed it to below and kept the spawnlist array a list instead of switching to a dictionary:
GameObject temp = ObjectPool.instance.spawnlist.FirstOrDefault(obj => obj.name == spawn_id.ToString());


This line in npccontroller.cs was taking FPS down by half.
grounded = ((controller.Move(moveDirection * Time.deltaTime)) & CollisionFlags.Below) != 0;

Charles082986 07-01-2016 01:33 AM

https://docs.unity3d.com/ScriptRefer...ller.Move.html
https://docs.unity3d.com/ScriptRefer...sGrounded.html

This says that CharacterController already has a property called "isGrounded" which checks if the characterController was touching the ground during the last move.

You might separate the .Move command onto a different line as the bitwise operator function.

Also, do you have a range limit set for what objects are rendered? Game clients have an adjustable clip plane (I think that's what it was called in EQ) that only renders terrain and game objects out to a certain distance. It might help if you're only rendering what's in the immediate area instead of every NPC in Qeynos. It's late, so I could be horribly wrong, but since I don't see a good way around having to call the .Move command, the only thing I can guess at is minimizing its usage.

Tyen05 07-02-2016 05:06 AM

doing real good on fps now with a bunch of changes.

Clip plane is set to 1200, thats the value in the DB in zone table. Anything past that, the client doesn't render by default. I just added to the NPC script for gameobjects not to render when the camera isnt looking at it. I did this with NPCs only, for now.

Code:

Vector3 screenPoint = Camera.main.WorldToViewportPoint(transform.position);
bool onScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < 1 && screenPoint.y > 0 && screenPoint.y < 1;
if(onScreen == true & screenBool != true){transform.GetChild(0).gameObject.SetActive(true);screenBool = true;}
if(onScreen == false & screenBool != false){transform.GetChild(0).gameObject.SetActive(false);screenBool = false;}

cool video:
https://youtu.be/FSQ7I1EcA08

Tyen05 07-02-2016 06:54 PM

That technique seems to only raise fps by a little bit, trying out another method.

Unity's built in Occlusion Culling: https://docs.unity3d.com/Manual/OcclusionCulling.html

fzzzty 07-04-2016 08:14 PM

Quote:

Originally Posted by Tyen05 (Post 249705)
The "where" wasnt killing my fps, but changed it to below and kept the spawnlist array a list instead of switching to a dictionary:
GameObject temp = ObjectPool.instance.spawnlist.FirstOrDefault(obj => obj.name == spawn_id.ToString());

Forgive me if you know this already, but FirstOrDefault will return null if it doesn't find anything, so you might have to handle that (probably the same path as if the Where returned no entries). Where passes through the whole list even if it finds something, of course, so this should be faster if you're guaranteed to have the thing in the lsit. Alternatively, First will throw if it finds nothing. ToLookup might be useful in some situations in case you haven't heard of it. No offense if you already know all this. :)

Charles082986 07-04-2016 08:50 PM

FirstOrDefault only returns null if the default is null. The default value can be configured so it works quicker than .FirstOrDefault(obj => obj.name == spawn_id.ToString()) ?? new GameObject();

Tyen05 07-05-2016 04:18 PM

Messing with Analytics and eventually back to bag/equip slots.

Google Analytics Plugin for Unity - API Reference

Tyen05 07-06-2016 05:58 AM

Analytics

https://www.twitch.tv/eqbrowser/v/76522914
https://youtu.be/WyVL92ftkTI

Tyen05 07-06-2016 06:11 PM

http://i.imgur.com/7P7HGAY.png
http://i.imgur.com/TpZf77j.png
http://i.imgur.com/mkSkkJX.png


All times are GMT -4. The time now is 11:29 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.