The Daily Click ::. Forums ::. Klik Coding Help ::. Stop using alterable values for movement tutorials
 

Post Reply  Post Oekaki 
 

Posted By Message

Hagar

Administrator
Old klik fart

Registered
  20/02/2002
Points
  1692

You've Been Circy'd!Teddy Bear
29th April, 2004 at 09:19:44 -

Theres no need at all. They compilicate code and make it far harder to debug and learn.

A pro's 360 tutorial i downloaded set the current aa x pos to value a and then set the alterable value a to (aletrable value a + (sin alterbale value b * speed)) and then set the x pos to to value a!!! (its clever~ish using the event sequnce but it still sucks)

This totally stinks and is poor klikking, i can understand it but a noob has as much chance as a snowball in hell.

why not

always

set x pos to current x pos + sin(angle counter * speed counter)

Done nice and easy...

This annoyed me so much I am going to start writing my own 360 tutorials using normal counters and not alterbale values for everything.

So i call for no more alterbale values in movement tuts (unless its for ai players then its acceptable ).

Image Edited by the Author.

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
29th April, 2004 at 10:35:22 -

So are you talking about only 360 movement engines?

 
.

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
29th April, 2004 at 11:19:22 -

what mine?

 
.

Tigerworks

Klik Legend

Registered
  15/01/2002
Points
  3882
29th April, 2004 at 11:42:54 -

The system you mentioned is entirely intentional. An X co-ordinate or Y co-ordinate can only be an integer value. Since trigonometry deals with floats, the result is rounded off to a whole number so it can go to that co-ordinate. This can mean loss of accuracy in the movement, or it not working at all. Alterable values can store floats accurately so that's why the example stored the float position in an alterable value, then set the coordinate to what was in the alterable value.

 
- Tigerworks

Sage



Registered
  02/01/2004
Points
  43
29th April, 2004 at 12:01:08 -

Yeh I never use alterable values when making tutorials.

 
-Sage

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
29th April, 2004 at 12:23:16 -

Reason for alterable values:

• They can store decimal numbers (positions can't, try it next time before you complain)
• They're unique for each instance of the object, so it's easy to duplicate a movement across lots of objects. Try that with counters.
• You can rename them, so there should be less confusion than using a counter instead


Now give me a good reason to use counters instead...

 
n/a

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
29th April, 2004 at 12:33:04 -

Oi! He wasn't talking about using counters, read his post properly Mr Chris Firebranch Monkey

 
n/a

Kramy



Registered
  08/06/2002
Points
  1888
29th April, 2004 at 13:45:23 -

I agree with him. I actually didn't learn alterable values for a year. Probably why all my games sucked until then.

 
Kramy

Hagar

Administrator
Old klik fart

Registered
  20/02/2002
Points
  1692

You've Been Circy'd!Teddy Bear
29th April, 2004 at 14:45:06 -

Yes of course a monitor has subpixels, silly me. I'll remember not use my 1024.678 x 768.123 resolution again!, I must set the position to a floating point value...

And of course TGF can do decimal points in Alterable values, they must be majic...

Sorry for the sarcasm but my 360 engines in TGF work just as good

Image Edited by the Author.

 
n/a

Arf :: FPP Games



Registered
  15/05/2002
Points
  1364
29th April, 2004 at 14:52:27 -

Can't you still use a decimal system in TGF if you use the Advanced Math object's decimal offset?

Either way, storing a full decimal value rather than rounding to an integer at every step will always be more accurate, and sometimes that's very important. Your TGF engines will still work fine, but that doesn't mean they're the peak of accuracy and efficiency.

 
n/a

xXAaronXx



Registered
  09/06/2002
Points
  1012
29th April, 2004 at 15:15:41 -

Well im not sure what movement your talkin about but for platform movement I only use 1 value. I just use the regular platform engine and use one value for head collisions and in maybe 4 total events or so I can make a platform movement that works better than custom platform movements ive seen in other games and custom movements ive made myself that use tons of events.

 
I Don't Know...

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
29th April, 2004 at 18:35:09 -

Ah, but he was. And I quote:

"This annoyed me so much I am going to start writing my own 360 tutorials using normal counters and not alterbale values for everything."

Maybe you should read his post properly and not look like a fool

 
n/a

clwe



Registered
  17/12/2002
Points
  702
29th April, 2004 at 20:39:05 -

Well...if we're being really 'nerdy', I heard from someone that alterable values take up more memory than counters, because you're having to keep track of the activ object as well as the value. So if optimization is your middle name , then you might want to use counters instead. Or a numerical array in MMF. Anyway, you should use counters whenever possible in tutorials, to make them easier to understand.


Arf - "Can't you still use a decimal system in TGF if you use the Advanced Math object's decimal offset?"

Sort of. You can move the decimal offset of the object, so that all calculations have their decimal places shifted. For example, a decimal offset of 3 would change 0.707 to 707 (10^3). You retain most of the accuracy, just with larger numbers. To position an object correctly from here, you would set the X and Y to these large values, divided by 10 to the decimal offset. Or alternatively, you can move the object 1 pixel for every 10/100/1000 (whatever), and keep whatever's left over for the next move. So long as the 'precise' values are stored in counters, rather than relying on the object's current position.


Also...I've actually made a tutorial in TGF that does basic 360 degree movement, without alterable values. Don't know if anyone would be interested...? (I don't think it's worth making a download, myself)

 
n/a

Mr Icekirby



Registered
  18/12/2003
Points
  846
29th April, 2004 at 20:44:28 -

this is a pointless argument, its just his opinion, and if thats what he thinks, then thats what he thinks

it doesn't mean you have to go and disprove his idea

PS: hagartech, why not just keep your opinion to yourself unless you think it would revolutionize to world of klik, no offence

 
Mr Icekirby says so!
OBEY ME!

Echisketch(PS)



Registered
  20/03/2004
Points
  852
29th April, 2004 at 21:02:10 -

What stand do you have to say a pointless arguement kirby, pretty much every post you have is uninformative, annoying, and it screams newbie. Do you even click?!

 
"Everytime you use Kazaa, a metallica band member dies a little."
Quote Jonathon Smeby.

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
30th April, 2004 at 04:00:29 -

I'll have to take Chris Branch's side. What if you wanted 360^ for 100 objects? You can't do that with counters can you? Alterable values are unique and if you want a clearer name on them besides "Alterable A" and "Alterable B" then just rename them to "Angle" and "Speed" or is that beyond you? I bid you good-day.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
30th April, 2004 at 04:04:49 -

Good-day again, I also agree with Echisketch. Icekirby1 is a uninformative, annoying, modest orn. Look at his Sig!

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Hagar

Administrator
Old klik fart

Registered
  20/02/2002
Points
  1692

You've Been Circy'd!Teddy Bear
30th April, 2004 at 04:25:26 -

Qoute Chris Branch:

"Reason for alterable values:

• They can store decimal numbers (positions can't, try it next time before you complain) "

Do you need a position to accept a float???? No you dont, break your monitor and you will find the screen colour mask. This makes sure the elctrons hit the correct colour phosphors, This means that there is a minnimum value you can move a object, defined by the colour masks max resolution. So is there any point AT ALL of passing a float to a position? its like passing a float to the putpixel command in SDL, quite stupid.

So TGF CAN do trigonometry just as good as MMF, just work on everything 10 to the 4 bigger than divide it by 10000 (or an even bigger power), because MMF MUST round up to move an object on the screen anyway (can you place a object at 620.45678 x 345.765 ? according to your text, you can ). Cant you rename counters?? And If you bothered to read to my post i say its perfectly acceptable to use it for AI players

Dont get me wrong i aint cussing Chris Branch or Tigs there still probably more intelligent than me (You both write extensions and how in the world of bagels did tigs code the FISI object?????????) its just that i think for tutorials its is far better to use counters for learning purpouses. Like i could'nt understand the car example, but i got the idea (using a simple momentum triangle, taught in a level physics) and writ my own to correctly emulate the momentum, but i couldnt read the alterable values at all.

Image Edited by the Author.

 
n/a

Kramy



Registered
  08/06/2002
Points
  1888
30th April, 2004 at 14:27:42 -

Use counters. It's easy to switch from counters to alterable values, but not vice versa if you're a newbie(which is who the tuts are aimed at).

 
Kramy

Hagar

Administrator
Old klik fart

Registered
  20/02/2002
Points
  1692

You've Been Circy'd!Teddy Bear
30th April, 2004 at 14:37:34 -

Extactly my point

correction on last post: "still probably more intelligent than me", to "are more knowledgeable with how klik works" **blames guinness for how i am now **


 
n/a

Arf :: FPP Games



Registered
  15/05/2002
Points
  1364
30th April, 2004 at 15:07:20 -

"Do you need a position to accept a float???? No you dont, break your monitor and you will find the screen colour mask. This makes sure the elctrons hit the correct colour phosphors, This means that there is a minnimum value you can move a object, defined by the colour masks max resolution. So is there any point AT ALL of passing a float to a position? its like passing a float to the putpixel command in SDL, quite stupid."

You've missed the point. The alterable value represents the "real" position of the object, while the x-coordinate is just an approximation as you point out. You're passing the float to the position, but that's just the visual element. All the calculations you do will use the float, and therefore be more accurate.

An example: An object moves with speed X, which is added every 1/50 seconds to its position. Say X = 5. After one second the object will have gone 250 pixels. Now say X = 0.3. You see the problem? After 1 second, the object will have gone nowhere. If however, you added the speed to an alterable value and then set the position to that alterable value, the object would move 15 pixels in one second. Similarly, if the speed is any non-integer value then the alterable value method will always end up more accurate.
They are used to combat the very problem you describe -- you can't put an object at (300.467, 143.876), but using alterable values you can say that's where it is, even though its actual visual position is a slight approximation.

 
n/a

Mr Icekirby



Registered
  18/12/2003
Points
  846
30th April, 2004 at 16:46:52 -

3 things

1. yes i do click

2. i like to be annoying

3. does it really make a diference whether my posts are informitive?

maybe i should just leave, i never learn anything here anyway... i think i will

 
Mr Icekirby says so!
OBEY ME!

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
30th April, 2004 at 17:28:32 -

Hagar - I understand what you are talking about now. Newbies that don't understand alterable values will be stuffed! And counters will make it easier for those newbs who still do not understand alterable values. Nice thought.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Cybermaze



Registered
  03/04/2003
Points
  853
2nd May, 2004 at 05:45:34 -

Heres my 5 cent words.

Counters take up extra memory as they are extra objects, alterable values are built-in allready created counters built into active objects. So using counters in stead of alterable values take up more memory and adds more objects into the game.

So, values specific to a single object or instance of an object should use the instance alterable values. Both to save objects/memory but also because this makes eg AI cleaner and easier to produce. A game with a variable number of enemies (or just many enemies) is tedious to construct with counters as every single enemy needs its own set of events to drive its AI. Using alterable values a single set of instructions (events) can control all instances of one/more enemies/objects (given they behave alike of course).

Furthermore it should really not be all that difficult to understand what an alterable value is. Even newcomers should be able to understand it if described properly. Its really just a built-in set of counters so to speak. They are altered much the same way as counters.

Im not saying counters should never be used. Not at all. Counters should generally be used when displaying things onscreeen (eg HUD, hiscore etc) ... they are valid useable objects.

And some may need the floating point precision alterable values give you, but thats just a bonus in most cases and not the actual reason why alterable values should be used (unlees you really need the precision of course).

Image Edited by the Author.

 
If you knew, I would have to kill you...

Muggus

Possibly Insane

Registered
  31/07/2002
Points
  2958
2nd May, 2004 at 06:00:04 -

Alterable values are easier to understand when using MMF because you can name the alterable values and make them more meaningful.

But I understand that alot of people can be put off being seeing lots of alterable values used in cases in tutorials when counters can be used instead.
However, I think it should be noted somewhere in these tutorials, mainly for reference and keeping good programming effeciency, and of course saving objects, that Alterable values are far more effective when coding the actual game. Although this is more suited to 'extreme' cases where you need the most out of your object limits and effective coding.

That's why I'd dread to see anyone seeing the coding in my more complicated games. I'm lucky to use one counter in a level, even with a HUD and all, where I tend to use string objects.

 
MUGGUS
Come and annoy me more at
www.muggus69.tk
STOUT ANGER!!!

Kramy



Registered
  08/06/2002
Points
  1888
2nd May, 2004 at 14:43:38 -

Once I made an RPG engine in TGF. The inventory/battle/speech/movement/menu systems were all in one frame, so I wouldn't have to save anything from one to the other. It even had health/mana percentage counters.

 
Kramy

Hagar

Administrator
Old klik fart

Registered
  20/02/2002
Points
  1692

You've Been Circy'd!Teddy Bear
4th May, 2004 at 13:55:16 -

Chris: Im fully aware of what type of data a trig function returns and i am fully aware that what i do is VERY bad practice in MMF (is there a advanced math object for mmf??????). But in tgf it doesnt hurt, as you divide by 10,000 or 100,000 or even more if your working at higher accuracy (the power), i have had to write programs in C using double's (double length floating point for better accuracy when doing trig etc) and do software for calculus, differentiation etc so im fairly up on all that jazz .

 
n/a

sayajjin



Registered
  22/08/2003
Points
  14
9th May, 2004 at 09:11:05 -

Im still a beginner, but when i first started making stuff with mmf, just trying to figure it out by myself without studying other peoples tutorials, i always used a lot of counters. Thanks to the brillant and helpful tutorials by tigerworks and others i started working out how to use alterable values (among other things) for the same purpose. The result was my code was totally simplified.I only recently started doing this so im still quite excited because its opened up a lot of new ground for me to explore. The point is that if only dumbed downed examples were given id probably never figure out the good stuff. And for me the hard part with the movement tutorials is not the alterable value concept actually thats easy! I havnt studied math for 12 years so its really hard to understand the mathmatical concepts. Anyway i really appreicate seeing how people really write code, its helped me -thanks!

 
n/a

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
9th May, 2004 at 09:43:24 -

In direct response to the thread's title:

No! Long live Alterable Values!

 
n/a

Mr Icekirby



Registered
  18/12/2003
Points
  846
9th May, 2004 at 10:52:53 -

alterable values have their uses

some admin, just come close this topic, its getting old

 
Mr Icekirby says so!
OBEY ME!

Evil Monkey



Registered
  08/12/2002
Points
  598
9th May, 2004 at 12:38:44 -

What's wrong with alterable values? You can rename them if you have MMF. Didn't you know that?

 
Project Progress:

1.: Droid Runner (5% Complete)
Finishing Up Game Engine
   

Post Reply



 



Advertisement

Worth A Click