Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
1 registered members (AndrewAMD), 599 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
Re: Destroy a block-model && Cam rotation around a fix point [Re: Espér] #236977
11/17/08 13:57
11/17/08 13:57
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
Ok the idea is to create one big and oriented bitmap that covers the whole map at the height of my blocks.
I will erase parts of the bitmap depending on what squares should be visible, and create floor/wall tiles under the parts that I erase of the bitmap.
That way I dont create tons of entities on game start, I only create them when they are visible, and and erase squares of the bitmap at the positions that are now visible.

I am trying to do this based on "fog of war" code that does something similar but erases circles.

The code is not mine, it is extracted form the CC turorial, I am just trying to modify it for what I need to do.

Code:
 action fog_war_spr {
	my.passable = on;
	my.overlay = on;
	my.oriented = on;
	my.tilt = 90;
	fog_war = my;
	fog_war_map = bmap_for_entity(my,0);
	}
	
action soldier {
	my.mode = mode_stand;
	my.speed = 6;
	my.agility = 40;
	my.team = 1;
	my.sight_dist = 200;
	my.anim_index = random(100); //randomize animation a little
	you = ent_create(select_ring_spr,my.x,select_ring);
	you.parent_handle = handle(me);
	you = ent_create(hbar_back_spr,my.x,hbar_back);
	you.parent_handle = handle(me);
	my.enable_scan = on;
	my.enable_Detect = on;
	my.event = soldier_scan_Event;
	while(1) {
		if(my.mode == mode_stand) {	//stand
			my.anim_index += time;
			my.fog_scan -= 0.1 * time;
			ent_Animate(my,"stand",my.anim_index,anm_cycle);
			}
		
		if(my.mode == mode_move) {		//move to location stored in my.target_x
			my.force_x = my.speed * time;
			vec_diff(temp,my.target_x,my.x);
			vec_to_angle(my.ang_pan,temp);
			temp_ang.pan = ang(my.ang_pan - my.pan);
			if(temp_ang.pan > 0) { my.pan += min(my.agility * time,abs(temp_ang.pan));	}
			if(temp_ang.pan < 0) { my.pan -= min(my.agility * time,abs(temp_ang.pan));	}
			my.anim_index += 5 * time;
			ent_animate(my,"run",my.anim_index,anm_cycle);
			my.unit_scan -= time;
			if(my.unit_scan <= 0) {
				my.unit_scan = unit_scan_time;
				vec_set(temp,vector(360,360,100));
				you = null;
				scan_entity(my.x,temp);
			}			
			move_friction = 0;	
			move_mode = ignore_passable + glide;
			ent_move(my.force_x,nullvector);
			
			if(vec_dist(my.target_x,my.x) < 40) {	//close enough to destination -> stop moving
				my.mode = mode_stand;
				my.anim_index = 0;
				}
			}	
				
		if(my.selected == on && dest_set) {   
			vec_Set(my.target_X,dest_pos);
			my.mode = mode_move;
			if(my.mode != mode_move) {my.anim_index = 0;}
			}	
			
		if(left_pressed) {my.selected = off;}	

		if(fog_war_map != null && fog_war != null && my.fog_scan <= 0) {						
			vec_set(clearfog,my.x);
			clearfog.x *= -(1/fog_war.scale_X);	//invert x coord
			clearfog.y *= (1/fog_war.scale_y);			
			vec_add(clearfog,vector(500,500,0));
			clearfog.z = 0;
			temp_format = bmap_lock(fog_war_map,0);
			temp_pixel = pixel_for_vec(vector(0,0,0),0,temp_format);
			clear_circle(clearfog,my.sight_dist,temp_pixel);
			bmap_unlock(fog_war_map);
			my.fog_scan = fog_scan_Time;
			}
		if(my.mode != mode_Stand) {my.fog_scan -= time;}	
		wait(1);
		}	
	
	}

function clear_circle(&center,rad,pixel) {		//clear out a circle of fog_war_map
	var p[3];
	var cen[3];
	vec_set(cen,center);
	var bound1[3];
	var bound2[3];
	rad *= 1/fog_war.scale_X;
	vec_set(bound1,vector(cen.x - rad,cen.y - rad,0));
	vec_set(bound2,vector(cen.x + rad,cen.y + rad,0));
	vec_set(p,bound1);
	while(p.y <= bound2.y) {
		p.x = bound1.x;
		while(p.x <= bound2.x) {
			if(vec_dist(p,cen) <= rad) {
				pixel_to_bmap(fog_war_map,p.x,p.y,pixel);
				}			
			p.x += 1;
			}
		p.y += 1;
		}



"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Destroy a block-model && Cam rotation around a fix point [Re: Carlos3DGS] #236994
11/17/08 15:20
11/17/08 15:20
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
same idea
My code works well...

But fps are nearly not visible with 150x150 ents...

And the loading time for all that entities is high ( more than 5 minutes for 150x150 map )...


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Destroy a block-model && Cam rotation around a fix point [Re: Espér] #237143
11/18/08 16:53
11/18/08 16:53
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
What im trying to do is to not need to load all 150x150 entities, I dont load any entities that are under the "fog of war".

I only load the entities that are visible under the "erased parts" of the fog of war.


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Destroy a block-model && Cam rotation around a fix point [Re: Carlos3DGS] #237165
11/18/08 18:29
11/18/08 18:29
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
hey.. that´s an idea.. will try to wirte a code tomorrow..


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Destroy a block-model && Cam rotation around a fix point [Re: Espér] #237197
11/18/08 20:40
11/18/08 20:40
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Beware reaper,
In the long run, by the end of the level, a great many,if not all, of the entity-blocks will be visible.
So the level will get laggier the more of it is discovered, unless you fog-of-war
hide the blocks that are most distant from the camera.

But try anyway, it may be usable, it IS a good idea, but I never tried it because I thought what I just
said above was enevitable. But Ive been wrong before. wink


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Destroy a block-model && Cam rotation around a fix point [Re: EvilSOB] #237210
11/18/08 23:06
11/18/08 23:06
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Got a way:

The not diggable blocks are ONE Block-Model, with a hole of the diggables inside.
So i just have to view the blocks, the player is able to destroy.

Un-diggables = 1 Model
Floor = 1 Model
Water and Lava = 1 Model

And not the complete Map is filled with blocks. There will be pre-defined watertunnels ( like in the original dungeon keeper ). And those tunnels are not closed ^^

That should make that thing more faster.

Last edited by xXReapeRXx; 11/18/08 23:13.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Destroy a block-model && Cam rotation around a fix point [Re: Espér] #237216
11/19/08 00:17
11/19/08 00:17
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Oh yeah, good thought.

Keep me informed on how its going as you get places.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Destroy a block-model && Cam rotation around a fix point [Re: EvilSOB] #237218
11/19/08 00:23
11/19/08 00:23
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Yeah i will do...

XD.. it scares me if i think of the upcoming problems:
- Pathfinding
- Watershader
- Particle Effects
- Over-earth missions ( building walls/hedges instead of digging the earth )
- Battle and Social AI

*groans*


First i can say:
On a 50x50 Map, loading time is under 10 seconds. FPS are 55+ ( 60 max )

Last edited by xXReapeRXx; 11/19/08 00:23.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Destroy a block-model && Cam rotation around a fix point [Re: Espér] #237222
11/19/08 01:05
11/19/08 01:05
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Hehehe, sound like fun.... heres some suggestions
- Pathfinding = steal other peoples work wink
- Watershader = acknex unlimited site / demos / "water shader added"
- Particle Effects = acknex unlimited site / tutorials / "Advanced particle effects"
- Over-earth missions ( building walls/hedges instead of digging the earth ) =
start with the level "all dug out", with un-movable hedges as a border. Un-Dig to build
the hedges.
- Battle and Social AI = no idea, depends on its actual needs.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Destroy a block-model && Cam rotation around a fix point [Re: EvilSOB] #237246
11/19/08 08:01
11/19/08 08:01
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
The AI is meant as follow:

The monster/hero should build his sleeping-place in the sleepeoom
The AI should do: let the entitie find the way to the place he needs to go ( hungry=chicken-farm, hurt/tired=sleeping-place
And while he is doing those things... He has to ask paralell if an enemy entity is near (=start fighting)


That'll be the hardest code. -.-"


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Page 3 of 4 1 2 3 4

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