The Daily Click ::. Forums ::. Klik Coding Help ::. Is it possible to create mario kart style ghosts of players actions
 

Post Reply  Post Oekaki 
 

Posted By Message

Marcello64



Registered
  16/05/2007
Points
  144
18th March, 2009 at 10:39:24 -

Is it possible to record a players control input movements throughout a level and then have him race against himself (like mario kart ghost racing)

Sorry if it isn't very clear, is it hard to do ?

Edited by Marcello64

 
Sig: I'm not the Marcello from Cellosoft.

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
18th March, 2009 at 11:09:30 -

Hmmm... it depends on the movement you have. There was an extension eons ago that recorded movements, but I don't think I ever got it to work.

You could theoretically detect changes in speed and direction and record them in a txt or ini or whatever file, and then read them back. I suppose you could also detect length of input, but that could be imprecise and a hiccup could cause the racecar to turn into a wall too early or something.

Try the first thing... start a fastloop. Set a counter to current racecar speed. On loop, compare two general values, counter, and current speed. If they are different, record the change and set the counter to the new value. Do the same with direction... You'll have to have some sort of cushion. Perhaps just record the speed and direction regardless of whether it changed... or maybe you could figure out a timestamp. It's worth a shot.

A few more details on the movement?

 

  		
  		

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
18th March, 2009 at 11:47:04 -

Oh yes. Every time the player inputs a command have an array record the X and Y positions, the direction and anything else important. Then just duplicate the racing object and tell it to run off them commands!

Or be hella unresourceful and set it to record the X, Y and direction of everyframe to an array, have the ghost object have no movement and when the ghost is running set it to X and Y position as it moves down the array.

Years back a friend of mine was working on a vertical scroller that had a kind of rewind feature which also saved a replay, something by Biax if memory serves.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
18th March, 2009 at 13:01:04 -

I just used the key object and recorded when keys were pressed or released then applied the same inputs based on a timer.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
18th March, 2009 at 13:08:48 -

That's what I mentioned--the timer is a very inaccurate thing to use for something such as this. Differing computer speeds and processor/memory hiccups can throw everything off.

 

  		
  		

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
18th March, 2009 at 14:10:26 -

not if you use timeX extension. its based on teh processor independantly of the app. the way mmfs timer SHOULD be. so if the program slows down, the timer doesnt.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
18th March, 2009 at 14:21:50 -

MMF's timer can do that. It's the machine-independent speed option. The problem is, when you have the time independent, the animations are too so things skip and look funky. TimeX separates them.

 

  		
  		

Fifth

Quadruped

Registered
  07/05/2003
Points
  5815

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
18th March, 2009 at 17:43:04 -


Originally Posted by UrbanMonk
I just used the key object and recorded when keys were pressed or released then applied the same inputs based on a timer.



This can be a good method, but it needs to be very precise (I'm hoping "timer" would refer to a counter that's constantly counting, and not the actual timer?)

Specifically, if you have two active objects colliding with one another, the collision may end up a little different if the screen happens to be scrolling in a different manner than when it was recording. It should work well enough if you don't have any active/active collisions, or if you manage to do away with scrolling. But it can be tricky either way.

 
Go Moon!

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
18th March, 2009 at 23:16:29 -

By timer I meant a counter object that increments every loop.

Yep

 
n/a

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
19th March, 2009 at 00:14:14 -

In basic, as people are pointing out, theres two different methods. Either you can record the exact position and properties of your player for every single frame, or you can record each input the player made and then simulate the replay by reading all these inputs in the exact same order/time. This latter method is exactly how say Warcraft III or Starcraft save their replays. But if a single bug occurs in this replay data, or if even one thing gets out of sync, it will crash and burn because the inputs will no longer make sense in each step. Thus saving each frame of gameplay is *simpler* in terms of coding and much more powerful for manipulation, but requires enormous amounts of data.

In my current project, I save up to 10 seconds of gametime all the properties of up to 500 objects, each with up to 12 properties that take up 4 bytes of data each (1 integer = 32 bits = 4 bytes). In a worst case scenario, this means I need (10*50) * 500 * 12 * 4 = [b]12 megabytes[/b] of data in my array, just for 10 seconds worth of gameplay! Imagine how much it would take to save 30 minutes worth!

But in this case I think you could get away with just saving the X/Y position & properties of each frame into an array, because you're only saving a single object. Just be very conscious of how large the 'replay' array really is

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
19th March, 2009 at 00:19:32 -

Where's Hempuli? I think he did something akin to this with his backwards mario game...

'POOOOLIIIIIII!

 

  		
  		

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
20th March, 2009 at 02:11:20 -

I personally wouldn't rely on MMF's capabilities to accurately simulate the correct inputs at each designated time to choreograph a replay. There's also a slightly disregarded problem with said method being the replay of opponents. Seemingly reproduced movements within the programming in each instance of any given opponent is still greatly influenced by MMF's ability to tell them what yo do. If MMF skips a beat then perhaps your character will do exactly what he did but the opponent will be out of whack.
(Imagine jumping on a mushrooms head in Mario that isn't underneath you, even if the replay is accurately representing your character)

Recording each objects X,Y coordinates, at the end of each cycle, into an array would probably be the best option. Yes it would account for a fairly large replay file but now you understand why so few games include such a feature.

You could do a hybrid work around by using inputs for the character and recording X,Y coordinates for the enemies, it might help reduce replay file size.

Don't forget knowing the X,Y position is only a part of the battle, you have to know said animation at said coordinate as well. If you watch replays in GTA San Andreas you'll notice that they skipped out on properly syncing animations to replays as to cut down on replay file size.

Good luck.

 
thinking is like pong, it's easy, but you miss sometimes.

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
20th March, 2009 at 11:43:59 -

http://www.create-games.com/download.asp?id=6815

Pretty sure this game uses a ghosting thingy

 
n/a

Fifth

Quadruped

Registered
  07/05/2003
Points
  5815

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
20th March, 2009 at 18:10:26 -

( http://www.create-games.com/download.asp?id=6816 So does this one! )

Yeah, "One More Time!" came to mind for me, too. I wonder what method he used?

 
Go Moon!
   

Post Reply



 



Advertisement

Worth A Click