Jump to content


Photo

Extremephysics - 2d Physics Engine For Game Maker


  • Please log in to reply
1178 replies to this topic

#1051 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 25 March 2012 - 03:01 PM

Whoops, seems like it was in the draw event after all :P.
draw_surface_ext(surf,0,0,1,1,0,make_color_rgb(0,80,200),1);
Just replace make_color_rgb(0,80,200) with your color.
  • 0
Posted Image

#1052 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 25 March 2012 - 03:03 PM

Whoops, seems like it was in the draw event after all :P.
draw_surface_ext(surf,0,0,1,1,0,make_color_rgb(0,80,200),1);
Just replace make_color_rgb(0,80,200) with your color.
  • 0
Posted Image

#1053 Guest_armorraja_*

Guest_armorraja_*
  • Guests

Posted 25 March 2012 - 05:48 PM

Whoops, seems like it was in the draw event after all :P.

draw_surface_ext(surf,0,0,1,1,0,make_color_rgb(0,80,200),1);
Just replace make_color_rgb(0,80,200) with your color.


oh thanks i didnt look at the draw event .
:D

#1054 'tear

'tear

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 March 2012 - 01:16 AM

Success :)
thank you...

http://www.heptic.co...984013_orig.jpg
  • 0

#1055 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 16546 posts
  • Version:GM:Studio

Posted 30 March 2012 - 08:27 AM

getting a few errors about missing or extra arguments in the demos... Maybe I have an old gex registered
  • 0

#1056 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 10 April 2012 - 06:55 AM

Hello, I tried using this in GM Studio. First it said that is was missing the ExtremePhysics.dll, so I manually put it in the project folder, which fixed it. Then, I tried running it, but it does not recognize any of the functions. In the GM IDE, all functions are there and listed when I press "Show extension functions". However, when I run the game, it gives the "unknown function or script". Do you know any way to make EP work with GM Studio? (Yes I have tried manually putting all the scripts inside GM, but GM Studio can no longer import a lot of scripts at once via .gml files)
  • 0

Posted Image


#1057 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 16546 posts
  • Version:GM:Studio

Posted 10 April 2012 - 07:42 AM

Hello, I tried using this in GM Studio. First it said that is was missing the ExtremePhysics.dll, so I manually put it in the project folder, which fixed it. Then, I tried running it, but it does not recognize any of the functions. In the GM IDE, all functions are there and listed when I press "Show extension functions". However, when I run the game, it gives the "unknown function or script". Do you know any way to make EP work with GM Studio? (Yes I have tried manually putting all the scripts inside GM, but GM Studio can no longer import a lot of scripts at once via .gml files)


Studio beta does not support GEX or dlls yet, they did not get that far in supporting the feature yet. even if the dll interface function are there, no dll will work period.
  • 0

#1058 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 10 April 2012 - 08:07 AM


Hello, I tried using this in GM Studio. First it said that is was missing the ExtremePhysics.dll, so I manually put it in the project folder, which fixed it. Then, I tried running it, but it does not recognize any of the functions. In the GM IDE, all functions are there and listed when I press "Show extension functions". However, when I run the game, it gives the "unknown function or script". Do you know any way to make EP work with GM Studio? (Yes I have tried manually putting all the scripts inside GM, but GM Studio can no longer import a lot of scripts at once via .gml files)


Studio beta does not support GEX or dlls yet, they did not get that far in supporting the feature yet. even if the dll interface function are there, no dll will work period.

Oh, OK, Thanks! :smile: I suppose I should've looked up the beta possibilities before I came here :sweat:
  • 0

Posted Image


#1059 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 13 April 2012 - 08:26 AM

Hey guys, sorry to bother you again, but I seem to have another problem. I recently updated to 8.1 and the collisions just don't seem to work. I was using GM8 before with EP 2.1 and it worked perfectly fine. I then switched over to GM8.1 and since I used EP 2.1 at the beginning of the project, I decided to go with it for the rest of the project. However when I run the game, everything works fine except for the fact that the ragdollls do not collide with the static blocks. The ragdolls are created, they are dynamic, they're affected by gravity and all the joints are correctly placed, but they do not collide with the static blocks. Absolutely no code has been changed. It works fine in GM8 but not in 8.1. Thinking it my be an incompatibility with EP 2.1 and GM8.1, I upgraded to EP 2.2. This did not fix the problem, however, and the objects still do not collide. I have checked the collision groups but I don't see anything wrong. Here are the codes for the static blocks and ragdolls respectively just in case:

Code for static block: (the codes for the other static objects like ramps are basically the same, but instead of a box shape they are polygons. the ep_body_set_collisions() function is the same)
body = ep_body_create_static(world,1);
bodyshape = ep_shape_create_box(world,body,sprite_width-2,sprite_height-2,0,0,0,1);

ep_shape_set_collision(world,body,bodyshape,1,1,0);
ep_shape_set_material(world,body,bodyshape,0.6,0.6,0,0);
ep_body_set_position(world,body,x,y,0);

Code for ragdolls: (it's quite long so I shortened it to the quote that I think must the important)

The body is the main body part, which creates the other parts.
global.my_id = global.body_id;
global.body_id +=1;

body = ep_body_create_dynamic(world,0);
shape = ep_shape_create_box(world,body,sprite_width-4,22-4,0,0,0,1);

ep_shape_set_collision(world,body,shape,1,1,GROUP_RAGDOLL+global.my_id);
ep_shape_set_material(world,body,shape,0.5,0.4,0,0);
ep_body_set_position(world,body,x,y,0);

ep_body_calculate_mass(world,body);

ep_body_set_gravity(world,body,0,0.4);

The other body parts have generally this code:
body = ep_body_create_dynamic(world,0);
shape = ep_shape_create_box(world,body,sprite_width-4,sprite_height-4,0,0,0,0.5);

ep_shape_set_collision(world,body,shape,1,1,GROUP_RAGDOLL+global.my_id);
ep_shape_set_material(world,body,shape,0.2,0.4,0,0);
ep_body_set_position(world,body,x,y,0);

ep_body_calculate_mass(world,body);

ep_body_set_gravity(world,body,0,0.4);

the constant GROUP_RAGDOLL is 1.
and object called EP sets global.body_id to 0 at its create event, where the world creation code is also located.
  • 0

Posted Image


#1060 Jake Armstrong

Jake Armstrong

    GMC Member

  • GMC Member
  • 491 posts
  • Version:GM8.1

Posted 13 April 2012 - 03:06 PM

This physics engine seems awesome, although it's probably extremely overkill for what I want to do lol.

EDIT: (I was initially asking about the license as well but I saw a post you made on your website so I figured it out and removed that from this post.)

Edited by Jake Armstrong, 14 April 2012 - 05:22 AM.

  • 0

A star pathfinding extension (fast, variable cost tiles, multi-tile objects): http://gmc.yoyogames...howtopic=570621

Multiple mice extension http://gmc.yoyogames...howtopic=575963
extension to check if game is in focus (vs. being alt tabbed, etc.): http://gmc.yoyogames...howtopic=549073


#1061 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 15 April 2012 - 05:32 PM

@D1g1talAli3n: Try adding show_debug_message to all create events to make sure they are executed in the correct order. That was often the problem for me.

Are you using debugdraw? If you can't get it to work in GM8.1, read this.

If you still can't find the problem, can you upload the GMK?
  • 0
Posted Image

#1062 blizter

blizter

    GMC Member

  • GMC Member
  • 50 posts

Posted 18 April 2012 - 02:50 AM

I wanted to use your dll in my project. However when your dll is loaded, my game will randomly segfault. I have to tell you, I am using gmapi in a dll of mine. Do you think it can cause conflicts?

When I stop loading your dll, all the segfaults disappear, they seem to be random and appear even if I'm only loading your dll and not updating the systems or anything.

Edited by blizter, 18 April 2012 - 02:52 AM.

  • 0

#1063 blizter

blizter

    GMC Member

  • GMC Member
  • 50 posts

Posted 19 April 2012 - 12:53 AM

I'm going to post a followup on this. I added extremephysics source code to my own source code. It still crashed.

I then removed all the code regarding accessing gm functions for drawing. It fixed the issue, apparently your code was accessing a bad memory section or something (Gm 8.0). I replaced everything with functions from GMAPI so I can still use debug drawing, but without any issues.

Hope this help.

Edited by blizter, 19 April 2012 - 12:54 AM.

  • 0

#1064 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 19 April 2012 - 04:46 PM

That's possible. My DLL doesn't change anything in GM itself, but I'm not sure what GMAPI does. I assume GMAPI rewrote some parts of GM, or at least modified the procedure table. You could probably avoid a crash by simply not using debug drawing (and ep_gm_functions_init) though.

You should upload your modified version, it might be useful for others with the same issue (also, read the license - you're free to modify ExtremePhysics, but you have to upload the source code of the result :)).
  • 0
Posted Image

#1065 kabecao

kabecao

    GMC Member

  • GMC Member
  • 286 posts
  • Version:GM:Studio

Posted 22 April 2012 - 09:26 PM

Thanks for GM 8.1 suport.

There is no way to prevent objects to inside other? (I mean that collision delay a few steps)

Edited by kabecao, 22 April 2012 - 09:27 PM.

  • 0

#1066 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 25 April 2012 - 04:38 PM

Is there any way to achieve some sort of raycasting?

Like casting a ray with a set length and direction from a certain position and getting the position where it collides with something?
I know this is possible with GM, but it uses sprite collisions and is extremely slow. Even with iterative collision_line() functions it's still quite slow. I was thinking since all the geometry is already defined in EP, it would be possible (and much faster) to do it in EP. So, is it possible?
  • 0

Posted Image


#1067 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 26 April 2012 - 09:37 AM

Thanks for GM 8.1 suport.

There is no way to prevent objects to inside other? (I mean that collision delay a few steps)

You can't really prevent it, but you can use substeps (calling ep_world_simulate_step multiple times per step) to make it less obvious (that's what I did in The Machine).

Is there any way to achieve some sort of raycasting?

Like casting a ray with a set length and direction from a certain position and getting the position where it collides with something?
I know this is possible with GM, but it uses sprite collisions and is extremely slow. Even with iterative collision_line() functions it's still quite slow. I was thinking since all the geometry is already defined in EP, it would be possible (and much faster) to do it in EP. So, is it possible?

Yes:
http://www.maartenba..._world_ray_cast
http://www.maartenba...p_body_ray_cast
http://www.maartenba..._shape_ray_cast
  • 0
Posted Image

#1068 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 27 April 2012 - 04:39 PM

Yes:
http://www.maartenba..._world_ray_cast
http://www.maartenba...p_body_ray_cast
http://www.maartenba..._shape_ray_cast

That's awesome! But unfortunately it's only available in EP 2.2, and I still haven't figured out what's wrong with it :(
The situation is kind of bizarre.
EP 2.1 + GM8 = Working
EP 2.1 + GM8.1 = Not Working
EP 2.2 + GM8 = Not Working
EP 2.2 + GM8.1 = Not Working

All the create events are happening as they should. For my own reasons I can't upload the GMK, but I'm currently (and have been) trying to replicate the problem. I'll upload a GMK of that if I am successful.

Edited by D1g1talAli3n, 27 April 2012 - 04:42 PM.

  • 0

Posted Image


#1069 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 27 April 2012 - 10:28 PM

You're probably forgetting to call some function or changing some function arguments - some things have changed in EP 2.2 and the changelog may not cover everything. And everything in EP 2.1 should work in GM8.1 except for debug drawing (you need ep_gm_functions_init_address for that), so I assume that's what you meant.

What exactly isn't working? Does it crash? Do you get any error messages? Are you using any other extensions?

Edited by Maarten Baert, 27 April 2012 - 10:29 PM.

  • 0
Posted Image

#1070 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 28 April 2012 - 07:12 AM

You're probably forgetting to call some function or changing some function arguments - some things have changed in EP 2.2 and the changelog may not cover everything. And everything in EP 2.1 should work in GM8.1 except for debug drawing (you need ep_gm_functions_init_address for that), so I assume that's what you meant.

What exactly isn't working? Does it crash? Do you get any error messages? Are you using any other extensions?

EDIT2: I'm an idiot. I fixed it. It was a problem with ep_world_update_contacts() not being called in the step event :blush:

Edited by D1g1talAli3n, 28 April 2012 - 11:18 AM.

  • 0

Posted Image


#1071 Creativita

Creativita

    GMC Member

  • GMC Member
  • 172 posts
  • Version:GM:Studio

Posted 07 May 2012 - 05:44 AM

Whenever I attempt to open the GameMaker files within the gm folder the error "Cannot open extension package: Extreme Physics 2.2" is displayed. Also, none of the the scripts/functions within the existing scripts are recognised.
  • 0
"Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read"
- Groucho Marx

#1072 general sirhc

general sirhc

    YW Creator

  • New Member
  • 1651 posts

Posted 07 May 2012 - 02:07 PM

Okay, I just spent the last 6 hours trying to make a piston, It should be easy enough, just a punch of hinge joints really but for one reason or another its just not working. The crankshaft can turn the piston but not the other way around.

Here is my code anyway, should be ready to run, all you need to do is draw the bodies and simulate the world

Fixed, no rotation was set to true..

Edited by general sirhc, 08 May 2012 - 02:54 PM.

  • 0
Your World on
Posted Image and Posted Image

#1073 IcyEye

IcyEye

    GMC Member

  • GMC Member
  • 19 posts

Posted 08 May 2012 - 11:24 PM

Whenever I attempt to open the GameMaker files within the gm folder the error "Cannot open extension package: Extreme Physics 2.2" is displayed. Also, none of the the scripts/functions within the existing scripts are recognised.


That's because you need to install the Extension first!

How to Install an Extension
  • 0

#1074 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 13 May 2012 - 03:42 AM

Hello Maarten. I have tried to add ragdolls on my own. Complete with head, torso, arms, legs and feet. But I don't know where to start. What do I have to do first?

If you have already covered it, could you provide a link to the post? I going through all of them but haven't found one that could help.

Edited by Mr.Troid, 13 May 2012 - 07:28 PM.

  • 0

#1075 Lux DeLuna

Lux DeLuna

    GMC Member

  • GMC Member
  • 22 posts
  • Version:Unknown

Posted 23 May 2012 - 04:29 PM

i tried the engine yesterday with the latest Gm: Studio ( it supports extensions now... i think ) , but it seemed , that it didn't calculate anything...
all my objects got stuck in the top left corner, at 0/0
  • 0

#1076 rsandoz2008

rsandoz2008

    GMC Member

  • GMC Member
  • 12 posts
  • Version:GM:Studio

Posted 23 May 2012 - 10:16 PM

i tried the engine yesterday with the latest Gm: Studio ( it supports extensions now... i think ) , but it seemed , that it didn't calculate anything...
all my objects got stuck in the top left corner, at 0/0


I can believe what it is the situation!

The external_call function is completely obsolete in Studio, thus breaking the extension, since that function is disabled. Same goes with external_define.

Edited by rsandoz2008, 23 May 2012 - 10:16 PM.

  • 0

#1077 Lux DeLuna

Lux DeLuna

    GMC Member

  • GMC Member
  • 22 posts
  • Version:Unknown

Posted 24 May 2012 - 11:46 AM

so what should i do? as i tried it with an older version it gave me the "error definging an external function" error, but this time it started normally
  • 0

#1078 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 25 May 2012 - 10:51 AM

@Lux DeLuna: Are you using the extension (gex), or the scripts + DLL?
  • 0
Posted Image

#1079 Lux DeLuna

Lux DeLuna

    GMC Member

  • GMC Member
  • 22 posts
  • Version:Unknown

Posted 25 May 2012 - 11:34 AM

i tried with the .gex file and it didn't threw the error, and i tried with the dll but this didn't work... maybe i did something wrong ( i'm new to game maker), so i would prefer using the .gex ( it's much simpler... :whistle: ) the described problem was with the .gex.
ps: it would be very useful if you could host a working testbed file for studio

Edited by Lux DeLuna, 25 May 2012 - 05:11 PM.

  • 0

#1080 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 25 May 2012 - 10:03 PM

Nevermind about the ragdoll, I forgot you made an example in the 'testbed' example. All I need to know is how to make a model and add a texture to it. I saw your example on your site but I don't understand how you made the polygon a model. Could I have some help as to how to do it?

Edited by Mr.Troid, 28 May 2012 - 06:37 PM.

  • 0

#1081 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 03 June 2012 - 07:19 PM

i tried with the .gex file and it didn't threw the error, and i tried with the dll but this didn't work... maybe i did something wrong ( i'm new to game maker), so i would prefer using the .gex ( it's much simpler... :whistle: ) the described problem was with the .gex.
ps: it would be very useful if you could host a working testbed file for studio

That sounds like a bug in Studio ... I don't have Studio, so I can't really help you, sorry.

I saw your example on your site but I don't understand how you made the polygon a model. Could I have some help as to how to do it?

What example do you mean? Why do you want to create a model?
  • 0
Posted Image

#1082 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 04 June 2012 - 07:18 PM

I don't want to create a model. I just want to add a texture to the polygons (boxchains), that's all. In the code below you say that it's for performance, that's why I thought I'd make it a model. Here's the code you posted on your website a while back:

// subdivide the polygon
ep_world_multipoly_begin(global.world, vertices);
for(i = 0; i<vertices; i += 1) {
    ep_world_multipoly_set_vertex(global.world, i, vertex_x[i], vertex_y[i]);
}
if !ep_world_multipoly_end(global.world, false) {
    exit;
}
first_poly = ep_world_multipoly_get_first(global.world);
last_poly = ep_world_multipoly_get_last(global.world);
polys = last_poly-first_poly+1;

// create 3d model (for performance)
w = background_get_width(bg_tex_solid);
h = background_get_height(bg_tex_solid);
model = d3d_model_create();
for(i = 0; i<polys; i += 1) {
    c = ep_polygon_get_vertex_count(global.world, first_poly+i);
    d3d_model_primitive_begin(model, pr_trianglefan);
    for(j = 0; j<c; j += 1) {
        xx = ep_polygon_get_vertex_x(global.world, first_poly+i, j);
        yy = ep_polygon_get_vertex_y(global.world, first_poly+i, j);
        d3d_model_vertex_texture(model, xx-0.5, yy-0.5, 0, xx/w, yy/h);
    }
    d3d_model_primitive_end(model);
}
for(i = first_poly; i<=last_poly; i += 1) {
    ep_polygon_destroy(global.world, i);
}

Edited by Mr.Troid, 04 June 2012 - 07:18 PM.

  • 0

#1083 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 06 June 2012 - 03:24 PM

Can you post the code you are using to create the box chain?
  • 0
Posted Image

#1084 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 07 June 2012 - 01:10 AM

Sure, it's straight out of your 'rolling_ball' example:

var i;

global.world_id = ep_world_create();
ep_world_set_settings(global.world_id, 1/2, 15, 10, 0.1, 0.5, 0, 0.5, 1);
body_id = ep_body_create_static(global.world_id);

ep_body_boxchain_begin(global.world_id, body_id, instance_number(ob_marker));
i = 0;
with ob_marker {
    ep_body_boxchain_set_vertex(global.world_id, other.body_id, i, x, y);
    i += 1;
};
ep_body_boxchain_end(global.world_id, body_id, false, false, 0, 40, 0);
for(i = ep_body_boxchain_get_first(global.world_id, body_id); i<=ep_body_boxchain_get_last(global.world_id, body_id); i += 1) {
    ep_shape_set_collision(global.world_id, body_id, i, 1, 1, 0);
    ep_shape_set_material(global.world_id, body_id, i, 0.2, 0.8, 0, 0);
};

  • 0

#1085 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 08 June 2012 - 11:11 AM

Try this:
var ww, hh, i, c, nx1, ny1, nx2, ny2, d1, d2, a, xx, yy, boxchain_x, boxchain_y;

ww = 256; // width of texture
hh = 256; // height of texture

i = 0;
with ob_marker {
	boxchain_x[i] = x;
	boxchain_y[i] = y;
	i += 1;
};
c = i;

model = d3d_model_create();
d3d_model_primitive_begin(model, pr_trianglestrip);
for(i = 0; i < c; i += 1) {
	if(i = 0) {
		nx1 = boxchain_y[i + 1] - boxchain_y[i];
		ny1 = boxchain_x[i] - boxchain_x[i + 1];
	} else {
		nx1 = boxchain_y[i] - boxchain_y[i - 1];
		ny1 = boxchain_x[i - 1] - boxchain_x[i];
	}
	if(i = c - 1) {
		nx2 = boxchain_y[i] - boxchain_y[i - 1];
		ny2 = boxchain_x[i - 1] - boxchain_x[i];
	} else {
		nx2 = boxchain_y[i + 1] - boxchain_y[i];
		ny2 = boxchain_x[i] - boxchain_x[i + 1];
	}
	d1 = sqrt(nx1 * nx1 + ny1 * ny1);
	d2 = sqrt(nx2 * nx2 + ny2 * ny2);
	nx1 /= d1;
	ny1 /= d1;
	nx2 /= d2;
	ny2 /= d2;
	a = 40 / (1 + nx1 * nx2 + ny1 * ny2);
	xx = boxchain_x[i] - nx1 * a - nx2 * a;
	yy = boxchain_y[i] - ny1 * a - ny2 * a;
	d3d_model_vertex_texture(model, xx, yy, xx / ww, yy / hh);
	d3d_model_vertex_texture(model, boxchain_x[i], boxchain_y[i], boxchain_x[i] / ww, boxchain_y[i] / hh);
}
d3d_model_primitive_end(model);
(not tested)

Edited by Maarten Baert, 10 June 2012 - 12:21 PM.

  • 0
Posted Image

#1086 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 08 June 2012 - 04:37 PM

Thanks. I'll try it out now.

I get this.


___________________________________________
ERROR in
action number 1
of Create Event
for object ob_game_control:

Error in code at line 30:
                   nx1 = boxchain_y[i + 1] - boxchain_y[i];
                         ^
at position 24: Unknown variable boxchain_y or array index out of bounds


Edited by Mr.Troid, 08 June 2012 - 05:57 PM.

  • 0

#1087 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 10 June 2012 - 12:20 PM

Replace the first line with this:
var ww, hh, i, c, nx1, ny1, nx2, ny2, d1, d2, a, xx, yy, boxchain_x, boxchain_y;

  • 0
Posted Image

#1088 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 11 June 2012 - 02:26 AM

That's the same thing.

Ya know what? I'll just do it the easy way because finding the right position and angle for each boxchain won't be so quick. Also, if I make the marker too high then the polygon will be long and way too steep. Then, I'd have to apply the right amount of force for the player to get over it. If the markers are too low and closer together then the floor will be too 'straight-forward' and boring. I could gradually raise the positions of the markers in the editor but that will mean horizontally longer rooms. So, I'll just make 64*64 objects (including polygons), a 64*64 sprite that will be drawn over each object (Like a tile, only more manipulable). Then, in the Room Creation event specify which index of the sprite I wanna draw on it. I think that should work. That's gonna take a while but at least I'll get it done.

Edited by Mr.Troid, 11 June 2012 - 04:09 AM.

  • 0

#1089 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 12 June 2012 - 02:02 AM

I should have just posted this from the beginning. I'm merging the walls which works perfectly.
// merge walls
var a, merge;
with (obj_poly_block_static1) {
	a = instance_create(x-32, y-32, obj_wallbox);
	a.w = 64;
	a.h = 64;
};
do {
	merge = false;
	with (obj_wallbox) {
    	with (obj_wallbox) {
        	if x = other.x+other.w and y = other.y and h = other.h {
            	other.w += w;
            	merge = true;
            	instance_destroy();
        	}
    	}
	}
} until (merge = false);
do {
	merge = false;
	with (obj_wallbox) {
    	with (obj_wallbox) {
        	if y = other.y+other.h and x = other.x and w = other.w {
            	other.h += h;
            	merge = true;
            	instance_destroy();
        	}
    	}
	}
} until (merge = false);
with (obj_wallbox) {
	body_id = ep_body_create_static(global.world_id);
	shape_id = ep_shape_create_box(global.world_id, body_id, w, h, w/2, h/2, 0, 1);
	ep_shape_set_collision(global.world_id, body_id, shape_id, collide1a, collide1b, 0);
	ep_shape_set_material(global.world_id, body_id, shape_id, 0.2, 0.6, 0, 0);
	physics_object_set(body_id);
};

But I'm trying to check for collision but I can't put the code below because there is no code that initiates body_id in 'obj_wallbox', when I press the jump key nothing happens:
with (obj_wallbox)  {
  for (s = ep_body_first_shape(global.world_id, body_id); s != 0; s = ep_shape_next(global.world_id, body_id, s)) {
    	if ep_shape_collision_test_box(global.world_id, body_id, s, 64, 64, x, y+2, 0, -0.1) {
        	collision_down_box = 1;
    	};
  };
};

if (k_jump) = 1 and (collision_down_box) {
	y_vel = -jump_force;
};

Got any ideas on how to fix it?

Edited by Mr.Troid, 12 June 2012 - 02:12 PM.

  • 0

#1090 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 12 June 2012 - 02:31 PM

Why don't you use ep_world_collision_test_box? It's easier and a lot faster. If you only want to check collisions with walls instead of all bodies, change the collision mask of the walls:
ep_shape_set_collision(global.world_id, body_id, shape_id, collide1a|2, collide1b, 0);
Now use this to check collisions:
ep_world_collision_test_box(world_id, w, h, x, y, rot, contact_threshold, 0, 2, 0)
(assuming you're not using collision mask 2 yet)
  • 0
Posted Image

#1091 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 12 June 2012 - 03:13 PM

I got a question, when you combine the walls and make it one polygon, don't you change the shape of the polygon too? Will I still be able to check for 64 pixels?

Edited by Mr.Troid, 12 June 2012 - 03:37 PM.

  • 0

#1092 pablo1517

pablo1517

    GMC Member

  • GMC Member
  • 376 posts

Posted 14 June 2012 - 12:57 AM

Please, does anyone have or can make an example of how to make a rope? Something like whip or even a rope to hang on it. Anything rope-ish - PLZ PLZ PLZ :<
  • 0

If I helped then feel free to press this button rep_up.png under my post  ;)


#1093 mnm_manish

mnm_manish

    GMC Member

  • GMC Member
  • 63 posts
  • Version:GM8

Posted 14 June 2012 - 01:00 PM

:thumbsup:
Thanx Maarten ..
I have browsed your programs like
-Model Creator
-Extreme Physics
-HTTP Dll
-GM Binary
-ds_grid
-C Math
And Some Others I Forgot ..
Its pretty good but I dont know you are providing open source programs
and you may be a novice++ GM Programmer . But are not you making any Games
from GM. And Another thing i like to get the source code of user_is_admin.dll.
Please have a pity. :GM8: From ManishKarki
mnm_manish
  • 0
This is where i belong...

Posted Image

Download Here...
Gautam Buddha was born in Nepal not in India. I don`t know how to put image as link in signature...

#1094 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 15 June 2012 - 03:58 PM

I got a question, when you combine the walls and make it one polygon, don't you change the shape of the polygon too? Will I still be able to check for 64 pixels?

What do you mean? It's not a polygon but a box shape, and yes, the shape does change of course, that's the whole idea of merging the walls :).

Please, does anyone have or can make an example of how to make a rope? Something like whip or even a rope to hang on it. Anything rope-ish - PLZ PLZ PLZ :<

Take a look at rope.gmk :).

:thumbsup:
Thanx Maarten ..
I have browsed your programs like
-Model Creator
-Extreme Physics
-HTTP Dll
-GM Binary
-ds_grid
-C Math
And Some Others I Forgot ..
Its pretty good but I dont know you are providing open source programs
and you may be a novice++ GM Programmer . But are not you making any Games
from GM. And Another thing i like to get the source code of user_is_admin.dll.
Please have a pity. :GM8: From ManishKarki
mnm_manish

Uhm ... what exactly is the question?

I've made some games, one is in my signature. Most of my games aren't on this forum though (you can find some more here).

The source of user_is_admin.dll: http://pastebin.com/cQXDzRfJ
  • 0
Posted Image

#1095 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 15 June 2012 - 05:18 PM

It's not a polygon but a box shape...


A square ('box') is a polygon. But in your engine it's probably different when you create a box, you don't refer to as a square. Thanks for the help.

Edited by Mr.Troid, 15 June 2012 - 05:40 PM.

  • 0

#1096 Zombifier

Zombifier

    GMC Member

  • GMC Member
  • 6 posts
  • Version:GM:Studio

Posted 17 June 2012 - 01:31 AM

I made a ragdoll demo for ExtremePhysics. It works great, I ran into a few problems, but don't worry, I fixed them. Enjoy guys!
Credits are in the game information.

http://sandbox.yoyog...-ragdoll-engine

Use the "N" button to create a ragdoll at mouse position. This is basically the ragdoll demo in testbed.gmk, but with sprites, and it works really great! They all seem a little stiff though, but that should be easy to fix by messing with the variables in the object "obj_ragdoll".

Included scripts with their syntaxes:
make_ragdoll(world,x,y)
apply_force(world,part,forcex,forcey)

-TZK

Edited by Zombifier, 17 June 2012 - 02:12 AM.

  • 0

#1097 huh?

huh?

    GMC Member

  • GMC Member
  • 430 posts
  • Version:Unknown

Posted 26 June 2012 - 06:29 PM

Wow, really great work on this!

I've got a (hopefully) quick question though, if you're not too busy: How would I go about changing the gravity of water particles (in the fluids example) that have already been created? I've tried using ep_body_set_gravity() but that only works on newly created water particles. I assume it's because they're in a ds_list...?
  • 0

#1098 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 27 June 2012 - 11:35 PM

I've tried using ep_body_set_gravity() but that only works on newly created water particles. I assume it's because they're in a ds_list...?

That should work, but you have to call that function for every particle in the list.
  • 0
Posted Image

#1099 Southman

Southman

    I simply am not here

  • GMC Member
  • 1662 posts
  • Version:GM:Studio

Posted 18 July 2012 - 03:41 PM

How do you use the joints?
I'm trying to have one object dangle from another object, and I can't get it to work.
  • 0

#1100 xsonicvision

xsonicvision

    GMC Member

  • New Member
  • 2 posts
  • Version:GM8

Posted 18 July 2012 - 06:59 PM

Hi there, I have a question, and i need a little help. I've just started using extremephysics, I think its amazing, I'm just not very familiar with the language. For the rolling ball example, i would like to set the angle of the sprite to the angle of the floor, or to the angle at which the ball is moving. I've also noticed on the testbed example in test number two (and all other tests i believe) when i activate the drawing debug for velocity, in pink it shows me the angle that im looking for, but i can't seem to figure out which variable it is?? Can some one help me please?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users