Will do free coding - if contented donations are welcome

Posted By: Scorpion

Will do free coding - if contented donations are welcome - 07/26/09 16:30

Hello everyone,

I want (and probably need^^) some variation from the project I am currently working on and so I thought about doing some freelance coding for you.
If you have a small (or medium) task you need to get done, just give me the needed information and I
I'll see if I can/want to do it.

I am nearly coding for 5 years now and I will give you some clear and effective code. If something turns out to be not working the way you want (which shouldn't be the case with a good description of the task) I'm trying to fix it for you.

Of course I would be happy about a donation (as you might have guessed from the title^^), but it's in no way necessary and I will still do you the favour of coding something. If you really want to you can give send it to my paypal account: KaiAlexHiller@web.de

Scorpion


(Hope this donation thing didn't scared too much people...)

PS: I'm talking about lite-c scripting here only (not in the mood for other langs)
Posted By: Saruniks

Re: Will do free coding - if contented donations are welcome - 07/26/09 17:14

Quote:

PANEL* startgame_pan =
{
bmap = "main2_tga";
pos_x = 0;
pos_y = 468;
button (0, 1, "StartGame3_bmp", "StartGame3_bmp", "StartGame3_bmp",NULL, NULL, NULL);
button (330, 1, "settings3_bmp", "settings1_bmp", "settings2_bmp", startgame_to_settings, NULL, NULL);
button (580, 3, "extras3_bmp", "extras1_bmp", "extras2_bmp", startgame_to_extras, NULL, NULL);
button (800, 0, "quit3_bmp", "quit1_bmp", "quit2_bmp", startgame_to_quit, NULL, NULL);
button (10, 70, "new3_bmp", "new1_bmp", "new2_bmp", start_game, NULL, NULL);
button (10, 120, "load3_bmp", "load1_bmp", "load2_bmp", NULL, NULL, NULL);
button (10, 170, "save3_bmp", "save1_bmp", "save2_bmp", NULL, NULL, NULL);
flags = | OVERLAY | OVERLAY | OVERLAY;
}


function main()
{
fps_max = 70;
video_mode = 9;
video_screen = 1;
mouse_spot.x = 1;
mouse_spot.y = 1;
wait (2);
set (main_pan, VISIBLE);
mouse_mode = 4;
mouse_map = mouse_pcx;
}

function start_game()
{
reset (main_pan, VISIBLE);
game_started = 1;
mouse_mode = 0;
level_load (NULL);
wait (3);
}



When I press new button, game starts but panel is still visible. Maybe because it is visible from the begining I mean there are
set (main_pan, VISIBLE); (in function main)
so it still shows, how to get my panel hidden when I start game?
(this is not full code) ( I don't know how you guys are posting scripts here)

Ps: how can we do donate for you? ( I am not saying I am going to make it )
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/26/09 17:55

The first thing is this strange line:
Code:
flags = | OVERLAY | OVERLAY | OVERLAY;


replace it with
Code:
flags = OVERLAY;



for hiding the panel startgame_pan, you have to type
Code:
reset(startgame_pan, VISIBLE);


like you did already for main_pan

I have no idea why you are using the wait(2); in your main function. it doesn't look useful there from that piece of code.

And about the mouse_spot: it defines the offset of the mousespot. So the spot is not in the top left corner anymore in your case. I'm not sure if it's that what you want. Just wanted to mention it.

and one last thing to notice: you don't need a wait(3) behind a level_load in the engine anymore.

So you code would be
Code:
PANEL* startgame_pan =
{
	bmap = "main2_tga";
	pos_x = 0;
	pos_y = 468;
	button (0, 1, "StartGame3_bmp", "StartGame3_bmp", "StartGame3_bmp",NULL, NULL, NULL);
	button (330, 1, "settings3_bmp", "settings1_bmp", "settings2_bmp", startgame_to_settings, NULL, NULL);
	button (580, 3, "extras3_bmp", "extras1_bmp", "extras2_bmp", startgame_to_extras, NULL, NULL);
	button (800, 0, "quit3_bmp", "quit1_bmp", "quit2_bmp", startgame_to_quit, NULL, NULL);
	button (10, 70, "new3_bmp", "new1_bmp", "new2_bmp", start_game, NULL, NULL);
	button (10, 120, "load3_bmp", "load1_bmp", "load2_bmp", NULL, NULL, NULL);
	button (10, 170, "save3_bmp", "save1_bmp", "save2_bmp", NULL, NULL, NULL);
	flags = OVERLAY;
}


function main()
{
	fps_max = 70;
	video_mode = 9;
	video_screen = 1;

	set (main_pan, VISIBLE);
	mouse_mode = 4;
	mouse_map = mouse_pcx;
}

function start_game()
{
	reset(main_pan, VISIBLE);
	reset(startgame_pan, VISIBLE);
	game_started = 1;
	mouse_mode = 0;
	level_load (NULL);
}


Posted By: MasterQ32

Re: Will do free coding - if contented donations are welcome - 07/26/09 18:07

YOu must use SHOW instead of VISIBLE

Code:
PANEL* startgame_pan =
{
	bmap = "main2_tga";
	pos_x = 0;
	pos_y = 468;
	button (0, 1, "StartGame3_bmp", "StartGame3_bmp", "StartGame3_bmp",NULL, NULL, NULL);
	button (330, 1, "settings3_bmp", "settings1_bmp", "settings2_bmp", startgame_to_settings, NULL, NULL);
	button (580, 3, "extras3_bmp", "extras1_bmp", "extras2_bmp", startgame_to_extras, NULL, NULL);
	button (800, 0, "quit3_bmp", "quit1_bmp", "quit2_bmp", startgame_to_quit, NULL, NULL);
	button (10, 70, "new3_bmp", "new1_bmp", "new2_bmp", start_game, NULL, NULL);
	button (10, 120, "load3_bmp", "load1_bmp", "load2_bmp", NULL, NULL, NULL);
	button (10, 170, "save3_bmp", "save1_bmp", "save2_bmp", NULL, NULL, NULL);
	flags = OVERLAY;
}


function main()
{
	fps_max = 70;
	video_mode = 9;
	video_screen = 1;

	set (main_pan, SHOW );
	mouse_mode = 4;
	mouse_map = mouse_pcx;
}

function start_game()
{
	reset(main_pan, SHOW );
	reset(startgame_pan, SHOW );
	game_started = 1;
	mouse_mode = 0;
	level_load (NULL);
}


Posted By: Saruniks

Re: Will do free coding - if contented donations are welcome - 07/26/09 18:10

thanks. I can see now that I got confused with main_pan and startgame_pan.

how can I donate you?
Posted By: Saruniks

Re: Will do free coding - if contented donations are welcome - 07/26/09 18:10

why SHOW?
Posted By: Rei_Ayanami

Re: Will do free coding - if contented donations are welcome - 07/26/09 18:16

when I´m right - Show is the same as VISIBLE smile
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/26/09 18:19

SHOW is the never syntax for VISIBLE, but it has the same effect. I think it is confusing that conitec changed that. (they said it would be easier to understand for beginners)

they declared it to be obsolete now: http://www.conitec.net/beta/aAnhang_Syntax.htm

The 2 definitions in atypes.h:
Code:
#define SHOW			(1<<14)
#define VISIBLE			SHOW


Posted By: Rei_Ayanami

Re: Will do free coding - if contented donations are welcome - 07/26/09 18:22

Your right laugh - sorry wink
Posted By: Pappenheimer

Re: Will do free coding - if contented donations are welcome - 07/26/09 18:43

Scorpion, do you like to convert the Terrain Shadowmapping from the wiki to Lite-C?
http://www.opserver.de/wiki/index.php/Terrain_Shadowmapping
I did the easy part, but I'm still new to Lite-C.
Now I get a "Syntax error: Can't convert a SUB:STRUCT@11:FIXED:."
Got rid of it, was a mistake of mine! replaced p_terrain.x by p_terrain[0], although I shouldn't! grin

Code:
BMAP* canvas;
ENTITY* p_terrain;
var canvas_size[2];
var shadow_brightness=112; 

//-----------------------------------------------------------------------------blur
function blur(passes)
{
  var i;
  var px;
  var py;
  var format;
  var pixel;
  var pixelcolor[3];
  var pixelalpha;
  var sample1[3];
  var sample2[3];
  var sample3[3];
  var sample4[3];
  var sample5[3];
  var sample6[3];
  var sample7[3];
  var sample8[3];
  var sample9[3]; 

  i=0;
  while(i<passes)
  {
    py=0;
    while(py < canvas_size[1])
    {
     px=0;
      while(px<canvas_size[0])
      {
        format=bmap_lock(canvas,0); 

        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px,0,canvas_size[0]-1),clamp(py,0,canvas_size[0]-1));
        pixel_to_vec(sample1,pixelalpha,format,pixel);

        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px-1,0,canvas_size[0]-1),clamp(py,0,canvas_size[0]-1));
        pixel_to_vec(sample2,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px-1,0,canvas_size[0]-1),clamp(py+1,0,canvas_size[0]-1));
        pixel_to_vec(sample3,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px,0,canvas_size[0]-1),clamp(py+1,0,canvas_size[0]-1));
        pixel_to_vec(sample4,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px+1,0,canvas_size[0]-1),clamp(py+1,0,canvas_size[0]-1));
        pixel_to_vec(sample5,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px+1,0,canvas_size[0]-1),clamp(py,0,canvas_size[0]-1));
        pixel_to_vec(sample6,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px+1,0,canvas_size[0]-1),clamp(py-1,0,canvas_size[0]-1));
        pixel_to_vec(sample7,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px,0,canvas_size[0]-1),clamp(py-1,0,canvas_size[0]-1));
        pixel_to_vec(sample8,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size[0]-1)-px-1,0,canvas_size[0]-1),clamp(py-1,0,canvas_size[0]-1));
        pixel_to_vec(sample9,pixelalpha,format,pixel);

        pixelcolor[0]=integer((sample1[0]*7+sample2[0]*2+sample3[0]+sample4[0]*2+sample5[0]+sample6[0]*2+sample7[0]+sample8[0]*2+sample9[0])/19);
        pixelcolor[1]=integer((sample1[1]*7+sample2[1]*2+sample3[1]+sample4[1]*2+sample5[1]+sample6[1]*2+sample7[1]+sample8[1]*2+sample9[1])/19);
        pixelcolor[2]=integer((sample1[2]*7+sample2[2]*2+sample3[2]+sample4[2]*2+sample5[2]+sample6[2]*2+sample7[2]+sample8[2]*2+sample9[2])/19);

        pixel=pixel_for_vec(pixelcolor,100,format);
        pixel_to_bmap(canvas,(canvas_size[0]-1)-px,py,pixel);

        bmap_unlock(canvas);

        px+=1;
      }
      py+=1;
      wait(1); // without a wait after each line the loop could get too big if the shadow map is huge
    } 
    i+=1;
  }
}

//-----------------------------------------------------------------------------generate_shadows
function getxyz(px,py)
{
  var pixel_size[2];
  pixel_size[0]=(p_terrain.max_x-p_terrain.min_x)/canvas_size[0];
  pixel_size[1]=(p_terrain.max_y-p_terrain.min_y)/canvas_size[1];
    temp[0]=((p_terrain.x-p_terrain.min_x)-(pixel_size[0]*px))-pixel_size[0]/2;
  temp[1]=((p_terrain.y-p_terrain.min_y)-(pixel_size[1]*py))-pixel_size[1]/2;
  c_trace(vector(temp[0],temp[1],p_terrain.z+50000),vector(temp[0],temp[1],p_terrain.z-50000),IGNORE_MODELS|IGNORE_SPRITES|IGNORE_MAPS);
  temp[2]=target.z;
}

function generate_shadows()
{
  var px;
  var py;
  var format;
  var pixel; 

  py=0;
  while(py<canvas_size[1])
  {
    px=0;
    while(px<canvas_size[0])
    { 
      getxyz(px,py); // get the world coordinates of the pixel
      c_trace(sun_pos.x,vector(temp[0],temp[1],temp[2]+1),IGNORE_ME|IGNORE_SPRITES); // trace from the sun to the pixel
      if(trace_hit) // draw shadow pixel if there is no obstacle
      {
        format=bmap_lock(canvas,0);

        pixel=pixel_for_vec(vector(shadow_brightness,shadow_brightness,shadow_brightness),100,format);
        pixel_to_bmap(canvas,(canvas_size[0]-1)-px,py,pixel);

        bmap_unlock(canvas);
      }
      px+=1;
    }
    py+=1;
    wait(1); // without a wait after each line the loop could get too big if the shadow map is huge
  }
  blur(1); // do 1 blur pass
}

//-----------------------------------------------------------------------------terrain
function terrain()
{
  p_terrain=my;
//  my.material=mtl_terrainshadowmap;

  canvas=bmap_for_entity(my,2); // the second texture of the terrain is the shadowmap
  canvas_size[0]=bmap_width(canvas);
  canvas_size[1]=bmap_height(canvas);

  wait(1);
  generate_shadows();
}

//here is a simple example material. the first texture of the terrain has to be the color map (the tiling can be specified with the texture transformation matrix). the second texture of the terrain has to be the shadow map.


//-----------------------------------------------------------------------------materials
//material mtl_terrainshadowmap
//{
//  effect=
//  "
//  texture entSkin1;
//  texture entSkin2;
//
//  technique one_pass_shadow
//  {
//    pass p0
//    {
//      Texture[0]=<entSkin1>;
//      Texture[1]=<entSkin2>;
// 
//      ColorArg1[0]=Texture;
//      ColorOp[0]=Modulate2x;
//      ColorArg2[0]=Diffuse;
//      TexCoordIndex[0]=0;
//      TextureTransformFlags[0]=Count2;
//      TextureTransform[0]={8.0,0.0,0.0,0.0, // color map u scale
//                           0.0,8.0,0.0,0.0, // color map v scale
//                           0.0,0.0,0.0,0.0,
//                           0.0,0.0,0.0,0.0};
//
//      ColorArg1[1]=Texture;
//      ColorOp[1]=Modulate;
//      ColorArg2[1]=Current;
//      TexCoordIndex[1]=0;
//      TextureTransformFlags[1]=Count2;
//      TextureTransform[1]={1.0,0.0,0.0,0.0,
//                           0.0,1.0,0.0,0.0,
//                           0.0,0.0,0.0,0.0,
//                           0.0,0.0,0.0,0.0};
//    }
//  }
//  ";
//}


Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/26/09 19:44

Here is a lite-c version of the code. changed the way its working a little bit. now you have to pass the pointer to the terrain entity, instead of using 'me'.

Code:
BMAP* canvas;
ENTITY* p_terrain;
VECTOR canvas_size;
var shadow_brightness=112; 

//-----------------------------------------------------------------------------blur
void blur(passes)
{
  var i;
  var px;
  var py;
  var format;
  var pixel;
  VECTOR pixelcolor;
  var pixelalpha;
  VECTOR sample1;
  VECTOR sample2;
  VECTOR sample3;
  VECTOR sample4;
  VECTOR sample5;
  VECTOR sample6;
  VECTOR sample7;
  VECTOR sample8;
  VECTOR sample9; 

  i=0;
  while(i<passes)
  {
    py=0;
    while(py < canvas_size.y)
    {
     px=0;
      while(px<canvas_size.x)
      {
        format=bmap_lock(canvas,0); 

        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px,0,canvas_size.x-1),clamp(py,0,canvas_size.x-1));
        pixel_to_vec(sample1,pixelalpha,format,pixel);

        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px-1,0,canvas_size.x-1),clamp(py,0,canvas_size.x-1));
        pixel_to_vec(sample2,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px-1,0,canvas_size.x-1),clamp(py+1,0,canvas_size.x-1));
        pixel_to_vec(sample3,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px,0,canvas_size.x-1),clamp(py+1,0,canvas_size.x-1));
        pixel_to_vec(sample4,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px+1,0,canvas_size.x-1),clamp(py+1,0,canvas_size.x-1));
        pixel_to_vec(sample5,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px+1,0,canvas_size.x-1),clamp(py,0,canvas_size.x-1));
        pixel_to_vec(sample6,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px+1,0,canvas_size.x-1),clamp(py-1,0,canvas_size.x-1));
        pixel_to_vec(sample7,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px,0,canvas_size.x-1),clamp(py-1,0,canvas_size.x-1));
        pixel_to_vec(sample8,pixelalpha,format,pixel);
        pixel=pixel_for_bmap(canvas,clamp((canvas_size.x-1)-px-1,0,canvas_size.x-1),clamp(py-1,0,canvas_size.x-1));
        pixel_to_vec(sample9,pixelalpha,format,pixel);

        pixelcolor.x=integer((sample1.x*7+sample2.x*2+sample3.x+sample4.x*2+sample5.x+sample6.x*2+sample7.x+sample8.x*2+sample9.x)/19);
        pixelcolor.y=integer((sample1.y*7+sample2.y*2+sample3.y+sample4.y*2+sample5.y+sample6.y*2+sample7.y+sample8.y*2+sample9.y)/19);
        pixelcolor.z=integer((sample1.z*7+sample2.z*2+sample3.z+sample4.z*2+sample5.z+sample6.z*2+sample7.z+sample8.z*2+sample9.z)/19);

        pixel=pixel_for_vec(pixelcolor,100,format);
        pixel_to_bmap(canvas,(canvas_size.x-1)-px,py,pixel);

        bmap_unlock(canvas);

        px+=1;
      }
      py+=1;
      wait(1); // without a wait after each line the loop could get too big if the shadow map is huge
    } 
    i+=1;
  }
}

//-----------------------------------------------------------------------------generate_shadows
void getxyz(px, py, VECTOR* pos)
{
  VECTOR pixel_size;
  pixel_size.x = (p_terrain.max_x-p_terrain.min_x)/canvas_size.x;
  pixel_size.y = (p_terrain.max_y-p_terrain.min_y)/canvas_size.y;
  pos.x = ((p_terrain.x-p_terrain.min_x)-(pixel_size.x*px))-pixel_size.x*0.5;
  pos.y = ((p_terrain.y-p_terrain.min_y)-(pixel_size.y*py))-pixel_size.y*0.5;
  c_trace(vector(pos.x, pos.y, p_terrain.z+50000), vector(pos.x, pos.y, p_terrain.z-50000), IGNORE_MODELS|IGNORE_SPRITES|IGNORE_MAPS);
  pos.z=target.z;
}

void generate_shadows()
{
  var px;
  var py;
  var format;
  var pixel; 

	me = p_terrain;

  py=0;
  while(py<canvas_size.y)
  {
    px=0;
    while(px<canvas_size.x)
    { 
      VECTOR pos;
      
      getxyz(px, py, pos); // get the world coordinates of the pixel
      c_trace(sun_pos.x, pos, IGNORE_ME|IGNORE_SPRITES); // trace from the sun to the pixel
      if(trace_hit) // draw shadow pixel if there is no obstacle
      {
        format=bmap_lock(canvas,0);

        pixel=pixel_for_vec(vector(shadow_brightness,shadow_brightness,shadow_brightness),100,format);
        pixel_to_bmap(canvas,(canvas_size.x-1)-px,py,pixel);

        bmap_unlock(canvas);
      }
      px+=1;
    }
    py+=1;
    wait(1); // without a wait after each line the loop could get too big if the shadow map is huge
  }
  blur(1); // do 1 blur pass
}

//-----------------------------------------------------------------------------terrain
void terrain(ENTITY* ent)
{
  p_terrain = ent;
//  my.material=mtl_terrainshadowmap;

  canvas = bmap_for_entity(ent,2); // the second texture of the terrain is the shadowmap
  canvas_size.x = bmap_width(canvas);
  canvas_size.y = bmap_height(canvas);

  generate_shadows();
}

//here is a simple example material. the first texture of the terrain has to be the color map (the tiling can be specified with the texture transformation matrix). the second texture of the terrain has to be the shadow map.


//-----------------------------------------------------------------------------materials
//MATERIAL* mtl_terrainshadowmap = 
//{
//  effect=
//  "
//  texture entSkin1;
//  texture entSkin2;
//
//  technique one_pass_shadow
//  {
//    pass p0
//    {
//      Texture[0]=<entSkin1>;
//      Texture[1]=<entSkin2>;
// 
//      ColorArg1[0]=Texture;
//      ColorOp[0]=Modulate2x;
//      ColorArg2[0]=Diffuse;
//      TexCoordIndex[0]=0;
//      TextureTransformFlags[0]=Count2;
//      TextureTransform[0]={1.0,0.0,0.0,0.0, // color map u scale
//                           0.0,1.0,0.0,0.0, // color map v scale
//                           0.0,0.0,0.0,0.0,
//                           0.0,0.0,0.0,0.0};
//
//      ColorArg1[1]=Texture;
//      ColorOp[1]=Modulate;
//      ColorArg2[1]=Current;
//      TexCoordIndex[1]=0;
//      TextureTransformFlags[1]=Count2;
//      TextureTransform[1]={1.0,0.0,0.0,0.0,
//                           0.0,1.0,0.0,0.0,
//                           0.0,0.0,0.0,0.0,
//                           0.0,0.0,0.0,0.0};
//    }
//  }
//  ";
//}
//


Posted By: Pappenheimer

Re: Will do free coding - if contented donations are welcome - 07/26/09 20:40

THanks a lot! Got it working, although the shadow doesn't fit.
I load up an example to test with.

EDIT:

Here is the testing environement:

http://www.puppenheim.org/Shadow_Mapping_Testing.zip

with the test_terrain.hmp I got at the last time 4 little shadows in 4 directions. With the terrain_relief.mdl I got one a bit too big shadow.
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/26/09 20:52

I didn't changed the way it's working (afaik^^) and I also wondered a bit, why the shadows are that big, but i will look into it.

EDIT: okay I looked into it and you just didn't applied a correct shader. normally the 2nd skin is used as a tiled detailmap. If you use the example shader given with the code, it works fine. I just uploaded it again to proof that its working:

http://rapidshare.com/files/260375668/smtest.zip
Posted By: Pappenheimer

Re: Will do free coding - if contented donations are welcome - 07/26/09 21:36

Hm, wanted to get it working with the second skin map, though! blush
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/26/09 21:46

it does work with the second skin, what do you mean?
Posted By: Pappenheimer

Re: Will do free coding - if contented donations are welcome - 07/26/09 21:53

I mean, without shader/material.
My hope was to use it for mdls as well, with any shape and atlas mapping.
Posted By: Pappenheimer

Re: Will do free coding - if contented donations are welcome - 07/26/09 21:55

BTW, it doesn't actually save the shadowmap, right?

EDIT:
It is easy:
bmap_save(canvas,"result.png");

Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/26/09 22:43

i just converted the script i didn't add extras.

For using the script with any model you like you have to find a way to get the xyz position of uv coordinates. everything else is easy. I will look into this in a few hours ('tomorrow')

and why don't you like the idea of materials? it's a ffp effect, so it'S aviable with every version and isn't more complicated than the normal engine materials (which are in fact also ffp shaders afaik)
Posted By: Pappenheimer

Re: Will do free coding - if contented donations are welcome - 07/26/09 22:57

Originally Posted By: Scorpion
i just converted the script i didn't add extras.

I know, I don't want to sound as if I complain! smile
Originally Posted By: Scorpion
For using the script with any model you like you have to find a way to get the xyz position of uv coordinates. everything else is easy. I will look into this in a few hours ('tomorrow')


That's great. If you find a way to do it, that's fantastic. If it costs too much time, you already got the terrain part running. Thank you for that very much.

Originally Posted By: Scorpion
and why don't you like the idea of materials? it's a ffp effect, so it'S aviable with every version and isn't more complicated than the normal engine materials (which are in fact also ffp shaders afaik)

I thought it restricts to a certain uv-mapping which wouldn't work with the individual uv-layout of the most models.
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/27/09 15:43

I tried to look in it, but the only possible way to find the xyz position of a uv coordinate (if there's any or there are more than one) is to access the triangles of the modell afaics. thats only possible with functions of the dx-sdk and i am not that deep in it to do that.
Posted By: Pappenheimer

Re: Will do free coding - if contented donations are welcome - 07/27/09 15:53

Don't worry! Thanks for your efforts!
Now, it is my part to place this in the wiki, I guess. smile

EDIT: Done! Formatting in the wiki is a nightmare - maybe, I didn't understand it properly.

Hope, it is okay this way:

http://www.opserver.de/wiki/index.php/Terrain_Shadowmapping
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/27/09 21:30

I think it's good that way and hope everyone else agrees^^

If somebody else needs something to be done that can be accomplished in lite-c, just tell me.
Posted By: Rei_Ayanami

Re: Will do free coding - if contented donations are welcome - 07/27/09 21:50

Hello laugh!

Okay, I use the System from Grimbers FPS Tutorial, for the stairs and things like this. If I want to go a little bevel(sorry i don´t know what "schräge" is in english) my player moves soooo slow, and if i want to go in 90° angle to the "bevel" my player doesn´t move at all -.- .

Here is the part from my code which do this things smile :
Code:
fall_distance = c_trace(player.x, vector(my.x, my.y, my.z - 500), IGNORE_ME | IGNORE_YOU | IGNORE_SPRITES | IGNORE_MODELS | USE_BOX);
		if(fall_distance > 64 && sign(fall_distance) != -1 && jumping == 0)
		{
			falling = 1; 													//falle
		}
		else
		{
			if(fall_distance < 64 && falling == 0 && jumping == 0)	
			{
				player_move.z = -fall_distance * time_step;
			}
		}
		if(fall_distance > 32 && jumping == 0)
		{
			falling = 1;
			if(player_move.z > -20 * time_step)
			{
				player_move.z -= 0.5 * time_step;
			}
		}
		else falling = 0;
		c_move(me, player_move, nullvector, GLIDE | IGNORE_PASSABLE);			//bewegt den Spieler, relativ zu seinem Pan, Tilt und Roll winkel und lässt in an Wänden etx gleiten und ignoriert objekte die Passabel sind



Please tell me what is wrong smile
Posted By: darkraven1

Re: Will do free coding - if contented donations are welcome - 07/28/09 00:02

Hey saw your post and wanted to say hey
We are looking to get a team together and sounds like we could use someone like you for our Project.
We are looking to be picked up by Ubi so this a serious project.
I would like to talk to you more about it But I am unable to PM you.
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/28/09 13:11

@darkraven1

Sorry my inbox was full...

I really like to hear that you want me in your team, but I am working on a free title with a good friend of mine and I don't think that I can manage it to seriously work on 2 projects at the same time and put so much effort in it as needed. Out of curiosity: what is that project about?

@rey_ayanami
Ich seh mal, was ich tun kann =)
Posted By: Saruniks

Re: Will do free coding - if contented donations are welcome - 07/28/09 13:49

oh sorry
Posted By: Rei_Ayanami

Re: Will do free coding - if contented donations are welcome - 07/28/09 14:05

danke smile
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 07/28/09 20:31

okay, here is a pretty solid player function, that let you walk stairs fluidly, jump and well...walk. I put the defaults so that they more or less fit the standard scale of 1 quant = 1 inch. Maybe he jumps a little too high or falls too slow, or I don't know. Just play with the default settings.
The only problem that occurs with it is a little jitter, when moving slopes down. You won't probably notice it. IF you need it fixed, just use a variation of how I fixed the stair climbing issue and make, that gravity has no influence in that case (= put it on the ground). I'm talking too much. Here's the code:

Code:
action controller(){
	
	//parameters to change
	int moveSpeed = 30;//inch in one ticks...thats how fast world recordlers run
	float stopFactor = 0.7;//the velocity of the player gets multiplied with that every frame
	int maxStepHeight = 16;//name says all. 16 inches should be even too high
	int groundDist = 1;//don't make it hard for the collision system
	float gravity = 2;//in a vacuum it would be ca. 24 inch/tick^2 (9.81 m/s^2)
	float heighCorrectionFactor = 0.9;//for climbing stairs and slopes
	int jumpForce = 10;//how good can you jump?
	move_min_z = 0.707;//stairclimping by c_move not over 45° of the elipsiod
	
	//used by player function
	VECTOR moveDir;
	VECTOR movement;
	float fallDist;
	int onGround = 0;
	VECTOR vel;
	vec_zero(moveDir);
	vec_zero(movement);
	vec_zero(vel);

	player=me;
	wait(1);
	c_setminmax(me);

	while(1){
		moveDir.x = (key_w-key_s); //get direction
		moveDir.y = (key_a-key_d);
		my.pan -= 2*mouse_force.x;
		camera.tilt = clamp(camera.tilt + 2*mouse_force.y,-90,90);
		
		fallDist = c_trace(player.x, vector(my.x, my.y, my.z - 500), IGNORE_ME | IGNORE_YOU | IGNORE_SPRITES | IGNORE_MODELS | USE_BOX);
		
		//check for ground contact
		if(fallDist <= groundDist)
			onGround = 1;
		else
			onGround = 0;
		
		//help me with stairs
		if(moveDir.x || moveDir.y){//moving?
			//trace down where you're moving to
			VECTOR stairTracePos;
			vec_set(stairTracePos, moveDir);
			vec_normalize(stairTracePos, my.max_x);
			vec_rotate(stairTracePos, my.pan);
			vec_add(stairTracePos, vector(my.x, my.y, my.z+my.min_z));
			
			result = c_trace(vector(stairTracePos.x, stairTracePos.y, stairTracePos.z+maxStepHeight), stairTracePos, IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|IGNORE_MODELS);
			
			if(trace_hit){
				my.z += (maxStepHeight-result+groundDist)*heighCorrectionFactor*time_step;
				onGround = 1;
			}
		}
		
		//gravitation
		if(!onGround){
			vel.z -= gravity*time_step;
		}
		else
			vel.z = 0;
		
		//jumping
		if(onGround && key_space){
			vel.z = jumpForce;
		}
		
		//xy-movement
		if(moveDir.x)
			vel.x = 15*moveDir.x;
		else
			vel.x *= 1.0-(1.0-stopFactor)*time_step;//anti propotional relation
		
		if(moveDir.y)
			vel.y = 15*moveDir.y;
		else
			vel.y *= 1.0-(1.0-stopFactor)*time_step;//anti propotional relation
			
		movement.x = vel.x*time_step;
		movement.y = vel.y*time_step;
		
		c_move(me, nullvector, vector(0,0, vel.z), GLIDE|IGNORE_PASSABLE);//if we jump, we might crash against the ceiling
		c_move(me, movement, nullvector, GLIDE|IGNORE_PASSABLE);//now move on xy

		vec_set(camera.x, my.x);
		camera.z += 32.5;
		camera.pan = my.pan;
		
		wait(1);
	}
}


Posted By: Rei_Ayanami

Re: Will do free coding - if contented donations are welcome - 07/28/09 21:07

thanks you soooooo much smile laugh
Posted By: Landixus

Re: Will do free coding - if contented donations are welcome - 08/05/09 14:25

@Scorpion
Wenn du MP coden kannst, dann zahl ich dir gerne was.
Weisst ja, das Airfix Spiel, sag was du an Geld haben willst und
wir werden uns vielleicht einig.

Über wie und wann bezahlt wird können wir dann ja sprechen.
Posted By: jigalypuff

Re: Will do free coding - if contented donations are welcome - 08/05/09 20:57

If this offer is still under way i would like a small turn based stratagy tut similer to civ smile
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 08/07/09 13:29

sorry, my internet didn't worked the last days, because our new provider didn't got it right...

if you can tell me a little bit more about what you want to have exactly, I can see if I have the time to do it, because it sounds like something bigger...
Posted By: jigalypuff

Re: Will do free coding - if contented donations are welcome - 08/07/09 22:10

Well just how to set up a grid select a unit click were you want it to go the nclick a button for the turn to process. I just can`t figure it out frown
Posted By: Scorpion

Re: Will do free coding - if contented donations are welcome - 08/11/09 09:19

Sorry, nothing done for you jigalypuff, but it got a little busier in real life suddenly. I think I have your icq from some times ago, so I'll msg you there for some more details.
© 2024 lite-C Forums