Computer Science Canada

Animation At Regular Intervals-Characters and Scrolling Map

Author:  GreenTiger [ Tue Apr 27, 2004 11:36 am ]
Post subject:  Animation At Regular Intervals-Characters and Scrolling Map

Alright, guys, I could use some help here. Anyone who responds gets their name (or email or whatever they want) in the "credits" section of my game.

I'm making a Final Project for CompSci in Turing 3.11. It's an isometric action RPG, and I need some help with animation stuffs.

Here's some quick info on my project, I'll upload links to my actual source code (so far) when I'm done. I plan to donate the final project source to the site to be used as a tutorial in a number of things.

Okaydokie - So first off, the map data is imported from a file into a large array. The map is then displayed based on the "camera" position; which will follow the player as he reaches the edges of the screen. The characters are actually broken up into limbs; with anywhere from 5-36 'position' sprites for each limb (head, torso, left arm, right arm, left leg, right leg and 'tail') Which should be able to animate seperately from the others. Finally, magic attacks and weapons (positioned based on the user's positioning) should also animate.

Okay here's the story, I want to get rid of that evil flicker. I'm guessing it happens because of irregular intervals between redraws, so I thought I should create a stopwatch that would count millseconds and would redraw everytime a certain number of milliseconds went by.

Am I going in the wrong direction with this and everything? How should I do this?

Author:  fatboy316 [ Tue Apr 27, 2004 12:25 pm ]
Post subject: 

have u tried setscreen("offscreenonly")

Author:  Tony [ Tue Apr 27, 2004 12:34 pm ]
Post subject: 

here's the problem - a timer would not get rid of the flicker, it would just stretch out the time of it... Confused

basically the ficker occurs cuz turing draws parts of the screen too slow and when you start drawing the new screen, you still see parts of the old before all of the new graphics appear, and that causes flicker (its really bad if you clear the screen compleatly at first)

Using View.Set("offscreenonly") solves the problem, but it is a v4.x feature. You'd need to update your compiler

Author:  GreenTiger [ Tue Apr 27, 2004 3:51 pm ]
Post subject: 

hmm...that could be a problem there...you see, not only do we not have anything above 3.11, but our teacher doesn't want us to use it. (Damn him)

So in Turing 3.11, it is not possible to draw off the screen at all? Because if it was, I had another idea to fix the problem...basically goes like this;

while it's loading, it creates a single 'floor' of the map at a time, then takes a picture. With the picture of each floor stored, it simply stacks them on top of one another, then moves them in the x and y position as the player proceeds across.

However, all collision detection would still need the original data in the array, wouldn't it?

Would that work?

Author:  Tony [ Tue Apr 27, 2004 4:04 pm ]
Post subject: 

eh, I'm not sure what you're saying...

but if you absolutly "must", you've got to try to draw as little as you can and as fast as you can at each frame to reduce flicker. Such as if it's the map we're talking about, just draw two little squares at a time. Character in new position and position where character was before to clear that.

Author:  Delta [ Tue Apr 27, 2004 4:31 pm ]
Post subject: 

Please explain what your trying to do once more...but very clearly....
why are you redrawing the landscape over and over again? I see no reason to do this.... maybe your just taking this idea the wrong way.... but ya.. explain more clearly please

Author:  GreenTiger [ Tue Apr 27, 2004 4:41 pm ]
Post subject: 

I intend to have maps bigger than the screen;
as the character moves across the map, the map will have to move underneath the character (scroll) so that the character can move with it. That'll all be done for when the character has been actually pluged into this section (still working on the 'persons' class) but also, the landscape should block the character if he moves behind a hill. To make sure the character's image doesn't appear behind him, shouldn't the map be redrawn over and over again? Or is there some tricky way to do this that my teacher hasn't taught yet?

Author:  Raugrist [ Tue Apr 27, 2004 4:49 pm ]
Post subject: 

Are you by any chance using processes?

Author:  Delta [ Tue Apr 27, 2004 4:55 pm ]
Post subject: 

Ok I have very bad news for you.... that'll never work! well ok it would... but way way too slow especially for only being able to use winOOT. But ya... if you still wanna go with that Idea I suggest shrinking the screen size to like 300 by 200 or something small... and no do not constantly draw the ground... only redraw the ground if the character moves... and only move the ground in the direction of the character... if you are not using sprites I suggest using them too... that way your problem is almost fixed... sprites don't have to be erased.... they can be put on seperate layers also... which is a very good thing... if the player is block from view... well then you should make the ground shorter... or the player taller... don't let him get completely out of view if you can help it... then your set... if I missed something I'm sorry

Author:  Tony [ Tue Apr 27, 2004 4:56 pm ]
Post subject: 

the issue here is lack of double buffering in turiing below v4.x Rolling Eyes why would you teacher not let you use the newer version of the compiler though?

Author:  GreenTiger [ Tue Apr 27, 2004 4:59 pm ]
Post subject: 

I know how to...but I'm not using them just yet. I'm going to use them for my music/sound effects...maybe the control interface...I don't want to use too many processes if I can help it...my teacher said that if you fork to too many processes, your program could get all forked up.

Author:  Tony [ Tue Apr 27, 2004 5:02 pm ]
Post subject: 

you teacher is an idiot, you shouldn't be using processes at all Laughing

Author:  Raugrist [ Tue Apr 27, 2004 5:04 pm ]
Post subject: 

GreenTiger wrote:
...my teacher said that if you fork to too many processes, your program could get all forked up.

Hahaha, that's almost as funny ass the recursion knock knock joke. Anyways, yeah your teacher is right. Processes can really mess you up if you don't use them right (if your drawing in them), but there was some drawcheck procedure that can help you with that if you have to use processes.

I just thought of something. Are you drawing the ENTIRE map each frame? Because if you are, then each tile that is offscreen is still being drawn and will slow things down considerably.

Author:  Delta [ Tue Apr 27, 2004 5:07 pm ]
Post subject: 

I suggest using processes... just not too many... Tony is just all wrapped up in Turing.... he isn't thinking too clearly thru the eyes of OOT.... If you can help it sure stay away from them... but they are fun and nice Smile ... just don't put too many graphic processes all at once.

Author:  Tony [ Tue Apr 27, 2004 5:09 pm ]
Post subject: 

shut up delta, you don't know what you're talking about Laughing

Author:  Delta [ Tue Apr 27, 2004 5:14 pm ]
Post subject: 

shut up eh? oh thats it... I'm gonna talk to you on
msn because your just becoming a nucense! Wink

Author:  GreenTiger [ Tue Apr 27, 2004 5:21 pm ]
Post subject: 

Now, now. No flaming. (Never thought I'd have to say that to another Mod)

Anyways, no, I'm not using any graphical processes...and yes, I would be drawing the tiles offscreen as well...but I havn't made my maps that big yet...and it still flickers too much for my liking.

I guess if my teacher forces me to use 3.11, tho, maybe that's the best I can do...

Maybe I could use that arguement to coerce him into helping me... Twisted Evil

Alright, I could still use some help...is there any way to get music to loop *perfectly* ? I got my delay between each song down to like a half a second or so...but... that's still some dead time.

Author:  Dan [ Tue Apr 27, 2004 5:27 pm ]
Post subject: 

i have not been flowing this topic long but have to checked to see if ur musick files have any dead time at the being or end? b/c that whould do it.

Author:  Delta [ Tue Apr 27, 2004 5:31 pm ]
Post subject: 

who cares about a lil dead spot... it doesn't matter... just think if you did what I told you to do in the longer post I wrote ... then you wouldn't have these problems as much... but whatever... don't listen to me I don't know anything Wink

Author:  GreenTiger [ Tue Apr 27, 2004 5:31 pm ]
Post subject: 

That was THE first thing I checked...(actually, maybe the second)...but yeah, I made sure there was like no dead time...it happens for both wave and midi files.

Author:  Delta [ Tue Apr 27, 2004 5:35 pm ]
Post subject: 

I dunno about you guys... but ya... I don't have any music :S

Author:  GreenTiger [ Tue Apr 27, 2004 5:37 pm ]
Post subject: 

lol, Didn't mean that. Trust me when I say I'm taking EVERY single one of your ideas into consideration.

Thing is, this was like in a seperate program I was using to test the looping of music...so like nothing else was running...

but I guess you're right, for a school project (even if it is a final) some dead time shouldn't matter much.

I'm the only one using isometric views anyway...that should be enough

Author:  Tony [ Tue Apr 27, 2004 6:27 pm ]
Post subject: 

what if you wrote it in v3.1 for your teacher to read the code but then add in double buffering(litteray 2 lines of code) and compile that in v4.x for the demonstration purposes just to get rid of flicker? Thinking

Author:  GreenTiger [ Wed Apr 28, 2004 7:47 am ]
Post subject: 

Perfect. <Evil thin smile crawls across the villain's lips>

Ok, Delat's gonna let me use the latest version of it, but he says that he wishes me luck...apparantly he thinks 4.03 is really buggy...

<Oh, yeah, I'm typing this from my CompSci class right now.>

So then, where do I download the LATEST version of Turing?

Author:  McKenzie [ Wed Apr 28, 2004 10:14 am ]
Post subject: 

Turing 4.0.5(<a href="http://www.holtsoft.com/transfer/turing405_install.exe" target="_blank" class="postlink">download</a>)

Author:  GreenTiger [ Wed Apr 28, 2004 4:53 pm ]
Post subject: 

Okay thanks. I've finished getting the new WINOOT and skimming thru it's new features. I've dled DanSprites...and I still have a question. What determins the height that the sprites are at (I'm guessing that the 'height' term = 'layers' like in other languages and photoshop, right?)

Author:  Paul [ Wed Apr 28, 2004 4:54 pm ]
Post subject: 

Yea it does, me and Tony had a funny misunderstanding about that.
I couldn't find a height setting in DanSprite Sad
I think thats why when 2 sprites were in the same position, the image wouldn't erase in my "whack the man" game using DanSprite. You can ask dan though. It would prolly work well if you don't have 2 sprites at the same space, I'm still not sure about the height though. (wouldn't depth be a better term?)

Author:  poly [ Wed Apr 28, 2004 5:11 pm ]
Post subject: 

what he's letting you use the new updated turing? He said he didnt want me coding in that, i HAVE to use 3.1... it sucks we have 4.blah on the computers but aparently its way too buggy to use and he's too cheap to let us all download the FREE patch for it (on holts site)

Author:  Raugrist [ Wed Apr 28, 2004 5:14 pm ]
Post subject: 

That's slightly ridiculous. Turing is bound to be buggy no matter which version you use, and there's little sense in giving up features for "greater stability". Unless you prefer fullscreen mode to View.Update.

Author:  GreenTiger [ Wed Apr 28, 2004 5:14 pm ]
Post subject: 

Yea, depth or layers would proly be better...I don't know...does the higher number mean it's closer to the front or farther?

Anyways, I'm not going to dis it, apparantly it's great...(I mean, I just got it and tried it out...and if it does what Holtsoft couldn't do (like everyone's saying it does) then as far as I'm concerned, it's great)...I mean, whenever a third party surpasses the original producer, by my standards, that is the ultimate level any programmer can/should hope to acheive in a programming language.

Dan, salutes to you!

<Edit: Oh, BTW; I was just trying out DanSprites, and as near as I can tell, you can put sprites on top of each other...? At least that's what it looks like...I took Dan's sprite display tester thingie and played around wit it some...or is that something else going on there? Note; the earlier the image is mentioned, the closer it is the front...connection to height maybe??>

Author:  Paul [ Wed Apr 28, 2004 5:16 pm ]
Post subject: 

Well in the traditional sprites. Im not sure if its right, negative heights go behind the background and positives go above it.

Author:  MyPistolsIn3D [ Sat May 01, 2004 4:04 pm ]
Post subject: 

Ahhhhhhhhhhh when i read greentiger's posts I hear Adam's voice inside my fucking head! Im going insane ! *Twitch* *Twitch* *Twitch* *Twitch* *Twitch* *Twitch* *Twitch* *Twitch* Hit Wall

Author:  the_short1 [ Sat May 01, 2004 5:18 pm ]
Post subject: 

? ? ? ? ?? ? wth ???


anyways...
sounds like quite a chanlenge..
if u can use the newest turing..
two DAM usefull commands...

Music.PlayFileLoop %% loop ur Bgrd music with a process **Music.PlayFileStop to stop the music... * try to make this a .mid
&
Music.PlayFileReturn %%% starts playing a sound (doesn't halt ur program... u can continue to do other stuff while its going..)
make these .wav and .mp3 then uj can hear them while ur Bgrd music is playing Smile

*** those two commands were the best out of new version of turing.. without it ... my Pac Man game woulda sucked.. THANKS to compwiz333 for telling me about that in the first place **im to lazy to look up each command..




** is ur old turing version able to do fullscreen???
i wish holtsoft would let u do that in the next update.. Sad

Author:  MyPistolsIn3D [ Sat May 01, 2004 5:26 pm ]
Post subject: 

Dont worry too much Adam, Delaat and Kranz are working on getting 4.04 installed on the network at school.

Author:  Tony [ Sat May 01, 2004 5:30 pm ]
Post subject: 

if you installing a new version, might as well install v4.0.5 Rolling Eyes

Author:  the_short1 [ Sun May 02, 2004 6:10 pm ]
Post subject: 

yea... no kidding.... espcially since 05 tells u where turing saved ur file when turing crashes...

Author:  GreenTiger [ Sun May 02, 2004 7:05 pm ]
Post subject: 

I think I got this problem just about solved...in 3.11 no less...although easily enough transfered to 4.05 (just have to change the isometrics to accept DanSprites - the isometrics is the only thing that ever even touches sprites...that and the so-far unprogrammed 2D engine used for the menus ect.)

Thanks guys for all your help...I'd give you all bits, but I think the amount of bits I could give you guys would be rather insignifigant compared to your current count.

Author:  the_short1 [ Sun May 02, 2004 7:34 pm ]
Post subject: 

every1 getting 5 bits... ehhehe... that would be cool/...
saves us from posting 3 times Wink


im glad u got ur stuff figured out.
and that ur teacher will let u use it... or that u can be sneaky and do it behind ur teachers back ***hes an ass if he wont let u use good version anyways..

Author:  white_dragon [ Tue May 04, 2004 2:02 pm ]
Post subject: 

all u have to do is just redraw over top of them!!!!!!!!!!!!!!! it's alot easier!!!!!!!!!!!!!!!!!!!!!!!!!!


or u can draw a big white box on da whole screen n redraw ur stuff.

Author:  the_short1 [ Tue May 04, 2004 4:49 pm ]
Post subject: 

yea... but thats not the PROPER... and EFECTIVE way of doing it... and that slows it down..... SPRITES are da best... i can wait for DAnSprite v 2 to be out... then i will try to make something out of it..

Author:  Paul [ Tue May 04, 2004 4:53 pm ]
Post subject: 

Haha, my teacher called holtsoft, and they said "don't use sprites, View.Update is better" Shocked

Author:  white_dragon [ Wed May 05, 2004 3:49 pm ]
Post subject: 

i thought u can only use sprites in 3.11????!?!?!!??!?!!?!?!?!!??!?

Author:  white_dragon [ Wed May 05, 2004 3:49 pm ]
Post subject: 

can u use them in 4.05?

Author:  Dan [ Wed May 05, 2004 4:18 pm ]
Post subject: 

white_dragon wrote:
can u use them in 4.05?


no

Paul Bian wrote:
Haha, my teacher called holtsoft, and they said "don't use sprites, View.Update is better" Shocked


well it realy is, just harder to use right.

Author:  the_short1 [ Thu May 06, 2004 11:19 am ]
Post subject: 

ju can use sprites in version 4.05.... use DANSPRITE!!! soon to be v2... CUz dan rocks Smile

Author:  GreenTiger [ Mon May 10, 2004 11:09 pm ]
Post subject: 

Okay, I'm still working in 3.11 (sorry if I'm making you guys throwback your tech just for me) and I've got it pretty good.

I'm having slight difficulty with the character's legs being shoved further into his stomach after he STOPS moving, but it seems fine before and after the movement.

Getting rid of the strange flicker would be nice, but unneccessary.

By the way, any suggestions for collison dection, right now he will walk straight through any walls...I started working with some if statements, but the'res gotta be a better way to do it, right? Like bounding boxes of some sort? Any ideas?

Thanks in advance.

<EDIT: The attachment still doesn't like me on a regular basis, so I uploaded the file on my site.

Here's the address:
www.ccc.horizonhouse.ca/CompSci/splice.zip
Here's the comment:
I rewrote one of my classes pretty much from scratch, then spliced it with the original, then used a combination of new and original code in other files to get it to run. The result is this splice...on it's way to being an Action RPG but still a long way to go.>

<EDIT 2: Okay, my file didn't upload right (figures) so I'll try putting it back up as soon as I get home todays from soccer at 6:something-ish. Ignore me until then.>

Author:  the_short1 [ Tue May 11, 2004 3:11 pm ]
Post subject: 

i take it whatdotcolor is out of the question??? bummer... although i made my pacman wall boundaries b4 i knew what whatdotcolor was... Sad



works good for me:
grid of area using coords..

r0/c0 c1 c2 c3
r1
r2
r3
r4

then u can just use copy and paste tons of times...


say tere s a wall from c0>c2 at r2 then.,.,.

code:

c0 := 0
c1 := 50
c2 := 100
c3 := 140
r0 := 0
r1 := 50
r2 := 50
if guy moving down then
if guyx = c0 and guyy = r2 then
move := false
elsif guyx = c1 and guyy = r2 then
move := false
elsif guyx = c2 and guyy = r2 then
move := false
end if
if move not = false then
guyy -= 25
end if
end if


well that worked for me... maybe it can work for u.. hopefully....

of course... use an array..
var r,c : array 0 .. 15 of int

* i started my pacman without the knowledge of arrays then it was too hard to convert into array for r and c so i said screw it... Sad



now for the flicker... are u using cls or drawing a black box over the old picture.... cls = bad.....

but then also.. if u had newer turing u can View.Update... Sad


hope that all helps u out...

Author:  GreenTiger [ Fri May 14, 2004 7:28 pm ]
Post subject: 

I don't know about whatdotcolour...it all seems to be a fad to me...don't see why so many peeps use it for colision detection...maybe other stuffs...

anyways, yeah, it's out of the question...I'll consider your idea, but I'm not sure it'd work for mine...

Actually, I'm going back to using a full-fledged physics engine (Delat told me it wouldn't be worth it) and now my collision detection seems to work great!

(Music and Writer's Craft have gotten in the way of me FULLY testing it, but it works for a few, so it should work for ALL (that's my idea of efficent coding, and a standard I try to hold throughout my code) course, the problem is that maybe I just THINK they're working, and they're really screwing up...and if one screws up, they all will.)

I'll check it after I've finished rendering these weapons here.


: