Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (EternallyCurious, howardR), 646 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
C++ vs. Lice-C performance #454204
09/01/15 09:09
09/01/15 09:09
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline OP
Expert
sivan  Offline OP
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
Hi,

do you have any comparison tests or idea about the difference of (nearly) similar Lite-C and C++ codes? (And C# just for fun.)

My experinces:
Recently I have ported the static part of my RTS map decomposition codes to UE4, which - surprisingly for me - works at least 10, maybe 30 times faster than in 3DGS (1-1.5 sec stop in UE4 game thread what is approx. 30sec with 3DGS but with a few interim waits to avoid long freezing). It consists of large dynamic struct array allocations, several memset and few memcpy of arrays, passing arrays as function parameters by pointers, large loops with many complex computations. And significant amount of ray tracing, but it is rather an OBB vs. PhysX3.3 question (it is fast enough with 3DGS, lightning fast with PhysX).

I know it is heavily code dependent as it can be seen in C++ vs. C# benchmarks, but I would like to get a rough idea and a confirmation of that my AI related codes also would run similarly faster with UE4-C++ than in 3DGS-Lite-C (consisting of mainly dynamic array struct management - lot of array memsets, and loops through arrays - and expensive computations like tons of A* pathfinding). Moreover in Ue4-C++ I can convert my codes to run in separate threads in the background for the cost of more memory (each thread would require its own, not like when they are running after each other). Or course UE4 actor system and ticking is different from 3DGS entity system, where I could avoid using separate waits for my RTS units (I use only one loop with wait() as the main game loop and another for MapBuilder editor UI loop).

Thanks for any info laugh


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: C++ vs. Lice-C performance [Re: sivan] #454207
09/01/15 09:25
09/01/15 09:25
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Just use a high precise timer and check the times of a test app you made.
I bet C++ is a little bit faster then lite-c because of better compiler optimizations but C# isnt comparable at all. I had a simple .net program which should read the bytes of a file and write them to a text file. It ran for around 5 hours where my C++ programm took 3 seconds...

Re: C++ vs. Lice-C performance [Re: Ch40zzC0d3r] #454208
09/01/15 10:44
09/01/15 10:44
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline OP
Expert
sivan  Offline OP
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I asked C# only for curiosity. I will probably switch to C++ and UE4 (more attracting than C# and Unity for me), and keep Lite-C and 3DGS only as a fast-to-develop test bed because I am familiar with it.

as I remember earlier on the 3dgs home page it was mentioned that Lite-C is faster than C#, now it is compared only to scripting languages. I saw a couple of benchmarks where surprisingly C# was faster than C++.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: C++ vs. Lice-C performance [Re: sivan] #454211
09/01/15 11:40
09/01/15 11:40
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
c++ and c# comparison depends highly on what you are doing and how you are doing it.


3333333333
Re: C++ vs. Lice-C performance [Re: Quad] #454212
09/01/15 11:44
09/01/15 11:44
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Lite-C is more then a scripting language, the code itself gets translated to direct assembler, the question is how good this translation is.
And seriously, if you create a multiplayer game dont even think about the word unity. Even the greatest retards can drag a dll into their project and use YOUR classes and functions because .net code isnt secured in any way.
UE4 reversing is not even close to what happened to UE3.
On UE3 you are able to dump a whole SDK for your game hacks by injecting a DLL to the game. But Im sure the same will happen to UE4 some day

Last edited by Ch40zzC0d3r; 09/01/15 11:45.
Re: C++ vs. Lice-C performance [Re: Ch40zzC0d3r] #454213
09/01/15 12:12
09/01/15 12:12
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
UE3 was using unreal script, some sort of jvm-like vm language. UE4 uses c++ i doubt that will happen


3333333333
Re: C++ vs. Lice-C performance [Re: Quad] #454214
09/01/15 12:33
09/01/15 12:33
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Originally Posted By: Quad
UE3 was using unreal script, some sort of jvm-like vm language. UE4 uses c++ i doubt that will happen


They still save function and class names/size with the UE4 insert class member macro wink

Last edited by Ch40zzC0d3r; 09/01/15 12:33.
Re: C++ vs. Lice-C performance [Re: Ch40zzC0d3r] #454215
09/01/15 12:58
09/01/15 12:58
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline OP
Expert
sivan  Offline OP
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
multiplayer is a future plan for me, but the current UE4 system does not really suits an RTS (but they have plans to extend it at least). there are several other RTS projects in development, I will see how they work, or stay with single player only.

the thread again went a bit offtopic.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: C++ vs. Lice-C performance [Re: sivan] #454266
09/02/15 19:42
09/02/15 19:42
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Naturally, the Lite-C compiler isn't as optimized as the Visual Studio compiler, period. So, it is a well known secret that if you do your code in a DLL, it is a lot fast. So, if code execution is an issue, just drop it into a DLL function - should be straight forward.

The only thing you can't drop into a DLL are wait(1) calls. So if you rely on classic Gamestudio scheduling, you could build e.g. classes for actors that encapsulate the behaviour which is called by the "framing" wait(1) construct in Lite-C. Sounds awful, though.

Best way would be to design your code with as less wait(1)'s as possible and shift later to DLL.

Re: C++ vs. Lice-C performance [Re: HeelX] #454267
09/02/15 20:02
09/02/15 20:02
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline OP
Expert
sivan  Offline OP
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
thanks for the detailed answer.
apparently my code is the bottleneck again (but I should do again a deeper analysis again to define which parts), so it means I could put my whole game loop into a dll...


Free world editor for 3D Gamestudio: MapBuilder Editor
Page 1 of 3 1 2 3

Moderated by  TWO 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1