Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover

IL-2 Sturmovik: Cliffs of Dover Latest instalment in the acclaimed IL-2 Sturmovik series from award-winning developer Maddox Games.

Reply
 
Thread Tools Display Modes
  #31  
Old 01-27-2011, 06:51 PM
Heliocon Heliocon is offline
Approved Member
 
Join Date: Dec 2010
Posts: 651
Default

Quote:
Originally Posted by mazex View Post
OK - please calm down. Let me try to explain what I mean then...

Well, I did write a long example with pseudo code and all in my second post in this thread but deleted it as it was to long winded. I realize that you actually think you are right and then naturally think that I'm just talking bull so let's try to sort this out then.

I think that the problem is that you have maybe confused threads and cores in some way. When you write a Windows program it will run in a process and if you do no not create more threads yourself in the code it will just run on a single thread. That thread in it's turn can only run on one CPU or Core (and the OS assigns that if you don't mess with that yourself which really should not be done) . So a game that does not create additional threads will run on one core... It will do calls to the OS that will use other threads for that but generally it will just load one core itself. Then to use the other cores you have to create new threads from your code and start them yourself in the code. The OS can then let them run on one of the other cores or CPU:s if available or chop the time on the CPU between the threads if you have only one CPU/Core. OK - so the threads run in the same process but one of the problems is that if they are going to access shared memory (variables like the state of the me 109 in front of you) they may try to update the same shared memory (like an array of detected enemies that is a private variable in the CFighterPlane object) and that's a no no. Therfore you have to make sure that the thread that is going to update that shared variable get's exclusive access to the variable while updating it - which is essential if you are going to write thread safe code (handled by identifying these critical sections and make sure to exclusive access that memory while updating it so no other thread does that at the same time). The problem is also that both the AI thread (if you create a thread for that in your code and the OS then assigns that thread to run on a core.) and the code for the Collision detection might want to update the number of enemies detected by that specific enemy plane object as the collision detection code has just "killed" that same enemy plane that crashed into a mountain in classic IL2 way The AI code is then on the same time trying to update the object that got "killed" to try to avoid the mountain. What happens then? Those problems are really hard to debug in multi threaded code as opposed to traditional single threaded code that can be debugged line for line but the in the multi threaded code your breakpoint at the part of the code that detected the collision will stop but what is the state of the other thread? Those problems are hard to solve and if your AI thread is milling along updating the "inputs" for the AI planes the render loop has to know that as it updates the actual meshes loaded to the GPU each loop in the main game loop. Not trying to push you down but trying to explain - OK?

/Mazex
Good explanation. I understand what you are saying and it does indeed seem like a plausible problem. The one question though is when you say memory, what are you refering to in the system? Is this cpu cache? It may be harder to program but parallel processing is still faster then serial, even if it may be more difficult to work with (I would argue that its more of an issue with people adjusting to the new "format" and that over time it will become much easier.)
I understand the differance between threads, cores, processes etc

Also the reason I hate programming is debugging because I accidently put a comma or a mistype somewhere and the whole damn thing goes nuts and spams me with errors and I cry into my keyboard as I spend the next day going through 1 hour of code to find the mistake
Reply With Quote
  #32  
Old 01-27-2011, 07:18 PM
mazex's Avatar
mazex mazex is offline
Approved Member
 
Join Date: Oct 2007
Location: Sweden
Posts: 1,342
Default

Quote:
Originally Posted by Heliocon View Post
Good explanation. I understand what you are saying and it does indeed seem like a plausible problem. The one question though is when you say memory, what are you refering to in the system? Is this cpu cache? It may be harder to program but parallel processing is still faster then serial, even if it may be more difficult to work with (I would argue that its more of an issue with people adjusting to the new "format" and that over time it will become much easier.)
I understand the differance between threads, cores, processes etc

Also the reason I hate programming is debugging because I accidently put a comma or a mistype somewhere and the whole damn thing goes nuts and spams me with errors and I cry into my keyboard as I spend the next day going through 1 hour of code to find the mistake
Good that we have normalized the situation then

No - that memory I'm talking about is just the RAM memory that the threads share and that is allocated to the process and it's subthreads by the OS. That memory is then divided into the stack (variables, structs etc - normally with short lifespan that is "cheap" and fast) and the heap (where objects etc are dynamically stored for a longer time and you allocate and deallocate that memory yourself (and it is slower than the stack)). This is all stored in RAM unless the OS decides to swap it to disk if it runs out of memory (but you are fine with your 12 GB ). The fact that the CPU then uses registers (memory) etc is something a "normal" programmer never mess with in normal cases with modern programming languages....

If you did not like debugging straight single thread code you can imagine doing that in multi threaded code with eight threads messing with each other and you don't really know the state of that 109... Is it dead or alive? The CollisionAndResponse thread thinks it is not but the AIThread does not know that so can we call it the opposite of brain dead?
Reply With Quote
  #33  
Old 01-27-2011, 09:37 PM
Skinny Skinny is offline
Approved Member
 
Join Date: Aug 2010
Posts: 30
Default

Quote:
Originally Posted by Heliocon View Post
Also physx (which I never mentioned btw as someone implied I did) is mainly geared to particles and cloth/hair etc. It would certainly work for stuff like clouds and smoke that interact with planes passing through, but I dont know of its effects on flight models. CUDA is meh.
Particles is what its mostly used for, for obvious reasons: many (/most) gamers dont have physx enabled hardware, therefore its used for eye candy that can easily be turned off without affecting actual gameplay.

That doesnt mean its not usable for physics simulation like aerodynamics. Surely you've seen all the hydrodynamics simulations. If it works for water, I dont see why it couldnt work for air:
Reply With Quote
  #34  
Old 01-27-2011, 10:24 PM
Jones Jones is offline
Approved Member
 
Join Date: Jun 2010
Posts: 35
Default

Bravo, mazex! I applaud your patience and the clarity of your explanation!
Reply With Quote
  #35  
Old 01-28-2011, 02:10 AM
Heliocon Heliocon is offline
Approved Member
 
Join Date: Dec 2010
Posts: 651
Default

Quote:
Originally Posted by mazex View Post
Good that we have normalized the situation then

No - that memory I'm talking about is just the RAM memory that the threads share and that is allocated to the process and it's subthreads by the OS. That memory is then divided into the stack (variables, structs etc - normally with short lifespan that is "cheap" and fast) and the heap (where objects etc are dynamically stored for a longer time and you allocate and deallocate that memory yourself (and it is slower than the stack)). This is all stored in RAM unless the OS decides to swap it to disk if it runs out of memory (but you are fine with your 12 GB ). The fact that the CPU then uses registers (memory) etc is something a "normal" programmer never mess with in normal cases with modern programming languages....

If you did not like debugging straight single thread code you can imagine doing that in multi threaded code with eight threads messing with each other and you don't really know the state of that 109... Is it dead or alive? The CollisionAndResponse thread thinks it is not but the AIThread does not know that so can we call it the opposite of brain dead?
Thank you for the responses Maze, I know my tone can be abrasive but I am not looking around to pick a fight here. The issue with the ram was I thought you were talking about the CPU cache (for example i7 uses two 4mb cache's, 4mb for 2 cores/4 threads). This is what I was trying to get at originaly, the conversation then nosedived, so from my view I was arguing about hardware allocation. But yes again I never said multi threaded programming was easy, just that it was necessary since clock speeds are not increasing like they used to.

Anyway thanks for the polite and well thought out responses, but be wary my eye in the sky is watching for you to make a minor grammatical error so I can wtf divebomb you and call you an old fart who programmed typewriters for 20 years
Reply With Quote
  #36  
Old 01-28-2011, 02:14 AM
Heliocon Heliocon is offline
Approved Member
 
Join Date: Dec 2010
Posts: 651
Default

Quote:
Originally Posted by Skinny View Post
Particles is what its mostly used for, for obvious reasons: many (/most) gamers dont have physx enabled hardware, therefore its used for eye candy that can easily be turned off without affecting actual gameplay.

That doesnt mean its not usable for physics simulation like aerodynamics. Surely you've seen all the hydrodynamics simulations. If it works for water, I dont see why it couldnt work for air:
No reason that I know off, I just dont know how they manage the flightmodel/air interaction. If there "zones"/boxes of air with different property? So If I enter one area I get turbulence or something? Or is it managed dynamically or prodcedually? I have no idea tbh

The main difference is Physx is not really a mechanic focused on physics as much as it is focused on solving and then "presenting" the effects. Its also GPU tied which needs to be rendering. Physx is great, but unless you have a dedicated card its better to buy a second card then have a non physx gpu. Atleast thats what people seem to think on the EVGA forums.
Reply With Quote
  #37  
Old 01-28-2011, 04:50 AM
The Kraken The Kraken is offline
Approved Member
 
Join Date: Jul 2010
Posts: 317
Default

Quote:
Originally Posted by Skinny View Post
Particles is what its mostly used for, for obvious reasons: many (/most) gamers dont have physx enabled hardware, therefore its used for eye candy that can easily be turned off without affecting actual gameplay.

That doesnt mean its not usable for physics simulation like aerodynamics. Surely you've seen all the hydrodynamics simulations. If it works for water, I dont see why it couldnt work for air
Well air is compressible, water is not PhysX is primarily designed for rigid body physics (the water animation also belongs to that area) and not too useful for more complex problems, although I have to admit I'm not sure what the most current state of the API is.

The bigger problem though is this: the flight dynamics engine is the core of any flight sim. You cannot rely on proprietary solutions like PhysX because you have to make sure it works for everyone, and also the same for everyone. It is much harder to debug, it is additional work even if only parts of the calculations are moved to the GPU and you run the risk of ending up with a dead solution should nVidia decide to drop it one day or maybe go out of business.
Reply With Quote
  #38  
Old 01-28-2011, 05:07 AM
Heliocon Heliocon is offline
Approved Member
 
Join Date: Dec 2010
Posts: 651
Default

[QUOTE=The Kraken;217731]Well air is compressible, water is not PhysX is primarily designed for rigid body physics (the water animation also belongs to that area) and not too useful for more complex problems, although I have to admit I'm not sure what the most current state of the API is.

The bigger problem though is this: the flight dynamics engine is the core of any flight sim. You cannot rely on proprietary solutions like PhysX because you have to make sure it works for everyone, and also the same for everyone. It is much harder to debug, it is additional work even if only parts of the calculations are moved to the GPU and you run the risk of ending up with a dead solution should nVidia decide to drop it one day or maybe go out of business.[/QUOTE

Yep I agree, I dont think physx should be in because it hurts ATI users, they need to come up with a standard system, but I dont think Havok will cut it either (specially not for flight modeling).
Reply With Quote
  #39  
Old 01-28-2011, 06:35 AM
Skinny Skinny is offline
Approved Member
 
Join Date: Aug 2010
Posts: 30
Default

Quote:
Originally Posted by Heliocon View Post
No reason that I know off, I just dont know how they manage the flightmodel/air interaction. If there "zones"/boxes of air with different property? So If I enter one area I get turbulence or something? Or is it managed dynamically or prodcedually? I have no idea tbh

The main difference is Physx is not really a mechanic focused on physics as much as it is focused on solving and then "presenting" the effects. Its also GPU tied which needs to be rendering. Physx is great, but unless you have a dedicated card its better to buy a second card then have a non physx gpu. Atleast thats what people seem to think on the EVGA forums.
Actual calculation of airflow over a plane wing and prop is probably many years out. That stuff is so compute intensive super computers struggle with it and may not do it in realtime.

I do remember seeing a video of Rise Of Flight where air movement was visualized with arrows, showing wind, prop wash, thermals and the like. I cant find the video, it was really impressive, and showed that game is modelling airflow to some extend (though probably not to calculate aerodynamic behavior of the plane). I was just guessing stuff like that could be offloaded to the GPU.

As for PhysX as API, I was talking more generally about GPGPU. There is also OpenCL which works on both ATI and nVidia cards.
Reply With Quote
  #40  
Old 01-28-2011, 06:47 AM
mazex's Avatar
mazex mazex is offline
Approved Member
 
Join Date: Oct 2007
Location: Sweden
Posts: 1,342
Default

P
Quote:
Originally Posted by Heliocon View Post
Anyway thanks for the polite and well thought out responses, but be wary my eye in the sky is watching for you to make a minor grammatical error so I can wtf divebomb you and call you an old fart who programmed typewriters for 20 years
Thanks, and I'm sorry I had a tough attitude too when replying first. As seen here that just escalates an argument which is in most cases built upon a misunderstanding of what the other person is saying and that we then think we understand what they really think

And regarding typewriters I don't have that (yet ) in my cv after many years as a software consultant. The most "boring" project I've been on must be climate control systems (not the small ones for cars), but then again - programming is never boring once you get over the first frustration while learning to write thread safe code for example...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:42 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.