basemap (ground altitude map) test

  • Thread starter Thread starter utunnels
  • Start date Start date
U

utunnels

Guest
https://www.dropbox.com/s/xbygx4jbcrfa5o1/OpeBOR-win-latest.7z

This feature allow base altitude to be changed. Basically this is used to create slight ground transformation. If you want to create a stair, you need to combine it with a wall or platform. Although current AI mostly doesn't know what is a "stairway",  they may not behave properly.

An example (level.c) that creates a slope.

Code:
void main()
{
	int x, z;
	float delta, a;
	changelevelproperty("basemap", 0, "x", 132);
	changelevelproperty("basemap", 0, "xsize", 144);
	changelevelproperty("basemap", 0, "z", 230);
	changelevelproperty("basemap", 0, "zsize", 26);
	delta = 89.0/144.0;
	for(x=0; x<144; x++)
	{
		a = x*delta;
		if(x+132>270) a = 89; // connect with the wall more smoothly
		for(z=0; z<26; z++)
		{
			changelevelproperty("basemap", 0, "map", x,z, a);
		}
	}
}

A wall is required to the right if you want to block the path from that direction.

wall 273 256 0 0 3 3 26 89




[attachment deleted by admin]
 
let me get this strait. So this is to create an angled platform that can be used like stairs to get to higher platforms. if this is so,  you answered a question of mine before i got to ask it.
 
Here's a quick demo of it: http://webm.host/17edd/
I didn't block off the end with a wall on purpose to show what happens when you don't. I was hoping you'd be able to just walk through it instead of 'teleport' to the top.

WALKOFF will trigger constantly when walking down the slope and freak out at the top of it. Marianne was using my fall animation delay script as a workaround (Richter didn't have a walkoff animation).

Richter's whip dash toggles antigravity to 0 during the animation. He gets put in a bad state when he touches either side of the slope when doing the air version. He loses all control except walking and can be sent straight up sometimes. Going near the slope somehow enables Richter to do the dash again to break out. I was able to fix this problem by putting @cmd entergrab into the animation. :D

EDIT: Here is another video of basemap properly implemented into one of my levels that REALLY needed to have it: http://webm.host/a3798/

Thank you so much utunnels!
 
What values do I need to change to make the second basemap in this level go the other way?

Code:
void main()
	{
	int x, z;
	float delta, a;
	changelevelproperty("basemap", 0, "x", 126);
	changelevelproperty("basemap", 0, "xsize", 65);
	changelevelproperty("basemap", 0, "z", 3296);
	changelevelproperty("basemap", 0, "zsize", 10);
	delta = 64.0/65.0;
	for(x=0; x<65; x++)
	{
		a = x*delta;
		if(x+126>178) a = 64; // connect with the wall more smoothly
		for(z=0; z<10; z++)
			{
			changelevelproperty("basemap", 0, "map", x,z, a);
			}
		}
	int x, z;
	float delta, a;
	changelevelproperty("basemap", 1, "x", 288);
	changelevelproperty("basemap", 1, "xsize", 32);
	changelevelproperty("basemap", 1, "z", 3296);
	changelevelproperty("basemap", 1, "zsize", 10);
	delta = 32.0/32.0;
	for(x=0; x<32; x++)
	{
		a = x*delta;
		if(x+288>340) a = 32; // connect with the wall more smoothly
		for(z=0; z<10; z++)
			{
			changelevelproperty("basemap", 1, "map", x,z, a);
			}
		}		
}

Code:
updatedscript data/stages/normal/royalchapel/royalchapel.c
settime 0
noslow 1
nofadeout   1
direction both
scrollspeed 30
cameratype 1
cameraoffset 0
music		data/music/RoyalChapel.ogg
background	data/stages/normal/royalchapel/treebg.png
panel	data/stages/normal/royalchapel/royalchapel.png

order a

spawn1 25 0 0
spawn2 25 0 0



spawn endlevel
	coords	1456 288 0
	at 0

wall -30 3297 0 0 20 20 10 9999
Wall  -20  3297  0  0  178  178  10  32
Wall  190  3297  0  0  98  98  10  64
Wall  320  3297  0  0  192  192  10  32
Wall  1056  3297  0  0  62  62  10  32
Wall  3328  3297  0  0  160  160  10  2240
Wall  3840  3297  0  0  96  96  10  2592
Wall  4000  3297  0  0  120  120  10  2656

[attachment deleted by admin]
 
Here 2 wrappers:
Code:
void change_basemap(int map_index, float rx, float rz, float x_size, float z_size, float min_a, float max_a, int dir, int x_cont) {
    float x,z;
	float delta,a;

	changelevelproperty("basemap", map_index, "x", rx);
	changelevelproperty("basemap", map_index, "xsize", x_size+2);
	changelevelproperty("basemap", map_index, "z", rz);
	changelevelproperty("basemap", map_index, "zsize", z_size+2);
	delta = (max_a-min_a)/x_size;

	for( x = 0; x <= x_size; x++) {
		if ( dir == NULL() || dir > 0 ) a = x*delta + min_a;
		else a = max_a - (x*delta + min_a);

		if ( x_cont != NULL() ) {
            if ( dir == NULL() || dir > 0 ) {
                if ( x+rx > x_cont ) a = max_a; // connect with the wall more smoothly
            } else {
                if ( x < x_cont ) a = max_a;
            }
		}

		for ( z = 0; z <= z_size; z++) {
			changelevelproperty("basemap", map_index, "map", x, z, a);
		}
	}
}

void check_t_walkoff(float t_wo) {
    int i;

	for( i = 0; i <= openborvariant("count_entities"); ++i) {
        void ent = getentity(i);

        if ( getentityproperty(ent, "exists") ) {
            int type = getentityproperty(ent,"type");

            if ( !is_in_pain(ent) && !getentityproperty(ent,"noaicontrol") && ( type == openborconstant("TYPE_PLAYER") || type == openborconstant("TYPE_NONE") || type == openborconstant("TYPE_ENEMY") ) ) {
                float y = getentityproperty(ent,"y");
                float base = getentityproperty(ent,"base");

                if ( y > base && y-base <= t_wo ) changeentityproperty(ent,"position",NULL(),NULL(),base);
            }
        }
	}
}

USAGE:
change_basemap(0,-100,500,400.0+100.0,240.0+100.0,0.0,50.0,0);
in level script
and check_t_walkoff(2); in updatelevel script to resolv the basemap bug (land frame bug)
 
For some reason, characters that have a walk speed greater than 10 sometimes get stuck at the top of a slope. The faster the entity is, the more likely they are to get stuck. Is there something wrong with the way I'm setting my values? On basemap 0, I put in a value for x_cont that keeps the entity from getting stuck however the entity 'teleports' when near the top of the slope and it looks choppy.

I can't seem to get check_t_walkoff to work. OpenBOR just shuts down when I try to load a level with it. What is it supposed to do exactly?

Also, is it possible to have a sloped platform? Having to treat basemaps like walls limits them a bit.

Code:
#import "data/scripts/basemap.c"
#import "data/scripts/landframebugfix.c"

void main()
{
change_basemap(0, 126, 3296, 32.0+32.0, 1.0+1.0, 0, 64, 1, 178);	
change_basemap(1, 288, 3296, 32.0+32.0, 1.0+1.0, 0, 64, 0);
change_basemap(2, 512, 3296, 16.0+16.0, 1.0+1.0, 0, 32, 0);
change_basemap(3, 980, 3296, 0.0+76.0, 1.0+1.0, 0, 32, 1);
change_basemap(4, 1086, 3296, 32.0+2208.0, 1.0+1.0, 0, 2242, 1);
check_t_walkoff(2);
}

Code:
updatedscript data/stages/normal/royalchapel/royalchapel.c
settime 0
noslow 1
nofadeout   1
direction both
scrollspeed 30
cameratype 1
cameraoffset 0
music		data/music/RoyalChapel.ogg
background	data/stages/normal/royalchapel/treebg.png
panel	data/stages/normal/royalchapel/royalchapel.png

order a

spawn1 25 0 0
spawn2 25 0 0



spawn endlevel
	coords	1456 288 0
	at 0

wall -30 3297 0 0 20 20 10 9999
Wall  -20  3297  0  0  178  178  10  32
Wall  190  3297  0  0  98  98  10  64
Wall  320  3297  0  0  192  192  10  32
Wall  1056  3297  0  0  62  62  10  32
Wall  3328  3297  0  0  160  160  10  2240
Wall  3840  3297  0  0  96  96  10  2592
Wall  4000  3297  0  0  120  120  10  2656

[attachment deleted by admin]
 
This is a gret feature!

I think with a good tutorial, step by step, many could give great use.


I want to create a ladder as showing us this video Viper Snake:
Code:
EDIT: Here is another video of basemap properly implemented into one of my levels that REALLY needed to have it: http://webm.host/a3798/

But I don understand exactly how works this system.
 
utunnels did mention platform, but I don't know if it can work.

If you want to create a stair, you need to combine it with a wall or platform. Although current AI mostly doesn't know what is a "stairway",  they may not behave properly.

In case nobody goes to google to check the cached text, here's utunnels's post:

https://www.dropbox.com/s/xbygx4jbcrfa5o1/OpeBOR-win-latest.7z

This feature allow base altitude to be changed. Basically this is used to create slight ground transformation. If you want to create a stair, you need to combine it with a wall or platform. Although current AI mostly doesn't know what is a "stairway",  they may not behave properly.

An example (level.c) that creates a slope.


Code:
void main()
{
int x, z;
float delta, a;
changelevelproperty("basemap", 0, "x", 132);
changelevelproperty("basemap", 0, "xsize", 144);
changelevelproperty("basemap", 0, "z", 230);
changelevelproperty("basemap", 0, "zsize", 26);
delta = 89.0/144.0;
for(x=0; x<144; x++)
{
a = x*delta;
if(x+132>270) a = 89; // connect with the wall more smoothly
for(z=0; z<26; z++)
{
changelevelproperty("basemap", 0, "map", x,z, a);
}
}
}

A wall is required to the right if you want to block the path from that direction.

wall 273 256 0 0 3 3 26 89
 
Viper Snake said:
For some reason, characters that have a walk speed greater than 10 sometimes get stuck at the top of a slope. The faster the entity is, the more likely they are to get stuck. Is there something wrong with the way I'm setting my values? On basemap 0, I put in a value for x_cont that keeps the entity from getting stuck however the entity 'teleports' when near the top of the slope and it looks choppy.

I can't seem to get check_t_walkoff to work. OpenBOR just shuts down when I try to load a level with it. What is it supposed to do exactly?

Also, is it possible to have a sloped platform? Having to treat basemaps like walls limits them a bit.

Code:
#import "data/scripts/basemap.c"
#import "data/scripts/landframebugfix.c"

void main()
{
change_basemap(0, 126, 3296, 32.0+32.0, 1.0+1.0, 0, 64, 1, 178);	
change_basemap(1, 288, 3296, 32.0+32.0, 1.0+1.0, 0, 64, 0);
change_basemap(2, 512, 3296, 16.0+16.0, 1.0+1.0, 0, 32, 0);
change_basemap(3, 980, 3296, 0.0+76.0, 1.0+1.0, 0, 32, 1);
change_basemap(4, 1086, 3296, 32.0+2208.0, 1.0+1.0, 0, 2242, 1);
check_t_walkoff(2);
}

Code:
updatedscript data/stages/normal/royalchapel/royalchapel.c
settime 0
noslow 1
nofadeout   1
direction both
scrollspeed 30
cameratype 1
cameraoffset 0
music		data/music/RoyalChapel.ogg
background	data/stages/normal/royalchapel/treebg.png
panel	data/stages/normal/royalchapel/royalchapel.png

order a

spawn1 25 0 0
spawn2 25 0 0



spawn endlevel
	coords	1456 288 0
	at 0

wall -30 3297 0 0 20 20 10 9999
Wall  -20  3297  0  0  178  178  10  32
Wall  190  3297  0  0  98  98  10  64
Wall  320  3297  0  0  192  192  10  32
Wall  1056  3297  0  0  62  62  10  32
Wall  3328  3297  0  0  160  160  10  2240
Wall  3840  3297  0  0  96  96  10  2592
Wall  4000  3297  0  0  120  120  10  2656

Use my lib.c to work with check_t_walkoff() ;)
download lib.c from:
http://www.mediafire.com/download/mmv7qb8zpmsl7jv/key_lib.zip
Change basemap works well with check_t_walkoff() only...
Else if isnt enough, I'll write a tutorial for my custom stairs script ;)

Ps. try with:
change_basemap(0, 126, 3296, 64, 2, 0, 64, 1, 64);
or
change_basemap(0, 126, 3296, 64, 2, 0, 64, 1, 64-1);
 
White Dragon said:
Use my lib.c to work with check_t_walkoff() ;)
download lib.c from:
http://www.mediafire.com/download/mmv7qb8zpmsl7jv/key_lib.zip
Change basemap works well with check_t_walkoff() only...
Else if isnt enough, I'll write a tutorial for my custom stairs script ;)

Ps. try with:
change_basemap(0, 126, 3296, 64, 2, 0, 64, 1, 64);
or
change_basemap(0, 126, 3296, 64, 2, 0, 64, 1, 64-1);

I can't get lib.c to import, my game shuts down immediately.

I tried using those two values, the slope was not there at all with both. The entities just teleport to the top.

 
Back
Top Bottom