PDA

View Full Version : Will the Unity engine be core neutral or utilize many threads to distribute workload?



Larsenex
August 10th, 2019, 00:01
Greetings FG Team.

Will the upcoming Fantasy Grounds Unity be able to utilize more modern processors that have many cores and/or threads? Such as some of the Athlon or intel with > 6 or 8 or 16 core CPUS?

LordEntrails
August 10th, 2019, 00:14
I doubt it. Really no need for it since FG is not very CPU intensive. And it would require all the libraries to be support multi-core, which is unlikely that they do. Most of the performance limits of FG come from two things; bandwidth and process size limit due to image size. Neither of which benefit from multi-core processing.

Of course, this is not an official statement, just my experience working with high-end enterprise software.

Larsenex
August 10th, 2019, 00:47
Ah ok. In which case it would seem if the application is single threaded then it would benefit from a faster processor? > 5ghz?

damned
August 10th, 2019, 02:47
Read here for Unity's view on Multi-threading.

https://docs.unity3d.com/Manual/JobSystemMultithreading.html

LordEntrails
August 10th, 2019, 02:59
Ah ok. In which case it would seem if the application is single threaded then it would benefit from a faster processor? > 5ghz?
Sure... but not really. Again, FG doesn't require much processing power. When you are waiting on FG to do something, you are waiting on Network bandwidth and latency, not CPU processing. What's your processor load/usage while you are running FG? 10-20%? Maybe you hit 80% for an instance or two when you open a large image, but does a 0.2 second "delay" really matter? And then going from a 2GHz to 5GHz processor you might be lucky to have a 0.1 second delay, is it worth the money to you?

FGU with dynamic LoS and dynamic map effects is going to increase processing usage, but that's probably going to by processed by your graphics card (GPU), not your CPU. So again, an extreme processor isn't going to help.

What problem are you trying to solve? Or are you just excited about possibilities and want to maximize your experience?

Trenloe
August 10th, 2019, 06:28
When you are waiting on FG to do something, you are waiting on Network bandwidth and latency, not CPU processing.
This is not strictly true. Try adding a bunch of complex NPCs to the CT all at once (e.g. from a preset encounter with many NPCs) and a low spec CPU computer will be sorely taxed and FG can stop responding for 30 seconds or more. This is all based off processing power.

Valyar
August 10th, 2019, 06:34
The challenge will be for FG Unity to provide good experience to users with laptops without dedicated graphic processor.
FG is not computer game, but the engine is exactly for that purposes and I hope whatever they do - it is optimized and allows even people with low specs and macs to enjoy it.

It will be sorry experience to have the GM run effects just to have your end lagging.

celestian
August 10th, 2019, 06:46
I doubt it. Really no need for it since FG is not very CPU intensive. And it would require all the libraries to be support multi-core, which is unlikely that they do. Most of the performance limits of FG come from two things; bandwidth and process size limit due to image size. Neither of which benefit from multi-core processing.

Of course, this is not an official statement, just my experience working with high-end enterprise software.

When FG was first created it didn't need to worry about maps larger than the current memory limits either.

I wouldn't be to sure about the "never need the threading" statement. With the options of 3d, sound and lighting in Unity... that could change.

damned
August 10th, 2019, 06:51
Unity themselves suggest that Multi-threading creates more overhead than it fixes for most gaming applications

For the low spec computers... that is always going to happen. You cant give more features at one end and not expect it to have an impact at the other end
Your GM doesnt have to use effects if the players cant handle them.

celestian
August 10th, 2019, 07:08
Unity themselves suggest that Multi-threading creates more overhead than it fixes for most gaming applications

For the low spec computers... that is always going to happen. You cant give more features at one end and not expect it to have an impact at the other end
Your GM doesnt have to use effects if the players cant handle them.

I'm not sure where that comes from but the write ups I've found about it seem to suggest they support it and it requires "minimal" effort using the unity job system (that IS multithreaded).



All you need to do is place your logic into custom jobs and then schedule them to run. The Job System will handle the rest, executing all of your jobs on seperate threads that are managed by Unity.


That comes from here.

https://infalliblecode.com/unity-job-system/

The author there is a content dev for Unity not the developers of Unity so you can make of that what you will. You can find their docs on this here (https://docs.unity3d.com/Manual/JobSystem.html).

I wouldn't cross it off the list just yet.

damned
August 10th, 2019, 08:30
https://docs.unity3d.com/Manual/JobSystemMultithreading.html

What is multithreading?

In a single-threaded computing system, one instruction goes in at a time, and one result comes out at a time. The time to load and complete programs depends on the amount of work you need the CPU to do.

Multithreading is a type of programming that takes advantage of a CPU’s capability to process many threads at the same time across multiple cores. Instead of tasks or instructions executing one after another, they run simultaneously.

One thread runs at the start of a program by default. This is the “main thread”. The main thread creates new threads to handle tasks. These new threads run in parallel to one another, and usually synchronize their results with the main thread once completed.

This approach to multithreading works well if you have a few tasks that run for a long time. However, game development code usually contains many small instructions to execute at once. If you create a thread for each one, you can end up with many threads, each with a short lifetime. That can push the limits of the processing capacity of your CPU and operating system.

It is possible to mitigate the issue of thread lifetime by having a pool of threads. However, even if you use a thread pool, you are likely to have a large number of threads active at the same time. Having more threads than CPU cores leads to the threads contending with each other for CPU resources, which causes frequent context switching as a result. Context switching is the process of saving the state of a thread part way through execution, then working on another thread, and then reconstructing the first thread, later on, to continue processing it. Context switching is resource-intensive, so you should avoid the need for it wherever possible.

----------

So thats copypasta from the Unity Manual.

Bidmaron
August 10th, 2019, 13:00
The network code has to be threaded and that is the case even with the current FG. otherwise, every time something was being transferred to a user the UI would freeze. (Or the UI is on a separate thread but that is unlikely because the current FG does have pauses in its UI on occasion)

Larsenex
August 10th, 2019, 16:10
Ok thanks to all of you for the replies. This thread was helpful.
I have an 8700K which is watercooled and overclocked to 4.9ghz.
I also have 32 gigs of Corsair PC3200 memory
A 256g M.2 drive for windows, 2 -500 gig Samsung Evo 850s for games/Fantasy grounds, a 6 terrbyt platter drive for all things that are storage (Ive directed windows to store, downloads, pictures and general storage here.
In addition I have an Nvidia gtx 1080.
I have one 27" monitor which is 1080p but I agree having 2 monitors for FG is useful so I am going to get the LG 31.5" (2560 x 1440) freesync monitor. I am not sure if it will fit where I park everything. I may need a bigger deskspace.

This engine that the team has made is amazing. I did like Roll20 but I should have migrated here last year! I learn stuff everyday. My next 'learning' thing is to figure what the pins are on the maps for Hellknights module and how they work. I think they are for encounters. I will keep plowing thru FG 'official' videos.

Has anyone posted a video using FG and running the new Hell Knight module?

LordEntrails
August 10th, 2019, 16:34
Ok thanks to all of you for the replies. This thread was helpful.
I have an 8700K which is watercooled and overclocked to 4.9ghz. ...
FYI, you have a computer better than 99.9999%(give or take a few percent!) of all FG users :) No need to worry about upgrading anytime this decade :)

chumbly
August 10th, 2019, 20:30
Ok thanks to all of you for the replies. This thread was helpful.
I have an 8700K which is watercooled and overclocked to 4.9ghz.
I also have 32 gigs of Corsair PC3200 memory
A 256g M.2 drive for windows, 2 -500 gig Samsung Evo 850s for games/Fantasy grounds, a 6 terrbyt platter drive for all things that are storage (Ive directed windows to store, downloads, pictures and general storage here.
In addition I have an Nvidia gtx 1080.
I have one 27" monitor which is 1080p but I agree having 2 monitors for FG is useful so I am going to get the LG 31.5" (2560 x 1440) freesync monitor. I am not sure if it will fit where I park everything. I may need a bigger deskspace.

This engine that the team has made is amazing. I did like Roll20 but I should have migrated here last year! I learn stuff everyday. My next 'learning' thing is to figure what the pins are on the maps for Hellknights module and how they work. I think they are for encounters. I will keep plowing thru FG 'official' videos.

Has anyone posted a video using FG and running the new Hell Knight module?

Envious drooling and whimpering .. similar to what happens when a Ferrari blast past my little Ford on the road :p

celestian
August 10th, 2019, 21:35
This approach to multithreading works well if you have a few tasks that run for a long time. However, game development code usually contains many small instructions to execute at once. If you create a thread for each one, you can end up with many threads, each with a short lifetime. That can push the limits of the processing capacity of your CPU and operating system.


That description isn't really apt for FG. This isn't an FPS. The number of instructions for FG are not in the same ballpark as a FPS. It would more than likely be small number of short tasks or long term short number of tasks. Even with full 3D you're not going to have multiplayer fast action requiring a lot of positional detection, hit boxes, ray casting, projectile tracking and the like. More than likely you'll have one (few?) player moving and generating fog/shadows at most.

Assuming they use "Unity Jobs", which manages all this, it'll have multithread support.

Trenloe
August 10th, 2019, 22:23
https://www.fantasygrounds.com/forums/showthread.php?38475-The-road-forward-64-bit-multithreading&p=339564&viewfull=1#post339564

celestian
August 10th, 2019, 22:27
https://www.fantasygrounds.com/forums/showthread.php?38475-The-road-forward-64-bit-multithreading&p=339564&viewfull=1#post339564

That doesn't jive with the quote from their own(Unity) site above.



The Unity C# Job System lets you write simple and safe multithreaded code that interacts with the Unity Engine for enhanced game performance.

Trenloe
August 10th, 2019, 22:33
That doesn't jive with the quote from their own(Unity) site above.

Maybe that's part of Carl's statement: "It's slightly more complex than I'm presenting, but that is the short version." If you weren't aware, Carl is the main FG Unity developer. Or maybe something's changed since Carl's made that statement. Whether that has changed the FG Unity design (that's been ongoing for many years) remains to be seen...

What this illustrates is that we can talk around the houses and make all sorts of assumptions about what's possible, or not possible, or should or shouldn't be done etc.. But unless a FG Unity developer gives us feedback as to what is actually being done/has been done in FG Unity, then all we're doing is speculating.

celestian
August 10th, 2019, 22:58
What this illustrates is that we can talk around the houses and make all sorts of assumptions about what's possible, or not possible, or should or shouldn't be done etc.. But unless a FG Unity developer gives us feedback as to what is actually being done/has been done in FG Unity, then all we're doing is speculating.

You are absolutely correct. That's why I said "Assuming they use "Unity Jobs", which manages all this, it'll have multithread support.". "They" being the fellas working on FGU.

I'm just anxious for December.

Ckorik
August 10th, 2019, 23:01
I run a Ryzen 7 8 core/16 thread with 32 gig ram - 512 gig m.2 main drive and a 2 tb drive (4 1 tb SSD's in raid 10) with a ati 580 8gb graphics card. I still have occasions where the program will 'lag out' on me - there are some bottlenecks - especially when opening or closing the program.

LordEntrails
August 11th, 2019, 03:09
I run a Ryzen 7 8 core/16 thread with 32 gig ram - 512 gig m.2 main drive and a 2 tb drive (4 1 tb SSD's in raid 10) with a ati 580 8gb graphics card. I still have occasions where the program will 'lag out' on me - there are some bottlenecks - especially when opening or closing the program.
Yep, because performance is complex. In part because only 1 of those cores is being used and during open/close a lot of what is happening is disk reads and is not bounded by processor speed, graphics card or RAM.

Nylanfs
August 11th, 2019, 15:28
Ok thanks to all of you for the replies. This thread was helpful.
I have an 8700K which is watercooled and overclocked to 4.9ghz.
I also have 32 gigs of Corsair PC3200 memory
A 256g M.2 drive for windows, 2 -500 gig Samsung Evo 850s for games/Fantasy grounds, a 6 terrbyt platter drive for all things that are storage (Ive directed windows to store, downloads, pictures and general storage here.
In addition I have an Nvidia gtx 1080.
I have one 27" monitor which is 1080p but I agree having 2 monitors for FG is useful so I am going to get the LG 31.5" (2560 x 1440) freesync monitor. I am not sure if it will fit where I park everything. I may need a bigger deskspace.

This engine that the team has made is amazing. I did like Roll20 but I should have migrated here last year! I learn stuff everyday. My next 'learning' thing is to figure what the pins are on the maps for Hellknights module and how they work. I think they are for encounters. I will keep plowing thru FG 'official' videos.

Has anyone posted a video using FG and running the new Hell Knight module?

Is it this computer? (https://www.youtube.com/watch?v=-OwB5al5KXg)

pindercarl
August 12th, 2019, 17:14
Maybe that's part of Carl's statement: "It's slightly more complex than I'm presenting, but that is the short version." If you weren't aware, Carl is the main FG Unity developer. Or maybe something's changed since Carl's made that statement. Whether that has changed the FG Unity design (that's been ongoing for many years) remains to be seen...

What this illustrates is that we can talk around the houses and make all sorts of assumptions about what's possible, or not possible, or should or shouldn't be done etc.. But unless a FG Unity developer gives us feedback as to what is actually being done/has been done in FG Unity, then all we're doing is speculating.

The previous post (from 2017) predates Unity's ECS/DOTS job system. Line-of-sight calculations are the top candidate to move to job system. The current LOS system is fairly optimized and the performance is good. If a party of 12 characters moves all at one...that's where jobbing will be useful. Either way, it's a post-alpha (probably post-beta) optimization.

Trenloe
August 12th, 2019, 17:40
The previous post (from 2017) predates Unity's ECS/DOTS job system. Line-of-sight calculations are the top candidate to move to job system. The current LOS system is fairly optimized and the performance is good. If a party of 12 characters moves all at one...that's where jobbing will be useful. Either way, it's a post-alpha (probably post-beta) optimization.
Thanks for the update and information Carl!