Jump to content


Photo

Project K


  • Please log in to reply
40 replies to this topic

#1 slayer 64

slayer 64

    Slayer of gingers

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

Posted 10 November 2009 - 03:16 AM

  • Title: project K
  • Description: example of good collisions, shadow, and movement.
  • GM Version: 8.1
  • Registered: yes
  • File Type: gm81
  • File Size: 382 kb
  • File Link: Project K
Description

i got a hold of kingspace 3.4. i looked at it for a while and found the code that does the excellent collisions. credit to king stephen for that who i don't think visits the gmc anymore. i modified things and created this example. you can move around and collide with triangles. i added a shadow that adjusts to the slope of the triangle your standing on. there is an older gm7 version of prject K and a new modified faster version in gm8. i created the model using Master Editor 2


Posted Image Posted Image

Edited by slayer 64, 30 April 2012 - 02:28 AM.

  • 0

#2 Robert3DG+

Robert3DG+

    Designer

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

Posted 10 November 2009 - 03:36 AM


Edited by Robert3DG+, 20 September 2014 - 06:52 PM.

  • 0

#3 antome

antome

    GMC Member

  • New Member
  • 305 posts

Posted 11 November 2009 - 08:05 AM

ditto, this looks interesting... i will download and review as soon as I can (probably the weekend)
  • 0

#4 Robert3DG+

Robert3DG+

    Designer

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

Posted 11 November 2009 - 09:01 AM


Edited by Robert3DG+, 20 September 2014 - 06:52 PM.

  • 0

#5 slayer 64

slayer 64

    Slayer of gingers

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

Posted 13 November 2009 - 01:46 AM

update:
added a big gun
can load type 8 primitives (no alpha or color) and 9 primitives (alpha and color)
mode some code more efficient.

master 3dg, reason project K could only load models with alpha and color is because it was only reading lines with type 9. should all work good now.
  • 0

#6 Endorel

Endorel

    GMC Member

  • Banned Users
  • 191 posts

Posted 13 November 2009 - 04:25 AM

Please upload an executable because I don't have GM7 pro on my internet computer (this one). Also, I searched for Kingspace but the link was broken! It apears that there are multiple versions of Kingspace too; are you using the latest one? It's a bit annoying how most of the things on this forum either have broken links or use unsecure hosting service. So anyway, how on earth did you download Kingspace :lol:?

#7 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 13 November 2009 - 10:05 PM

I assume you are referring to the former GM user, King Stephan (Stephan Boyer). :lol:
  • 0

#8 Robert3DG+

Robert3DG+

    Designer

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

Posted 14 November 2009 - 12:55 AM


Edited by Robert3DG+, 20 September 2014 - 06:49 PM.

  • 0

#9 antome

antome

    GMC Member

  • New Member
  • 305 posts

Posted 15 November 2009 - 02:10 AM

Okay, I downloaded and checked it out, and so far it seems pretty promising. Keep it up!
  • 0

#10 RamboFox

RamboFox

    Tainted Fortune

  • New Member
  • 992 posts

Posted 15 November 2009 - 05:06 AM

~Harmful polygons, like triangles that register as harmful to the player and how to check for them (Spikes, lava pits, etc.) I've actually got this kind of working myself, I'm sure you could right it much better though.

Or polygons with a value set to them? That function would be extremely helpful in coding A.I (restricting bots to a path that is integrated with the ground) or be equally useful in checking what surface you're on - it would make coding a rally game a breeze! (*EDIT* So that one of the 4 wheels on your car that is colliding a polygon knows whether that polygon has an ice attribute to it, or is asphalt, or even mud)

Also: Checking z variable is already done - have a look in the step event of the player object and you'll find a variable that sets it's shadow's z value.

Edited by RamboFox, 15 November 2009 - 05:08 AM.

  • 0

#11 Robert3DG+

Robert3DG+

    Designer

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

Posted 16 November 2009 - 09:03 AM


Edited by Robert3DG+, 20 September 2014 - 06:49 PM.

  • 0

#12 jsorgeagames

jsorgeagames

    GMC Member

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

Posted 27 November 2009 - 08:18 PM

Nice! I've been looking for a collision engine like this for a long time.
  • 0

#13 Robert3DG+

Robert3DG+

    Designer

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

Posted 29 November 2009 - 04:12 AM


Edited by Robert3DG+, 20 September 2014 - 06:50 PM.

  • 0

#14 EucoDan

EucoDan

    EucoGames Coder

  • New Member
  • 478 posts

Posted 02 December 2009 - 07:25 AM

Remarkable. I shall definitely be using this!
  • 0

#15 Endorel

Endorel

    GMC Member

  • Banned Users
  • 191 posts

Posted 02 December 2009 - 02:47 PM

I made a youtube video for this :D.
link

#16 3D2DGAMES

3D2DGAMES

    GMC Member

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

Posted 06 February 2010 - 12:29 AM

best 3d project yet. I would really love to see this develop into something even more awesome. keep up the good work!
  • 0

#17 Endorel

Endorel

    GMC Member

  • Banned Users
  • 191 posts

Posted 06 February 2010 - 01:00 AM

If anything, credit King Stephan. Slayer64 is simply applying Kingspace (which is an engine made by King Stephan).

#18 3D2DGAMES

3D2DGAMES

    GMC Member

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

Posted 06 February 2010 - 02:07 AM

yea King Stephan does need credit but for the amount of time that Slayer64 has been a member of GMC I would say he has some serious skill. After seeing this I went and checked out some of his blockman games. They are amazing and the second is one of my favorite computer games now.

There should be a community project to create a mario64 type engine. I think using project k would be amazing. I would be in on helping out to but only if it stayed within gm7. gm8=not for me.
  • 0

#19 Endorel

Endorel

    GMC Member

  • Banned Users
  • 191 posts

Posted 06 February 2010 - 02:33 AM

Wow, and yet you've been a member since 2004? That's even longer than me :GM074:.

#20 3D2DGAMES

3D2DGAMES

    GMC Member

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

Posted 06 February 2010 - 11:44 PM

how would you go about adding a moving platform to this engine?
  • 0

#21 Endorel

Endorel

    GMC Member

  • Banned Users
  • 191 posts

Posted 07 February 2010 - 01:42 AM

You can't do that very easily, unless you have the real Kingspace. You'll need to download Kingspace, but there's only one problem: I don't want to upload it for you (Sorry I am too busy). Ask Slayer64 to upload it.

#22 slayer 64

slayer 64

    Slayer of gingers

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

Posted 07 February 2010 - 02:22 AM

oh god, moving platforms...ones that don't glitch? O_o
it'll be a while.
  • 0

#23 3D2DGAMES

3D2DGAMES

    GMC Member

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

Posted 07 February 2010 - 04:00 AM

I figured out a loophole muahaha!

used this script that I pulled from the GMC somewhere. lost the link to where it was. the guy's name who posted it started with link. i gave it a name and put the arguments in place

//scr_nearest(x,y,z,obj)
int = noone; //current closest instance
dis = 10000; //just a big number
for (i=0; i<instance_number(argument3); i+=1)
{
	o = instance_find(argument3,i);
if (sqrt(power(argument0-o.x,2)+power(argument1-o.y,2)+power(argument2-o.z,2))<dis) {
int = o;
dis = sqrt(power(argument0-o.x,2)+power(argument1-o.y,2)+power(argument2-o.z,2));
}
}
return(int)

after adding that to the scripts I added the following piece of code to the end step event of the player

//am I on a platform?
i=scr_nearest(x,y,z,obj_platform);

if place_meeting(x,y,i)
{
	if z>i.z and z<i.ztop or z=i.ztop
	{
		z=i.ztop+radius;
		onground=1;
		//zspeed=0;
		x=x+lengthdir_x(i.speed,i.direction);
		y=y+lengthdir_y(i.speed,i.direction);
		xx=x;
		yy=y;
		zz=z;
		shadow_z=i.ztop;
	}else{
		if z<i.z
		{
			if z+radius>i.z{zspeed=-1;}
		}
	}
}
this is what follows after this piece of code. I thought I should be a little more specific as to where I put the code. I did not write the following:

//set the new vector of motion. it is the vector from the previous position to the new position
if x!=xx
or y!=yy
or z!=zz
{
	hspeed=xx-(x-hspeed);
	vspeed=yy-(y-vspeed);
	zspeed=zz-(z-zspeed);
}


//set the balls position to the position the collision code calculated
x=xx;
y=yy;
z=zz;


//control the camera
obj_control.x=x;
obj_control.y=y;
obj_control.z=z;

//fell off
if z<-200
{
	x=xstart;
	y=ystart;
	z=zstart;
	zspeed=0;
}

the obj_platform must have two variables z and ztop. ztop is the top of the platform where the player will stand. the programmer has the freedom to move the platform with direction and speed arguments and the character will move with it. just make sure that ztop is updated whenever the z value changes.

anyway it is a sloppy throwtogether but it works! also note that I gave the player a 16x16 mask and the platform has a 32x32 mask. this also means that the platform model must be the same shape as the mask. sorry but it was the best I could do. its been a long time since I have used gamemaker.

please feel free to improve on my fix or figure out a better way.

that's my $.02 :)

Edit:
oh and I forgot to mention a bug.
if you use this method and the character is on the platform then he can not be pushed off the platform by existing terrain. standing on the platform will cause the player to ignore collision checking for the terrain. so no making platforms run through the terrain alright guys haha.

Edited by 3D2DGAMES, 07 February 2010 - 05:08 AM.

  • 0

#24 Robert3DG+

Robert3DG+

    Designer

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

Posted 05 April 2010 - 07:29 AM


Edited by Robert3DG+, 20 September 2014 - 06:50 PM.

  • 0

#25 RamboFox

RamboFox

    Tainted Fortune

  • New Member
  • 992 posts

Posted 07 April 2010 - 12:12 PM

Has anyone figured out how to make dangerous pieces of terrain like lava? I tried using the "if point in triangle" script but I failed horribly :rolleyes:

First: You need to make it so that the editor saves level data/polygons stored with numbers for each polygon (for example: 1 = grass 2 = dirt 3 = lava)
Second: Look through the scripts where it checks for collisions against polygons. Use that to your advantage.

I would help, but my computer wiped itself some time ago.
  • 0

#26 Robert3DG+

Robert3DG+

    Designer

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

Posted 08 April 2010 - 03:00 AM


Edited by Robert3DG+, 20 September 2014 - 06:51 PM.

  • 0

#27 RamboFox

RamboFox

    Tainted Fortune

  • New Member
  • 992 posts

Posted 09 April 2010 - 04:43 AM

Yes, exactly and that is what I'm working on now Rambofox.

Though this data would need a new container. You couldn't just throw a random terrain ID number into the model file that Master Editor generate or GM would freak out when it tried to read it.

Precisely, you'll need edit the loading and saving scripts to include the extra value. Hopefully it'll be backwards compatible with older map/world files.
  • 0

#28 Robert3DG+

Robert3DG+

    Designer

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

Posted 09 April 2010 - 06:21 AM


Edited by Robert3DG+, 20 September 2014 - 06:51 PM.

  • 0

#29 RamboFox

RamboFox

    Tainted Fortune

  • New Member
  • 992 posts

Posted 09 April 2010 - 09:23 AM

It's as simple as making it so that the save/load scripts saves an extra line that is used for saving variables, as it is already able to save the texture id/texture vertices to individual polygons.

And as we already both know, within the step event of the player there is a polygon checking script that you could take advantage of, so as to detect what the value of the polygon it is intersecting with. An easier way to do it (and not as flexible) would be to use the shadow script and simply return the id of the polygon directly below it.
  • 0

#30 slayer 64

slayer 64

    Slayer of gingers

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

Posted 09 April 2010 - 05:57 PM

you guys seem to be getting into project K. i uploaded a gm8 version with more efficient collision code. less reading too. i didn't solve the dangerous triangle problem because pro editor will be able to handle that. moving platforms should be pretty easy once pro editor is more mature.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users