JektJoin Date: 2012-02-05Member: 143714Members, Squad Five Blue, Reinforced - Shadow
I'm surprised that logic is where the most time is spent. I thought particle effects like jetpack dust, spores and mist were the heavy hitters. Lost 20 frames standing in the same place in the same situation when a mist was put down. Add all the obscuration effects at once, and you're crawling.
matsoMaster of PatchesJoin Date: 2002-11-05Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
Wait, the whole game is Lua? I thought most of the core stuff was C++ and just variable shit like resource collection was Lua.
All of the NS2 game code is in Lua. Skulk wallwalking, marine jumping, lerk flying, fade blinking is all defined in Lua.
The C++ parts deals with generic things that you need in any first person shooter, like animation, timing, cameras, network, interpolation/compensation etc.
But there is no NS2 specific code in the Spark engine.
Back during alpha/beta development, I recall one of the UW team posted that he was "scared" by the dev's contemplating a rewrite of Lua to implement some additional desired functionality (such as better memory management, native support of certain NS2-specific data types, and maybe even multithreading). Nothing came of this, but I have always wondered if the seed of this idea has continued to grow.
In C/C++ you can control hardware better. Like processor(s) and cache memory, but with devils language: http://lwn.net/Articles/255364/ anyway I think we should be happy that engine made it state to what we see today.
@Matso, incredible that all game code is Lua, this sounds like overkill lol.
Wait, the whole game is Lua? I thought most of the core stuff was C++ and just variable shit like resource collection was Lua.
The C++ parts deals with generic things that you need in any first person shooter, like animation, timing, cameras, network, interpolation/compensation etc.
Lua has some libraries that say they can add functionality for multiple threads and therefore multiple cores, but from what I've read it doesn't work very well and it's hard to implement. The other thing is that yea the game can use multiple threads, that's obviously the case if you check your resource monitor. It does however only use up 2 cores so that should tell you that no it's not really optimized for it.
I genuinely want to know what is the difference and (or dis) advantages between codes like C, lua, and other computer languages?
I'm currently a computer science major (junior) so I have experience using a decent amount of languages on the scale so far.
But basically the farther from 1's and 0's you get the slower it goes. Actually had a 3 hour lab yesterday writing a program in assembly. (the lowest level language that literally translates what you write into machine code)
Jesus that language is awful. Makes you really appreciate things in Python like: x = "hi"
Learning to program in assembly actually has been the most helpful though in understanding how a computer really truly works at the basic level. For example:
in normal programming languages you can do something like
x = 5
y = 10
z = x+y
So that z ends up being 15 without ever actually explicitly saying yo z, you're 15.
But even simple things in assembly like multiplying by 8 are stupidly hard. At least with what we've learned.
You take the number, and shift its binary value in the register.
In binary numbers are 0 and 1.
0001 is the number 1
0101 is the number 5
0010 is the number 2
In assembly you store the value in something called an accumulator and then perform operations. So to like do the operation 2*8
you would take the binary value of 2, 0010 and shift the most significant bit over left twice to 8: 1000
In assembly the command is LSRA.
So you do that twice and then restore the value in A
looks like:
LSRA
LSRA
STAA
Anyways the whole point here is that low level languages can be freaking hard to do anything in, but are much more efficient if you know what you're doing.
Lua is really far away from binary shifting in the CPU register to do simple steps, but as a result is slower as it needs to get translated to assembly language and then machine code before it is run.
/rant
if you already understood the differences between high level languages and low level languages, then why did you post your original question? you were basically asking a question that has the same concept as someone saying "hey, why havent we cured cancer yet? I mean, we have other cures for diseases, seems pretty easy to me."
you have a lot to learn about computer science kid.
also, secondly, I believe ns2 is using physx to do all the ragdoll physics, etc. I believe physx will pick up an available core if you dont have nvidia hardware.
I genuinely want to know what is the difference and (or dis) advantages between codes like C, lua, and other computer languages?
I'm currently a computer science major (junior) so I have experience using a decent amount of languages on the scale so far.
But basically the farther from 1's and 0's you get the slower it goes. Actually had a 3 hour lab yesterday writing a program in assembly. (the lowest level language that literally translates what you write into machine code)
Jesus that language is awful. Makes you really appreciate things in Python like: x = "hi"
Learning to program in assembly actually has been the most helpful though in understanding how a computer really truly works at the basic level. For example:
in normal programming languages you can do something like
x = 5
y = 10
z = x+y
So that z ends up being 15 without ever actually explicitly saying yo z, you're 15.
But even simple things in assembly like multiplying by 8 are stupidly hard. At least with what we've learned.
You take the number, and shift its binary value in the register.
In binary numbers are 0 and 1.
0001 is the number 1
0101 is the number 5
0010 is the number 2
In assembly you store the value in something called an accumulator and then perform operations. So to like do the operation 2*8
you would take the binary value of 2, 0010 and shift the most significant bit over left twice to 8: 1000
In assembly the command is LSRA.
So you do that twice and then restore the value in A
looks like:
LSRA
LSRA
STAA
Anyways the whole point here is that low level languages can be freaking hard to do anything in, but are much more efficient if you know what you're doing.
Lua is really far away from binary shifting in the CPU register to do simple steps, but as a result is slower as it needs to get translated to assembly language and then machine code before it is run.
/rant
if you already understood the differences between high level languages and low level languages, then why did you post your original question? you were basically asking a question that has the same concept as someone saying "hey, why havent we cured cancer yet? I mean, we have other cures for diseases, seems pretty easy to me."
you have a lot to learn about computer science kid.
also, secondly, I believe ns2 is using physx to do all the ragdoll physics, etc. I believe physx will pick up an available core if you dont have nvidia hardware.
The real question is, why did you post this, if not to get some sort of ePeen enlargement.
my CPU metering software shows that the 4 cores in my i5 are only being utilized at about 50-60% at peak performance
That's because windows is juggling the threads. It keeps throwing the workload back and forth between all your cores. If you limit ns2.exe to two specific cores, your fps should stay the same while the two cores go up to 100%.
Comments
All of the NS2 game code is in Lua. Skulk wallwalking, marine jumping, lerk flying, fade blinking is all defined in Lua.
The C++ parts deals with generic things that you need in any first person shooter, like animation, timing, cameras, network, interpolation/compensation etc.
But there is no NS2 specific code in the Spark engine.
I'll let my GTX670 know. Thanks!
@Matso, incredible that all game code is Lua, this sounds like overkill lol.
It's not.
if you already understood the differences between high level languages and low level languages, then why did you post your original question? you were basically asking a question that has the same concept as someone saying "hey, why havent we cured cancer yet? I mean, we have other cures for diseases, seems pretty easy to me."
you have a lot to learn about computer science kid.
also, secondly, I believe ns2 is using physx to do all the ragdoll physics, etc. I believe physx will pick up an available core if you dont have nvidia hardware.
The real question is, why did you post this, if not to get some sort of ePeen enlargement.