Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Ayumi, Quad, PeWi), 488 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
'you' and c_scan #474396
10/11/18 19:36
10/11/18 19:36
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Hi guys. I'm back to Acknex, and facing indeed a very noobish problem.
c_scan doesn't set 'you' pointer, in EVENT_SCAN for scanned entity..

Take a look at this code, press space key and you will get error:
Code:
#define PRAGMA_POINTER

void ph_object_event(){
	
	if(event_type == EVENT_SCAN){
		
		set(you, INVISIBLE);
		
	}
	
}

void main(){
	
	warn_level = 6;
	level_load("");
	
	vec_set(&camera->x, vector(-250, 0, 100));
	vec_set(&camera->pan, vector(0, -10, 0));
	
	ENTITY *ent1 = ent_create(CUBE_MDL, nullvector, NULL);
	set(ent1, PASSABLE | TRANSLUCENT);
	
	ENTITY *ent2 = ent_create(CUBE_MDL, vector(0, 32, 32), NULL);
	ent2->emask |= (ENABLE_SCAN);
	ent2->event = ph_object_event;
	
	while(!key_esc){
		
		if(key_space){
			
			if(ent1->skill1 == 0){
				
				c_scan(&ent1->x, &ent1->pan, vector(360, 0, 200), SCAN_LIMIT);
				ent1->skill1 = 1;
				
			}
			
		}
		else{
			
			ent1->skill1 = 0;
			
		}
		
		wait(1);
		
	}
	
}



Can anyone tell me, what's wrong in this code? Thank you guys.

Edit: can't get ENABLE_DETECT working too.. this makes me mad. I set ENABLE_DETECT for entity that performs the c_scan, and ENABLE_SCAN for scanned entity... in the event of scanning entity, I try to make all scanned entities INVISIBLE, but just nothing happens (as if scanning doesn't find any entities with ENABLE_SCAN event set on).


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: 'you' and c_scan [Re: 3run] #474398
10/11/18 20:24
10/11/18 20:24
Joined: Nov 2005
Posts: 204
Bavaria
HellThunder Offline
Member
HellThunder  Offline
Member

Joined: Nov 2005
Posts: 204
Bavaria
Hi 3run,

I think there are two possible ways, in dependence of the needed result.

If you want this one entity (ent2) to hide after scaning it, you need to take the my pointer instead of the you pointer for its event. This would be the first solution.
Code:
////////////////////////////////////////////////////////////////////////
// Template main script:
// Created by WED.
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
// entry: Start Level
// entry_help: Name of the level loaded at start
char* t_levelname = "%NAME%.wmb";

////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#define PRAGMA_POINTER

void ph_object_event(){
	
	if(event_type == EVENT_SCAN){
		
		//if(my)
		set(my, INVISIBLE);
		
	}
}
void main(){
	
	warn_level = 6;
	level_load("");
	
	vec_set(&camera->x, vector(-250, 0, 100));
	vec_set(&camera->pan, vector(0, -10, 0));
	
	ENTITY *ent1 = ent_create(CUBE_MDL, nullvector, NULL);
	
	set(ent1, PASSABLE | TRANSLUCENT);
	
	ENTITY *ent2 = ent_create(CUBE_MDL, vector(0, 32, 32), NULL);
	ent2->emask |= (ENABLE_SCAN);
	ent2->event = ph_object_event;
	
	while(!key_esc){
		
		
		if(key_space){
			
			if(ent1->skill1 == 0){
				
				c_scan(&ent1->x, &ent1->pan, vector(360, 0, 200), SCAN_ENTS | SCAN_LIMIT );
			}
			
		}
		else{
			
			ent1->skill1 = 0;
			
		}
		wait(1);
	}
	
}





If ent1 should be able to hide all entities which will be, you have to assign the event to ent1 and enable scan for it too. Then the you pointer would work too.
Code:
void ph_object_event(){
	
	if(event_type == EVENT_SCAN){
		
		if(you)
		set(you, INVISIBLE);
		
	}
}
void main(){
	
	warn_level = 6;
	level_load("");
	
	vec_set(&camera->x, vector(-250, 0, 100));
	vec_set(&camera->pan, vector(0, -10, 0));
	
	ENTITY *ent1 = ent_create(CUBE_MDL, nullvector, NULL);
	ent1->emask |= (ENABLE_SCAN);
	
	set(ent1, PASSABLE | TRANSLUCENT);
	
	ENTITY *ent2 = ent_create(CUBE_MDL, vector(0, 32, 32), NULL);
	ent2->emask |= (ENABLE_SCAN);
	ent1->event = ph_object_event;
	
	while(!key_esc){
		
		
		if(key_space){
			
			if(ent1->skill1 == 0){
				
				c_scan(&ent1->x, &ent1->pan, vector(360, 0, 200), SCAN_ENTS | SCAN_LIMIT );
			}
			
		}
		else{
			
			ent1->skill1 = 0;
			
		}
		wait(1);
	}
	
}




Cheers!

Last edited by HellThunder; 10/11/18 20:27. Reason: my condition wasn't needed

Create your own JRPG and join our community: https://www.yrpgtoolkit.com
Re: 'you' and c_scan [Re: HellThunder] #474399
10/11/18 20:51
10/11/18 20:51
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Hey HellThunder! Thank you for a quick help!

About MY instead of YOU pointer, in the event in order to make scanned entity invisible grin No, that wasn't a point of my question (you probably mistaken with what I wrote about ENABLE_DETECT). I just couldn't get pointer to the scanning entity, which should be in this case YOU pointer. I was expecting (almost all events work this way) ENABLE_SCAN event to set YOU pointer automatically to the scanning entity, but in my example it didn't work and resulted in E1513. Yes, I could add if(you) check in order to avoid poping up error message grin But my case was - 'why doesn't ENABLE_SCAN set YOU pointer to the scanning entity?'.

Your second solution is what I tried to do with ENABLE_SCAN, but why didn't it work in my example? Isn't setting ENABLE_SCAN for entity which should be scanned enough to set you pointer? I used c_scan with SCAN_LIMIT but without setting SCAN_ENTS, could that cause the problem?

Edit: just noticed that you set ENABLE_SCAN for ent2 and event function for ent1.. Why? Usually when you use events, you set event and the event function which should be triggered for the same entity, right? (as for ENABLE_BLOCK, IMPACT, ENTITY, SHOOT etc).

Edit2: added a picture, to make it more clear grin



Edit3: now this is weird... maybe tomorrow with a fresh head I'll find out the difference, but I got it working (as it should work!) here:
Code:
#define PRAGMA_POINTER

void obj_event(){
	
	if(event_type == EVENT_SCAN){
		
		set(you, INVISIBLE);
		
	}
	
}

void obj(){
	
	c_setminmax(my);
	set(my, POLYGON);
	
	my->emask |= (ENABLE_SCAN | ENABLE_FRAME);
	my->event = obj_event;
	
}

void hero(){
	
	while(my){
		
		if(key_space == 1){
			
			if(my->skill1 == 0){
				
				c_scan(&my->x, &my->pan, vector(360, 0, 200), SCAN_LIMIT);
				my->skill1 = 1;
				
			}
		}
		else{
			
			my->skill1 = 0;
			
		}
		
		wait(1);
		
	}
	
}

void main(){
	
	warn_level = 6;
	level_load("");
	
	vec_set(&camera->x, vector(-250, 0, 100));
	vec_set(&camera->pan, vector(0, -10, 0));
	
	ent_create(CUBE_MDL, nullvector, hero);
	ent_create(CUBE_MDL, vector(0, 32, 32), obj);
	
}

But anyway, I can't understand, why my first example doesn't work??

Edit4: seems that I got it working only cause I've put 'c_scan' into the 'hero' function.. If I assign to that entity a pointer and try to c_scan from main function, it gives E1513.. And I can't understand why.

My best regards! Thank you for your time and help!

Last edited by 3run; 10/11/18 21:30.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: 'you' and c_scan [Re: 3run] #474400
10/12/18 09:46
10/12/18 09:46
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
The reason that your first example does not yield the desired result (set the you pointer) is that the my pointer is NULL in the main function.
c_scan does not have an entity parameter (compared to let's say c_move) as you are aware:

c_scan (VECTOR* pos, ANGLE* ang, VECTOR* sector, var mode)

When you use ent1->x and ent1->pan as arguments you "lose" all context to the entity (ent1).
Workaround for keeping it in the main function:

me = ent1; // or save the old me pointer in case you use stuff like this somewhere else, ENTITY* oldMe = me;
c_scan(...);
me = NULL; // me = oldMe;


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: 'you' and c_scan [Re: Superku] #474402
10/12/18 10:33
10/12/18 10:33
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted By: Superku
c_scan does not have an entity parameter (compared to let's say c_move) as you are aware:

c_scan (VECTOR* pos, ANGLE* ang, VECTOR* sector, var mode)
Superku, you (as always) just opened my eyes. I missed such an obvious part... cry
Thank you very much for being part of this community!

My best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: 'you' and c_scan [Re: 3run] #474428
10/15/18 04:07
10/15/18 04:07
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline
Serious User
jumpman  Offline
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Is it really worth it to put the whole game loop into main? Is having separate actions/whiles that bad?

Re: 'you' and c_scan [Re: jumpman] #474431
10/15/18 08:51
10/15/18 08:51
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted By: jumpman
Is it really worth it to put the whole game loop into main? Is having separate actions/whiles that bad?
Don't take example in my first post too serious, I just wanted to prototype something and faced this prob (cause I'm dumb grin ). In my projects, I usually use 'event_frame' instead of while loops, for entities, props etc (thanks to MasterQ32). Then one while loop inside of player's action (player's movement, weapons etc), and one loop inside of main function for all gui, shader pipeline etc. I think it's better to avoid using loops, if possible. I remember having performance issues when I used while loop for each NPC etc.

Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: 'you' and c_scan [Re: 3run] #474434
10/15/18 10:12
10/15/18 10:12
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
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" and you have no real influence on when functions are executed. proc_mode (in particular PROC_GLOBAL) is a game and project killer, leading to seemingly random crashes as it affects all kinds of functions you don't want it to have an impact on. Example:
Click to reveal..
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////

void projectile()
{
    my.skill1 = 128;
    my.pan = random(20)-10;
    my.tilt = random(20)-10;
    while(my.skill1 > 0)
    {
        c_move(me,vector(16*time_step,0,0),nullvector,0);
        my.skill1 -= time_step;
        
        VECTOR temp;
        vec_set(temp,my.x);
        if(vec_to_screen(temp,camera)) draw_text(str_printf(NULL,"%d",(int)proc_mode),temp.x,temp.y,COLOR_RED);
        
        wait(1);
    }
    ptr_remove(me);
}

void spawnProjectile()
{
    proc_mode = PROC_GLOBAL;
    wait(1); // <- doesn't help as proc_mode is restored after wait
    ent_create(CUBE_MDL,vector(0,random(16)-8,0),projectile);
}

void reload()
{
    level_load(NULL);
}

void main()
{
    fps_max = 60;
    video_mode = 10;
    level_load(NULL);
    on_mouse_left = spawnProjectile; // press left mouse button a few times,
    on_mouse_right = reload; // then the right mouse button to crash the game
}



What I've done for the past few years for new projects was to use on_frame, like this:

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

// header files
#include "player.h"

// implementation:
#include "player.c"

///////////////////////////////

void mainFrameEvent()
{
	input update function;
	if(gameMode == GAME_MODE_PLAY)
	{
		objectsUpdate();
		enemiesUpdate();
		playerUpdate();
	}
	if(gameMode == other modes) { ... }
}

void main()
{
	fps_max = 60;
	level_load(NULL);
	...
	on_frame = mainFrameEvent;
}



This way you have complete control over what gets executed when and how. You could for example freeze all enemies or projectiles in the game with a simple if(variable) check, while allowing the player to move freely.
You only have to let's say create a list of objects after level_load (on_level_load or what it's called) and free that list on or before level change.

I still use wait(1) entity loops here and there but just for some level decoration/ dynamic objects which don't have an actual influence on gameplay.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: 'you' and c_scan [Re: Superku] #474435
10/15/18 14:08
10/15/18 14:08
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Superku, that's an awesome idea! Got to give it a try. Thank you very much!

Edit: it's sad that you can't find anything about 'on_frame' in manual.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: 'you' and c_scan [Re: 3run] #474436
10/15/18 15:23
10/15/18 15:23
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Originally Posted By: 3run

Edit: it's sad that you can't find anything about 'on_frame' in manual.


There is a title about on_frame... but only in A7 manual i guess. That's weird.


Re: 'you' and c_scan [Re: Emre] #474437
10/15/18 15:24
10/15/18 15:24
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
That's indeed very strange... Thank you for sharing it with us Emre! laugh


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: 'you' and c_scan [Re: Superku] #474532
10/22/18 06:33
10/22/18 06:33
Joined: Apr 2017
Posts: 106
3
3dgamelight Offline
Member
3dgamelight  Offline
Member
3

Joined: Apr 2017
Posts: 106
Originally Posted By: Superku
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: 3dgamelight] #474535
10/22/18 08:51
10/22/18 08:51
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Sorry, but you are wrong. A big project is super tough to manage and debug when using wait. The initial setup is a little easier but that's about it, no other advantages, only disadvantages.
Btw. 10000 waits eat up 2ms of performance already on a 6700k. You'd have to do one hell of an optimization to save 2ms normally, or you could just NOT use wait.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: 'you' and c_scan [Re: Superku] #474639
10/26/18 20:27
10/26/18 20:27
Joined: Apr 2017
Posts: 106
3
3dgamelight Offline
Member
3dgamelight  Offline
Member
3

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"

Originally Posted By: 3run
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] #474643
10/26/18 22:00
10/26/18 22:00
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
I think 3run and Superku are right here. Whiles and waits killing fps very fast in a bit bigger Project.

Last edited by rayp; 10/27/18 00:11.

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] #474649
10/27/18 05:23
10/27/18 05:23
Joined: Apr 2017
Posts: 106
3
3dgamelight Offline
Member
3dgamelight  Offline
Member
3

Joined: Apr 2017
Posts: 106
Optimizing for more than 200 fps on the target platform do not makes sense.

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 Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted By: 3dgamelight
Originally Posted By: 3run
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 grin 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 grin
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


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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 Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Quote:
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 Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
The only way of speaking about the offtopic is with numbers.



Code:
-----------------------------------------
| 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.

Click to reveal..

Code:
#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!

Re: 'you' and c_scan [Re: HellThunder] #476068
01/24/19 06:44
01/24/19 06:44
Joined: Jan 2019
Posts: 1
None
S
sneha Offline
Guest
sneha  Offline
Guest
S

Joined: Jan 2019
Posts: 1
None
Hi HellThunder,
Excellent, I agree with you.

Re: 'you' and c_scan [Re: 3run] #481335
08/28/20 11:44
08/28/20 11:44
Joined: Aug 2020
Posts: 3
R
Raveeshyui Offline
Guest
Raveeshyui  Offline
Guest
R

Joined: Aug 2020
Posts: 3
Very useful post Thanks

Page 1 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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