Playback from an array.... Big problem... help \o/
Ok, got another problem with this game i'm making. The problem is as follows.
I'm recording the location of the player character to an array, then playing it back as a recording, like a ghost car in a racing game, allowing you to compete with your own last lap. However, the player character can also open doors, and those doors also need to move in the playback, no problem I thought, I'll just record the location of those to an array aswell, and play them back the same as the player character. The problem however, is that now, if the location of the door is being played back from the array, they can no longer be interacted with while the playback is occuring. i.e. you click to open the door, but because its location is now being controlled by the array, it refuses to open, only doing so when you opened it during the first play through.
Hope that made sense.
I've got a couple of ideas of how I could get over this, but nothing that isn't very complicated and a big ass ugly nightmare.
If someone can come up with a simple-ish way to both playback the opening of the door, and have it usable at the same time, I would really, really apreciate it.
Thanks again for all your support folks, you've been a massive massive help.
Re: Playback from an array.... Big problem... help \o/
How about having 2 doors at each location? A 'real' door and a ghost door. The player can open the real door and walk through the ghost one if it's closed.
Re: Playback from an array.... Big problem... help
A good idea, and one of the things I was considering, the only problem is, there's going to be multiple doors and moving objects, and 2 replays will be possible simultaneously, making that a bit of a nightmare, since i'd need 2 ghost objects for every moveable object. If I have to do it that way, then I will, but ideally i'd like to find an easier, simpler, and less time consuming method :)
Re: Playback from an array.... Big problem... help
Quote:
...there's going to be multiple doors and moving objects, and 2 replays will be possible simultaneously, making that a bit of a nightmare...
You ain't kidding! :D
Is it not possible to check the player's position during playback and say something like:
If player is within num distance and playback01 is greater than num distance from door, then player can go through?
Re: Playback from an array.... Big problem... help
Well the door opening, and most of the other moving objects are activated and controlled by the player. The door for example is raised when the player character is over an activation button, AND holds the left mouse button down on the button. This raises the door, if the user moves away from the button or releases the LMB then the door falls. Thats the kind of moving object i'm talking about.
Man, talk about giving yourself a headache :P
Ideally I need a way of writing to and playing back from the same array simultaneously, would that even work if I could do it. Man even getting this straight in my brain is proving tough :)
Re: Playback from an array.... Big problem... help
Im going to try to see if i understand your problem, then suggest a solution.
From what i understand, you need the ghost to act just like the player, in that doors are open, enemies were shot, keys retrieved, just like when the player did.
Heres my theory: If you record keypresses, instead of positions, you can have the computer play the level, in real time, not just play recordings. With simple changes, you can make it record mouse presses too
I foresaw this problem :) , and a week after uploading the first one, i put a revised version up
Check it out :cool:
Note : it only works if you coded your own movement.
Re: Playback from an array.... Big problem... help
Ah, thats a very interesting idea. The only problem I forsee with that (and I might be wrong) is that if the key presses were being replicated by the program, would that interfere with the user pressing the keys live as the replay plays ?
The other idea I had was to use a string that will constantly update with the doors Y location as the Global Value A counts up, and then have an event that lets the array control the location of the door, ONLY when the string changes from the default location. That way the door would only move when it had been recorded as moving, and would be freely controlable the rest of the time. Would that work ?
Cheers for all the help.
p.s. I'm having another odd problem, when you hit the replay button, you, and the recording of you are sent back to the starting point. However, if you have scrolled the screen to a different part of the level when you hit the restart button, causing the screen to have to 'jump' back to the start location. For some reason an image of the playback version of the player character is left as an image in the level at the exact location they were when you hit the replay button. Its like if the screen has to move suddenly it leaves a ghost of the last location of the replay character at that location in the level. It doesn't do it if you press the restart button and the screen only has to move a little to get back to the beginning. Very odd.
Re: Playback from an array.... Big problem... help
I didnt understand the last post (sry snail), so im gonna reply directly to twistedchimps problem.
It shouldent interfere with the doors, if you combine the two opening events (Player, Computer). That way it will open if the player needs it to or if the computer needs it to.
Help me out a little. Are the ghosts the screen leave behind your ghost objects, or just artifacts? If they are artifacts, ive run into the same problem. Either way, this problem will be easy to solve :)
Re: Playback from an array.... Big problem... help
Thanks both for the responses. Snails idea of using a sensor that is triggered by the ghost player is definatley a good one, however the user needs to be able to move past these buttons without activating them, so a click button is about the only way.
Atrill, your idea about having the game record key presses sounds ideal, but the way these objects are working is..
If - the player is over a button &
If - the player clicks and holds the left mouse button on the button
Then - raise the door
Tell me this, if the game is recording button presses, and records me hitting the D key, which moves the player character to the right. When you replay it, the ghost will be moved right, but then how to we stop it from moving the live playthough player character to the right at the same time ? Sounds like you have an idea how :) (Having to record the fact that the user clicked on the button specifically (to open a door) aswell would be difficult wouldn't it ?)
As for the artifcats, they are definatley artifacts since sometimes you just get bits of the image cut off by the edge of the screen. You basically end up with a bit of the player character replay image stuck to the background wherever it was when you clicked the replay button. Yes it only happens when the screen has scrolled from the starting location to a different bit of the level. Even if its only scrolled 100 pixels along the X and Y axis, you still get the effect as the screen snaps back to the start location.
Re: Playback from an array.... Big problem... help
Ill create a short demo of the technique for you, using click buttons for the doors.
As far as the artifacts go, im trying to recreate the problem here.
I will suggest moving the screen scrolling code to the end of all you programming code. It can sometimes solve problems you may have. I also suspect that it has something to do with the drawing settings for the computer player. That would depend on if your using clickteams movement, or if you made your own. Im guessing that the screen is scrolling back to start before the ghost is repositioned, so that area or the frame where the player was originally at doesnt get updated.
Note: Im about to make huge assumptions that may be far from true :)
Im assuming that if a player is moved with a clickteam movement, then tgf knows it should update the area of the frame that the character is at, no matter where it is. If you move your character procedurally (ie. Like you are now), tgf wont get the idea that the objects not stationary and should be updated when off the screen.
I wont be able to be truly helpful until i recreate it here.
If that was confusing let me know, i kinda confused myself :grin:
EDIT :
Quote:
Snails idea of using a sensor that is triggered by the ghost player is definatley a good one, however the user needs to be able to move past these buttons without activating them, so a click button is about the only way.
Are the player and the ghost both the same kind of object?
If not, or even if so, you can get around this.
If they arnt, then only test for the computer character
If they are, store something unique to the player character and test for it at the sensors.
Re: Playback from an array.... Big problem... help
the player and the ghost should ideally be identical (save for a tiny graphical difference, for arguments sake say a little R above his head) Which do you think would be best, Snails method or yours ? I'll take a look at your file now. Thanks again for all this help.
edit - Ok, have checked out that file. Complex stuff (for me) So the keypresses each relate to a different array location on one axis, with the global value still counting up on another. But (in the Zeb example) I cant see how that array then relates to playing back the movement of the player character. (I'm presuming its not difficult to have the array control the movement of a duplicate player character and leave the live player character free to move ?)
Re: Playback from an array.... Big problem... help
How it works is this: There are two movement groups. One with 'Upon pressing a key' for the live character, and one with 'Array at posision = ' for the computer. When you play, the normal zeb movement is there to allow you to play, but all your keypresses are bieng recorded. Then, all you do is restart the level and set control to the computer.
You could easily have it set control to another player tho.
Snail suggested a detector, that opened the door when you clicked it(i think). That seems like a good idea, but my suggestion would only work for keyboard related things.
Its really up to your personal preference which will work for you.
Re: Playback from an array.... Big problem... help
hmm.. So when you say 'set control to the computer' how then can you play live using the same keys ? Let me look through that file again see if I can get my head round it.
edit - man, just as I felt I was getting to grips with this, i'm plunging head first into a load of stuff I'm struggling to understand again ;)
Re: Playback from an array.... Big problem... help
You have the controls set to only activate the second player.
Here, ill show you http://www.mediafire.com/?0ortv9thbyx
I did revise my strategy for simplicity and ease of use. :)
If you need help on anything, just ask.