SONIC PATHS - Stickto() Function

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

SONIC PATHS - Stickto() Function

Postby feral » Tue Jun 24, 2008 4:36 am

Version 1 of the stickto function
SONIC.jpg
SONIC STYLE PATHS SCREEN GRAB

stickto.zip
ged and data files
(26.81 KiB) Downloaded 576 times

NOTE: this version is a simple version that uses collisionfree and as such cannot determine the difference between the ground and other objects..

however, it is the simplest version to learn from,

The next version will have the ability to distinguish between the ground and other objects, the demo i posted earlier uses that method, and therefore can ignore the plants ( background sprites) but at the moment uses a secondary sprite in order to allow collsionstate to work properly... i am still working on removing the need for that..)
see viewtopic.php?f=4&t=5847

The next version will also be further optimized to increase speed by using a binary search to more quickly find a "free" angle to move on, and some further code optimization (this version was basically just to make it work). The binary search algorithm will also "even out" the time between frames so that long searches and short searches will take similar times ( no lagging on some frames, although as yet, i don't have any speed problems with it.. )

The stickto() function can be ignored at any time, provided the global variable DirAngle is updated with the players current angle+90. This way the player can jump/fall etc etc and return to ground hugging mode..
(I may yet move the DirAngle into another parameter to pass to the function ..... :? )

Please start playing with it/experiment with different surfaces, game ideas, etc, and let me know what you want to do with it as far as improving it..

if the code can not be worked out by anyone, let me know and i will do a step by step on "how it works"
there is two global scripts - one fro global variables and one for the function.. and a small script in the draw actor of the player to move him, and that is all..

The main var to play with, is the velocity (in global) - the faster you go the less accurate you are, but because you go faster... you really can't tell anyway.. :lol:

cheers and have fun with it :)
Feral


FROM NOTES IN THE GLOBAL SCRIPT

// **********************************
// S T I C K T O
//
// a ground hugging function by feral
// **********************************
// USAGE:
// 1.call before setting angle and directional velocity/
// 2. pass a number or a var for how many degrees to check each step,
// 1 is slowest but more accurate -
// 20 is about max depending on type of ground surface
// higher numbers (on rough surfaces) can get very unpredictable
//
// The directional angle of the actor should then be set to angle=Direangle-90;
// DirAngle is a GLOBAL float VAR
//
// NOTE: currently works best with round sprites...
// although is effective on other shapes depending on game
// to use with odd shaped sprites it is recommended
// to use a round "hidden" sprite as the object of the function
// and overlay the animations as a separate sprite.
//
// THIS IS REVISION 1.0 please check for later versions
//
// later versions will have binary searching to speed up the collision checks
// and an incremental pixel by pixel detection option to avoid moving through thin walls
// it will also be able to distinguish between collision objects .
//
//
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby feral » Wed Jun 25, 2008 10:40 pm

sorry for the bump guys,

but, I could really do with some feedback on this, as I am working on improved versions, and really need to know if this works
OK,

Or does it need any sort of fixes ? or you have tried it with particular "ground surfaces" sprites etc that don't work well.. or whether it just not needed ??

or anything else...

thanks in advance
feral
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby Fuzzy » Thu Jun 26, 2008 11:31 pm

I'll check it out and get back to you, ok?
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby DST » Fri Jun 27, 2008 2:03 am

Its pretty nice, and very useful as a replacement for paths, because now these paths can not only be paused, but can also loop with no displacement, and change speed.

The only thing is how we can teach it which actor its looking for in the collision free, but i'm sure you got that figured out....lol


Excellent addition to GE!
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby feral » Fri Jun 27, 2008 2:20 am

DST wrote:The only thing is how we can teach it which actor its looking for in the collision free, but i'm sure you got that figured out....lol


yeah...already got that figured out :wink:

just waiting for any feedback suggestions etc.. then I will do a rewrite/update

feral
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby catacomber » Fri Jun 27, 2008 3:20 am

Feral, this isn't feedback but I'm dying to try this. I have heavy commitments over the next 2 weeks then I'll give it a shot and catch up here. : )
User avatar
catacomber
 
Posts: 195
Joined: Fri Sep 28, 2007 5:36 pm
Score: 10 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby Fuzzy » Fri Jun 27, 2008 4:53 am

I'm really liking it. I'm mulling over the code for ways to sharpen it up if you dont mind.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby segwego12 » Sun Jul 13, 2008 4:51 am

yah, nice. I'm taking it easy, k?
http://www.freewebs.com/primewaregames/

The Primeware Games website

Projects
Era of Rome: Done
segwego12
 
Posts: 167
Joined: Mon Jul 07, 2008 2:48 am
Location: My Website, please come to my website.
Score: 3 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby sonicunleashed » Tue Jul 29, 2008 2:27 am

I USED THIS BUT IS SONIC GONA BE ABLE TO STAND UP :?: :D :D :D :D :D :D :D :D :idea:
sonicunleashed
 
Posts: 19
Joined: Fri Jul 18, 2008 12:44 am
Score: 0 Give a positive score

Re: SONIC PATHS - Stickto() Function

Postby feral » Tue Jul 29, 2008 3:55 am

sonicunleashed wrote:I USED THIS BUT IS SONIC GONA BE ABLE TO STAND UP :?: :D :D :D :D :D :D :D :D :idea:


to make sonic stop/stand-up and/or jump etc ... simply stop using the stickto() function, and change to using regular movement codes.
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest