3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: 'you' and c_scan
[Re: Superku]
#474532
10/22/18 06:33
10/22/18 06:33
|
Joined: Apr 2017
Posts: 106
3dgamelight
Member
|
Member
Joined: Apr 2017
Posts: 106
|
Having one game loop is the way to go IMO, so as long as your project isn't that complex already change it. wait(1) is rather "slow"[...] With Lite-C 10,000 functions could run at the same time so avoiding wait will be pointless for many games.
|
|
|
Re: 'you' and c_scan
[Re: Superku]
#474639
10/26/18 20:27
10/26/18 20:27
|
Joined: Apr 2017
Posts: 106
3dgamelight
Member
|
Member
Joined: Apr 2017
Posts: 106
|
I can't get because wait makes debugging difficult. Your problem with proc_mode is documented " It is automatically reset by wait() for not affecting further functions, but restored when the function continues". By default the order is not random: "the execution order of functions is determined by the order of their calls" I remember having performance issues when I used while loop for each NPC etc. This only makes sense if you need many functions active. With Lite-C more than 30000 functions could be waiting at the same time with a good fps.
Last edited by 3dgamelight; 10/26/18 20:53.
|
|
|
Re: 'you' and c_scan
[Re: 3dgamelight]
#474650
10/27/18 06:11
10/27/18 06:11
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I remember having performance issues when I used while loop for each NPC etc. This only makes sense if you need many functions active. With Lite-C more than 30000 functions could be waiting at the same time with a good fps. It's actually so funny to read You probably didn't understand what Superku (me) was talking about. Just to make things more clear for you, try to run 30.000 npc at the same time, make sure each of them will have it's own while loop, share your results here When you will fail, try to run at least 10.000 npc, all at the same time, make sure each npc has it's own while loop running, share your results (as screen shots, with debug panel ON). Best regards
|
|
|
Re: 'you' and c_scan
[Re: 3run]
#474651
10/27/18 08:07
10/27/18 08:07
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
Optimizing for more than 200 fps on the target platform do not makes sense. 200 fps with 30.000 while loops running ? This is acknex, not unreal 4. Theres no way to have even 50fps with 5.000 npcs and while loops. In a normal project, 20 while Loop npcs with c_move+ent_animate are enough to kill performance already.
Last edited by rayp; 10/27/18 08:10.
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
Re: 'you' and c_scan
[Re: rayp]
#474652
10/27/18 11:17
10/27/18 11:17
|
Joined: Jun 2007
Posts: 1,337 Hiporope and its pain
txesmi
Serious User
|
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
The only way of speaking about the offtopic is with numbers.
-----------------------------------------
| a wait per entity | own scheduler |
| 1 byte stack | 1 byte stack |
-----------------------------------------
| a wait per entity | own scheduler |
| 128 bytes stack | 128 bytes stack |
-----------------------------------------
Notice that the stack memory size has also its impact in the difference.
#include <acknex.h>
#include <default.c>
#define ENT_COUNT 10000
#define STACK_SIZE 1
#define COMPLEXITY 1
ENTITY *ents[ENT_COUNT];
action actWait() {
BYTE _n[STACK_SIZE];
while(1) {
int _i = 0;
for(; _i<COMPLEXITY; _i+=1)
_n[random(STACK_SIZE)] = random(256);
wait(1);
}
}
var actList(ENTITY *_ent) {
BYTE _n[STACK_SIZE];
int _i = 0;
for(; _i<COMPLEXITY; _i+=1)
_n[random(STACK_SIZE)] = random(256);
return -1;
}
void entLoop () {
while(!key_esc) {
wait(1);
ENTITY **_ent = ents;
ENTITY **_entLast = _ent + ENT_COUNT;
for(; _ent<_entLast; _ent++) {
if(*_ent == NULL)
continue;
var _result = actList(*_ent);
if(_result == 0)
continue;
switch(_result) {
case 1:
ent_remove(*_ent);
*_ent = NULL;
break;
case 2:
ent_remove(*_ent);
*_ent = NULL;
break;
case 3:
ent_remove(*_ent);
*_ent = NULL;
break;
case 4:
ent_remove(*_ent);
*_ent = NULL;
break;
case 5:
ent_remove(*_ent);
*_ent = NULL;
break;
case 6:
ent_remove(*_ent);
*_ent = NULL;
break;
case 7:
ent_remove(*_ent);
*_ent = NULL;
break;
case 8:
ent_remove(*_ent);
*_ent = NULL;
break;
case 9:
ent_remove(*_ent);
*_ent = NULL;
break;
case 10:
ent_remove(*_ent);
*_ent = NULL;
break;
case 11:
ent_remove(*_ent);
*_ent = NULL;
break;
case 12:
ent_remove(*_ent);
*_ent = NULL;
break;
case 13:
ent_remove(*_ent);
*_ent = NULL;
break;
case 14:
ent_remove(*_ent);
*_ent = NULL;
break;
case 15:
ent_remove(*_ent);
*_ent = NULL;
break;
case 16:
ent_remove(*_ent);
*_ent = NULL;
break;
case 17:
ent_remove(*_ent);
*_ent = NULL;
break;
case 18:
ent_remove(*_ent);
*_ent = NULL;
break;
case 19:
ent_remove(*_ent);
*_ent = NULL;
break;
default:
break;
}
}
}
}
void main () {
max_entities = ENT_COUNT;
void _act ();
_act = actWait;
// _act = actList;
level_load("");
def_debug();
int _i = 0;
for(; _i<ENT_COUNT; _i+=1)
ents[_i] = ent_create(SPHERE_MDL, vector(0, 0, -1000), _act);
if(_act == actList)
entLoop();
}
I gived a bit of complexity to the scheduler loop so it can be considered a complete flux manager. The numbers speak by themself. It is clear it gains performance with a single while loop but it is not that much. Take into account that we are speaking about a difference of 3/10000 ms/ent: the time taken by few operations. Bad programming practices will waste more time. Salud!
|
|
|
|