The Daily Click ::. Forums ::. Klik Coding Help ::. Object matchmaking
 

Post Reply  Post Oekaki 
 

Posted By Message

Jonny



Registered
  01/11/2006
Points
  29
5th November, 2006 at 22:49:50 -

If you have more than one object thats duplicated, but you want to link it to a detector thats also been duplicted more than once, how would you pair them so that MMF doesnt get confused?

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
6th November, 2006 at 00:21:55 -

Spread a value in both of them, and pair objects with matching values.

 
n/a

Jonny



Registered
  01/11/2006
Points
  29
6th November, 2006 at 01:01:05 -

Thanks axel. It works, but I have no idea how it works . Could you explain please?

Image Edited by the Author.

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
6th November, 2006 at 01:41:04 -

* Always
- Spread value 0 in alterable value A of "Object 1"
- Spread value 0 in alterable value A of "Object 2"

* Value A of "Object 1" == Value A of "Object 2"
- Do stuff

Basically it assigns an unique ID to each instance of Object 1 and Object 2. Then you just link objects with matching IDs.

Image Edited by the Author.

 
n/a

Jonny



Registered
  01/11/2006
Points
  29
6th November, 2006 at 01:47:33 -

Thanks, I get it now

 
n/a

Arneckian



Registered
  17/01/2005
Points
  984
6th November, 2006 at 04:17:25 -

Ummm. Correct me if im wrong but wouldent this work better:

* Start of Frame
- Start Loop "spread 1" NObjects "Object 1"
- Start Loop "spread 2" NObjects "Object 2"

* On loop "spread 1"
- Spread value 0 in alterable value A of "Object 1"

* On loop "spread 2"
- Spread value 0 in alterable value A of "Object 2"

Image Edited by the Author.

 
Phizzy is God. Mod him.

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
6th November, 2006 at 05:21:36 -

It would work faster, but what if you duplicate an object on runtime? You'd have to make more code...

 
Old member (~2004-2007).

Arneckian



Registered
  17/01/2005
Points
  984
6th November, 2006 at 05:27:31 -

* Condition
- Create "Object 1" at (x,y)
- Start Loop "spread 1" 1 Time(s)

...?

Image Edited by the Author.

 
Phizzy is God. Mod him.

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
6th November, 2006 at 08:01:55 -

Spread Value is awesome.

It basically assigns an ID number to all objects matching the conditions of the event. If you do:

ALWAYS
- Spread 1 in A

The 'ALWAYS' condition selects all objects (since you didn't mention any objects specifically). The spread then enumerates all objects.

However, doing this:

X POS of object > 320
- Spread 1 in A

...will select only the objects whose X position is greater than 320. The spread will then only enumerate those objects. Others are left at whatever value they had before.

So you can also use it to loop through objects that meet certain conditions, and follow those objects even after those conditions no longer run true.

 
191 / 9999 * 7 + 191 * 7

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
6th November, 2006 at 09:35:27 -

No wait, what are you on about Tyscorp? Why would you run a fastloop to spread a value, when the action already applies to all instances of the object when you run it once?

Image Edited by the Author.

 
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
6th November, 2006 at 10:17:06 -

Tyscorp is confused... why would you loop it? Spread 0 in value A in object, will do it for all the objects... looping will just do that repeatedly, which is stupid.

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
6th November, 2006 at 16:07:29 -

No, his code makes it spread the value through all available objects, only way faster. You'd have to code more to make sure it works on any new instances of the object too, though... Which means at every condition that makes one.

Image Edited by the Author.

 
Old member (~2004-2007).

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
6th November, 2006 at 17:31:59 -

Maybe I'm having a dense moment and just not seeing this, but how is it faster?

So far as I know, the Always: Spread command will ennumerate every instance of that object within one event. By the time the first frame is drawn, all your objects will be numbered.

You can see this by doing a fastloop, but telling it to run only once, like this:

Start Of Frame
... Run loop 'SPREAD' 1 time

On Loop 'SPREAD'
... Spread 1 in Value A


The loop occurs only once, yet every object is Numbered. This is because MMF is automatically fastlooping through all the objects, it doesn't need to be told.

That said, using fastloop in the above way to trigger a Spread command is better, since it saves on having pointless 'ALWAYS' commands. There's no point spreading the values again if nothing has changed. You just trigger the loop to run once when an object is created or destroyed, and once at the start.



 
191 / 9999 * 7 + 191 * 7

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
6th November, 2006 at 17:33:22 -

Um, what? You really think using a fastloop, and three extra lines of code, would make it faster? And all that's required to make it work for new objects is to replace start of frame with always.

J00 SILLY.

 
n/a

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
6th November, 2006 at 18:01:03 -

I'm against using Always for spreading, simply because the event fires all the time.


If you imagine having 150 objects and one detector for each (300 objects in total), the Always condition will force MMF to ennumerate 300 objects.

That's fair enough, but on the next frame, it'll do it all over again. And again. And again. And again.

After just 1 second of game time, MMF has numbered the same 300 objects 50 times. That's basically numbering 15,000 objects a second.

If you trigger the spread using just one beat of a fastloop, executed when necessary, the amount of work MMF is doing will be greatly reduced.

 
191 / 9999 * 7 + 191 * 7

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
6th November, 2006 at 18:26:30 -

- Always
+ value of (object) < (amount of objects)
= spread value 1 in (object)

 
Old member (~2004-2007).

Werbad



Registered
  18/09/2002
Points
  235
7th November, 2006 at 02:31:37 -

First of all, it is never nessicary to add an Always + another event... Second of all, that event will fire all the time anyway since there always will be objects with a value lower than the number of objects (Unless there only is one objects ofcource)

 
n/a

-Nick-

Possibly Insane

Registered
  24/11/2002
Points
  2468

VIP Member
7th November, 2006 at 07:16:57 -

Going a little off topic, but since we're discussing 'always', what is the use for 'never'. I genuinly cannot see where i would use it, because it stops an event running? Sorry if i'm being stupid .

 
Project: Roller Coaster is on it's way!
http://www.projectrollercoaster.co.uk/
http://www.craftsncreatures.com

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
7th November, 2006 at 07:36:06 -

Heehee, gotta love your avatar Noober!

As for NEVER, I think it's used to test events. If you have a bug in your game, and you don't know where it is, you can just keep shoving 'never' conditions into various events to stop them working. If the bug goes away, you know the error is being caused by that event.

It's better than deleting events, since you don't lose all your actions. Although personally, I just create a group, deactivate it, and shove the event inside that. I wish you could just tick a box next to event lines to disable them instead of bothering with 'never'.

EDIT: LOL, Phizzy beat me to it!

Image Edited by the Author.

 
191 / 9999 * 7 + 191 * 7

-Nick-

Possibly Insane

Registered
  24/11/2002
Points
  2468

VIP Member
7th November, 2006 at 07:48:22 -

Ah, i never actually thought of that. I usually just drag all the events into a disabled group, which is a little faster anyway.

 
Project: Roller Coaster is on it's way!
http://www.projectrollercoaster.co.uk/
http://www.craftsncreatures.com

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
7th November, 2006 at 09:31:40 -

Sorry about my earlier post Dines, you posted while I was typing my reply. It was actually aimed at DaVince.

And yer doing it wrong DaVince! There's no need for any fastloops, no need for always conditions in conjunction with other conditions, and using fastloops won't make it faster. To spread a value in all instances of an object, even new ones, just use:

* Always
- Spread value 0 in "Active"

'Kay?

 
n/a

Deleted User
7th November, 2006 at 09:37:27 -

http://en.wikipedia.org/wiki/18th_century

 

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
7th November, 2006 at 09:40:30 -

I never used any fastloops?

 
Old member (~2004-2007).

Deleted User
7th November, 2006 at 09:46:35 -

I found another site of interest:
http://en.wikipedia.org/wiki/Den_Haag

 

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
7th November, 2006 at 11:50:41 -

DaVince: No, but Tyscorp used fastloops, and you said his code was more efficient

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
7th November, 2006 at 15:22:51 -

I said it was FASTER at the start of the level, if used correctly. Not that it gives much of an advantage, though.

 
Old member (~2004-2007).

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
7th November, 2006 at 15:51:59 -

...which is the bit I don't get, cos I don't see how it possibly could be faster

 
191 / 9999 * 7 + 191 * 7

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
7th November, 2006 at 16:08:36 -

Ever seen that demo with around 1000 stars being put on screen one by one with an "always" loop and a fast loop? The fast loop places them almost immediately where the always event takes around two seconds to do it. That's what I meant with it goes faster.

 
Old member (~2004-2007).

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
7th November, 2006 at 16:23:42 -

The reason for that is that Always is creating one star per frame, whereas Fastloop can do hundreds of stars per frame.

The difference with Spread Value is that it already fastloops within the Spread Value function. It'll do this if it's triggered from Always, a Fastloop, or even a single 'Start of Frame' condition.

You can test it by doing a 'Space key is pressed' condition and spreading a value with that. Even though the event triggers once, it'll ennumerate all objects.

 
191 / 9999 * 7 + 191 * 7

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
7th November, 2006 at 16:37:17 -

You f00l, DaVince

Just open up MMF and try it. You don't need fastloop, it does it automatically! That's what we've been trying to tell you all along

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
7th November, 2006 at 17:24:29 -

Ah k. Well, if you have that experience, I guess I'll have to take your word for it, then.

Nothing to do with fools, I thought you didn't quite get what I meant.

 
Old member (~2004-2007).
   

Post Reply



 



Advertisement

Worth A Click