|
Page 1 of 2 |
|
|
Back to top |
|
 |
Epsilon
Dr. Strangelove
Posts: 9240
Location: War Room
|
Posted: Sun, 12th Dec 2010 12:31 Post subject: |
|
 |
lol this code is a mess, still it's interesting to look at.
It's mostly C and some asm AND C++ really what a mess.
Goodluck to those who only know C#.
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 16:27 Post subject: |
|
 |
OMG... this proves it! C++ knowledge is infinitely more useful than C# in game programming! Well don't know about other stuff but what is the general consensus?
1 and 2 are still amazing.
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 17:13 Post subject: |
|
 |
Interesting, there sure are a lot of files, mostly in C, couldn't find any concrete gameplay stuff like if water_arrow==flame lights_out
Probably doesn't work that way.
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 17:47 Post subject: |
|
 |
yuri999 wrote: | OMG... this proves it! C++ knowledge is infinitely more useful than C# in game programming! Well don't know about other stuff but what is the general consensus? |
C++ is a must for a game engine, and all performance intensive tasks. By comparing C++ and C# by some generic tasks, the speed difference isn't that great, but when you get to really optimizing your code, C++ will be MUCH faster.
It gives you complete control over memory, so you can align stuff to different boundaries, which is important if you want the data to be optimally placed in CPU cache. It allows you to use SSE, which makes it possible to process 4 pieces of data at once (theoretically giving you 4x speed boost) for problems that can be parallelized in such manner. Those two are probably the most important low-level differences, although there are many more. (Its probably possible do most of that in C# too, by using some hackity way, which defeats the purpose, and makes it more difficult than just making it in C++)
Gameplay and rest is usually C# or some other scripting language because its much easier to work with and maintain.
If you're doing a small game however, where you have resources to spare, C# or some other higher level language will do, and will make things easier.
|
|
Back to top |
|
 |
garus
VIP Member
Posts: 34200
|
Posted: Sun, 12th Dec 2010 17:50 Post subject: |
|
 |
snip
Last edited by garus on Tue, 27th Aug 2024 21:38; edited 1 time in total
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 19:01 Post subject: |
|
 |
BearishSun wrote: | It gives you complete control over memory, so you can align stuff to different boundaries, which is important if you want the data to be optimally placed in CPU cache. It allows you to use SSE, which makes it possible to process 4 pieces of data at once (theoretically giving you 4x speed boost) for problems that can be parallelized in such manner. Those two are probably the most important low-level differences, although there are many more. (Its probably possible do most of that in C# too, by using some hackity way, which defeats the purpose, and makes it more difficult than just making it in C++)
|
Those parts that where done in asm, where probably also done so for performance reasons. I still remember a talk with Civ3 developer who explained that while whole game was done in C, most of the pathfinding routines were done in assembler, since they were most CPU intensive tasks in the game.
|
|
Back to top |
|
 |
LeoNatan
Banned
Posts: 73193
Location: Ramat Gan, Israel 🇮🇱
|
Posted: Sun, 12th Dec 2010 19:07 Post subject: |
|
 |
BearishSun wrote: | yuri999 wrote: | OMG... this proves it! C++ knowledge is infinitely more useful than C# in game programming! Well don't know about other stuff but what is the general consensus? |
C++ is a must for a game engine, and all performance intensive tasks. By comparing C++ and C# by some generic tasks, the speed difference isn't that great, but when you get to really optimizing your code, C++ will be MUCH faster.
It gives you complete control over memory, so you can align stuff to different boundaries, which is important if you want the data to be optimally placed in CPU cache. It allows you to use SSE, which makes it possible to process 4 pieces of data at once (theoretically giving you 4x speed boost) for problems that can be parallelized in such manner. Those two are probably the most important low-level differences, although there are many more. (Its probably possible do most of that in C# too, by using some hackity way, which defeats the purpose, and makes it more difficult than just making it in C++)
Gameplay and rest is usually C# or some other scripting language because its much easier to work with and maintain.
If you're doing a small game however, where you have resources to spare, C# or some other higher level language will do, and will make things easier. |
The smartest thing to do is indeed to combine C++ (w/ ASM optimizations - this is the real performance puller) and C# to get the best of both worlds.
But a word on .NET performance; what you say is not true anymore. With ahead of time compilation, most of what makes CIL slower is removed. While true that in some fields .NET is still a little slower (mainly from full object oriented overhead), claiming that C++ is so much more is a gross exaggeration. As you say, almost everything can be accomplished with C# that can be with C++, and I disagree that these are considered hacks; C# is a powerful language (and CIL of course, but not all .NET languages), and it's for a reason.
|
|
Back to top |
|
 |
garus
VIP Member
Posts: 34200
|
Posted: Sun, 12th Dec 2010 19:09 Post subject: |
|
 |
snip
Last edited by garus on Tue, 27th Aug 2024 21:38; edited 1 time in total
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 19:14 Post subject: |
|
 |
@iNatan
I said that. They are close in performance unless you go into really optimizing the code, and thats where the real differences appear.
You cant use SSE with C#, at least not in a way I know of. That means its at least 4 times slower. (For problems that can benefit from SSE, and those are plenty in games)
You also can't align stuff to cache lines, and with memory latency being a huge bottleneck with todays CPUs, this has great importance on performance. (Although you might be able to do this with unsafe code in C#, i'm not sure)
And what you say about asm is true, it can help with optimizations, but compilers today are so good, that you really really need to know what you are doing, unless you run the risk of ruining the performance instead of improving it. Using asm block essentially tells the compiler: "dont optimize this code". Compiler optimizes the code globally, and that's really hard(impossible) for a programmer to do, which is why local asm blocks can cause issues.
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 19:17 Post subject: |
|
 |
calling c# a programming language is a pretty far shot
|
|
Back to top |
|
 |
LeoNatan
Banned
Posts: 73193
Location: Ramat Gan, Israel 🇮🇱
|
Posted: Sun, 12th Dec 2010 19:23 Post subject: |
|
 |
@BearishSun There is talk that Microsoft will finally introduce SIMD support sometime soon, but this talk has been for a while.
ASM routines are usually used for very specific tasks, not project-wide coding, so if you know to write these routines, you probably know what you are doing. 
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 19:41 Post subject: |
|
 |
I know of Freespace, Saga of Ryzon and Prey.
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 19:46 Post subject: |
|
 |
Bearish can you give us a little outline on how you created the game?
(Development environment, used external libraries(?) and so on)
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 20:32 Post subject: |
|
 |
We used Unity 3D which is really easy to get into. It had all the rendering, audio and and basic network stuff. I extended it with AI editor, resource streaming and management, level of detail and multiplayer capabilities(although the low level support was already there).
Other than that it was mostly simple stuff, gameplay scripting and such.
|
|
Back to top |
|
 |
ixigia
[Moderator] Consigliere
Posts: 65035
Location: Italy
|
Posted: Sun, 12th Dec 2010 20:39 Post subject: |
|
 |
@BearishSun
Awesome, I'm not into programming, but I recognize that you have a lot of talent. Keep working on it! 
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 20:44 Post subject: |
|
 |
Source? This is the first time I read this!
TWIN PEAKS is "something of a miracle."
"...like nothing else on television."
"a phenomenon."
"A tangled tale of sex, violence, power, junk food..."
"Like Nothing On Earth"
~ WHAT THEY'RE TRYING TO SAY CAN ONLY BE SEEN ~
http://www.youtube.com/watch?v=CHTUOgYNRzY
|
|
Back to top |
|
 |
|
Posted: Sun, 12th Dec 2010 20:45 Post subject: |
|
 |
consolitis wrote: |
Source? This is the first time I read this! |
http://www.3drealms.com/news/2006/10/prey_sdk_released.html
From what I can tell it contains all the game source code. I haven't tried compiling it myself though.
Thanks ixigia. We stopped working on it almost a year ago sadly... Most of the team got "real" jobs and didn't have enough time.
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
Epsilon
Dr. Strangelove
Posts: 9240
Location: War Room
|
Posted: Mon, 13th Dec 2010 04:20 Post subject: |
|
 |
SilverBlue wrote: | Paintface wrote: | nice , were these leaked on purpose or stolen ... ? i remember all the drama with the HL2 source being leaked
That said what are the big games that had their source out in the open , legit or not? |
Dont know if I would call it a big game, but Jagged Aliance 2' source code was also released. |
I'd certainly call it so.
|
|
Back to top |
|
 |
|
Posted: Mon, 13th Dec 2010 04:25 Post subject: |
|
 |
I've been toying with that Unreal Source for a while now..Man it's a mess, no wonder it takes a full development team to make anything out of it.
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
Posted: Mon, 13th Dec 2010 10:35 Post subject: |
|
 |
Epsilon wrote: | lol this code is a mess, still it's interesting to look at.
It's mostly C and some asm AND C++ really what a mess.
Goodluck to those who only know C#. | I disagree, if you understand how C# works (internal) instead of copying everything from the internet it's not a big deal to move to C++. I started with Delphi, C# and then I switched to C and later C++, no problems at all really.
|
|
Back to top |
|
 |
Werelds
Special Little Man
Posts: 15098
Location: 0100111001001100
|
Posted: Mon, 13th Dec 2010 12:31 Post subject: |
|
 |
If you only know C#, you won't know how it works internally
A pure C# programmer will most definitely get tons of memory leaks at first in C. C++ is a different story, as a lot of the basic stuff you'd do as a beginner is relatively leak-safe.
Then again, I might not be the best one to ask. Starting with Basic, continuing on to PHP+JS. Simple start right? And then before learning anything else I went to ASM thanks to uni - once you do that, everything seems simple :>
|
|
Back to top |
|
 |
Page 1 of 2 |
All times are GMT + 1 Hour |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group
|
|
 |
|