Gamestudio Links
Zorro Links
Newest Posts
About auto hide invisible entitiesl
by Superku
40 minutes 20 seconds ago
LotAmount and PipCost
by tradingest
Today at 15:17
Bump with detail?
by Superku
Today at 15:16
New Zorro version 1.88
by DdlV
Today at 14:33
CCI and SMA Pullback Strategy
by Materz
Today at 13:34
Position Close not possible
by Paul_der_Zweite
Today at 11:28
CSVToHistory.c
by Paul_der_Zweite
Today at 10:43
AUM Magazine
Latest Screens
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Who's Online
16 registered (AndrewAMD, Jason_Rogers, alibaba, 20BN, 3run, Dalla, MatPed, kvm, 2 invisible), 444 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
egkachai, cepturion, Mon3y, vincitytaymo, just
18058 Registered Users
Topic Options
Rate This Topic
#474014 - 09/07/18 18:11 About auto hide invisible entitiesl
20BN Online
Member

Registered: 02/08/03
Posts: 108
Loc: RP China
Hi, all.
If every game levels has 3000-5000 entities,
need to hide outside of camera sight.
Do you have any plans?

Top
#474161 - Today at 05:19 Re: About auto hide invisible entitiesl [Re: 20BN]
Dooley Offline
User

Registered: 05/12/05
Posts: 587
Loc: Chicago, IL
camera.clip_near
camera.clip_far

Look these up in manual
_________________________
Check out "Star Explorers" on Steam:
http://store.steampowered.com/app/502720/Star_Explorers/

Anomalies released on Steam: http://store.steampowered.com/app/546780


Top
#474163 - Today at 08:36 Re: About auto hide invisible entitiesl [Re: 20BN]
HellThunder Offline
Member

Registered: 11/14/05
Posts: 190
Loc: Bavaria
You could use the part of this while loop for hiding entities. Related to the camera position and the culling_distance, it will hide your entities or show them again. This code snippet was a part of AUM - original was C-Script.
Code:
var culling_distance = 4000;
action NULL_() 
{
 while(me)
 {
	if (vec_dist (my.x, camera.x) < culling_distance) // the player has come close to this entity?
	{
		reset(my, INVISIBLE); // then show it!
		while (my.alpha < 100) // run this loop until the entity becomes opaque again
		{
			my.alpha = minv(100, my.alpha + 15 * time_step); // increase my.alpha (15 = speed) and limit it to 100
			wait (1);
		}
		reset(my, TRANSLUCENT); // get rid of some nasty artifacts when the entity is completely visible
	}
	else // the player has moved away from this entity?
	{
		set(my, TRANSLUCENT);  // then set the "transparent" flag again
		while (my.alpha > 0) // run this loop until the entity becomes practically invisible (alpha = 0)
		{
			my.alpha = maxv(0, my.alpha - 15 * time_step); // decrease my.alpha (15 = speed) and limit it to 0
			wait (1);
		}
		set(my, INVISIBLE); // now hide the entity in order to increase the frame rate

	}
        wait(1);
 }
}


Top
#474175 - Today at 16:26 Re: About auto hide invisible entitiesl [Re: HellThunder]
20BN Online
Member

Registered: 02/08/03
Posts: 108
Loc: RP China
In other words, 1000 entities, there will be 1000 processes?

Top
#474176 - 43 minutes 0 seconds ago Re: About auto hide invisible entitiesl [Re: 20BN]
Superku Online
Senior Expert

Registered: 09/13/03
Posts: 6750
Loc: Kiel (Germany)
I'm sorry but don't use that code quoted by HellThunder. Do not do this manually, esp. not with dedicated wait(1) loops per entity. This is an engine's task.

Entities not on screen in the sense of the camera's frustum are set to invisible/ CLIPPED automatically.


For distance based clipping camera.clip_far or LOD is the correct approach.
For special cases such as a building full of entities you can use region_set in A8 to hide all entities contained in that region manually.


If the entity count (and draw count) is a problem performance wise, you may want to think about combining multiple entities into one.
_________________________
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Superku The Game

Severely outdated footage: http://store.steampowered.com/app/407570

Top


Moderator:  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