Page 1 of 4 1 2 3 4 >
Topic Options
#114615 - 10/28/08 03:58 PM Snippet Manager
MuddyMole


Registered: 07/14/08
Posts: 53
I'm posting this here because it got quite a good reception at the Daily Click, and it was suggested to me that people here might like it also.

It's is a little app I've made to help organize and edit snippets - small, reusable pieces of code you use in games.

For example; It includes a snippet to find the angle between two objects. All you need do, is enter the names of the objects, as they appear in MMF, and it generates the code, ready to copy and paste straight in.

I've included quite a lot of pre-made snippets, and made it very easy to add your own. Hopefully people will use this, and share their snippets with other clickers.

I'm considering an add-on pack, so if anyone can think of some useful snippet ideas, please let me know.


Attachments
Snippet Manager.zip (162 downloads)


Top
#114622 - 10/28/08 04:19 PM Re: Snippet Manager [Re: MuddyMole]
dragonguy


Registered: 04/03/08
Posts: 1836
Loc: england
This is a great resource, can you include my cloaking device as a snippet?
_________________________
I'm the Orignal Dragonguy!
Maltar Draco

I like Games!

Liji isn't good with pets

Top
#114626 - 10/28/08 04:27 PM Re: Snippet Manager [Re: dragonguy]
wizkidweb


Registered: 01/06/07
Posts: 447
Loc: USA
I don't think that can be added as a snippet because it involves multiple events.

But I may be wrong.
_________________________
When you do things right, people won't be sure you've done anything at all.
- God (Futurama)

Top
#114627 - 10/28/08 04:28 PM Re: Snippet Manager [Re: dragonguy]
Nickydude


Registered: 03/24/07
Posts: 253
Loc: I'm right here!!
This is a great idea! As a beginner to DBP, I'll certainly find this useful.
_________________________
~MMF2 User Latest Build~
Winner of the MMF2 Developer Book!
All the best,
Nickydude

Top
#114629 - 10/28/08 04:51 PM Re: Snippet Manager [Re: Nickydude]
MuddyMole


Registered: 07/14/08
Posts: 53
Dragonguy: sorry, but wizkidweb is right. That's not really how it works.

I've had to fix a small bug.

The latest and all future updates can be downloaded here:
http://www.create-games.com/download.asp?id=7421


Edited by MuddyMole (10/28/08 05:29 PM)

Top
#114645 - 10/28/08 07:33 PM Re: Snippet Manager [Re: MuddyMole]
dragonguy


Registered: 04/03/08
Posts: 1836
Loc: england
Originally Posted By: The Daily Click
It makes it much quicker and easier to create complicated expressions such as for the distance/angle between two objects.
Expressions eh?
How about this then?
I have trouble remembering that one.
_________________________
I'm the Orignal Dragonguy!
Maltar Draco

I like Games!

Liji isn't good with pets

Top
#114665 - 10/29/08 07:45 AM Re: Snippet Manager [Re: dragonguy]
MuddyMole


Registered: 07/14/08
Posts: 53
Yes, I should be able to add that.
There'd be a few possible options on how to do it though.

Are objectx/y/z three alterable values that every object has?
If so, it could be made so you, the user, enter the name of the object, and the letter of the alterable value which holds each of these. If they're going to be stored in counters or something, then it would be more complicated.

I'm assuming camerax/y/z a the same for all objects, so more likely to be held in a counter or something.

Top
#114676 - 10/29/08 09:29 AM Re: Snippet Manager [Re: MuddyMole]
dragonguy


Registered: 04/03/08
Posts: 1836
Loc: england
Originally Posted By: MuddyMole
Are objectx/y/z three alterable values that every object has?
Yes each invidual non-camera active object has these alterable values.
Originally Posted By: MuddyMole
I'm assuming camerax/y/z a the same for all objects, so more likely to be held in a counter or something.
You assume correctly, camera x/y/z is the position of the camera if 3rd person or the position of the player if 1st person so they may be counters or alterbale values of the player/camera object.
_________________________
I'm the Orignal Dragonguy!
Maltar Draco

I like Games!

Liji isn't good with pets

Top
#114692 - 10/29/08 11:33 AM Re: Snippet Manager [Re: dragonguy]
Nifflas


Registered: 06/30/06
Posts: 1523
How did I miss this? This program is genius, it will come in extremely handy! Here's my suggestion for an addition, I often use this expression for particle instability:

Filename: Number in range relative to center.ini
[Details]
Description=This generates a random number within a range relative to a center value.
[Function]
String=>Center<+Random(>Range<*2+1)->Range<
Variable1= >Center<
Variable2= >Range<


Edited by Nifflas (10/29/08 11:53 AM)

Top
#114695 - 10/29/08 12:06 PM Re: Snippet Manager [Re: Nifflas]
MuddyMole


Registered: 07/14/08
Posts: 53
Thanks a lot Nifflas. I shall definitely add that if you don't mind. I'm very glad to see you've grasped how it works and how to make your own snippets.

For now, I'll put your credit in the description. It occurs to me that there should probably be an "author" item in the details group. I'll have to add that later though.

Dragonguy - I am working on yours. Shouldn't take too long.

Top
#114698 - 10/29/08 12:22 PM Re: Snippet Manager [Re: MuddyMole]
Alonso


Registered: 07/02/06
Posts: 314
This took my breath away. Very useful, good, little tool.
_________________________
http://www.hfalicia.com

Top
#114700 - 10/29/08 12:49 PM Re: Snippet Manager [Re: MuddyMole]
Nifflas


Registered: 06/30/06
Posts: 1523
To Clickteam Staff: I strongly suggest to add Snippet Manager to the Community Links!


Edited by Nifflas (10/29/08 12:50 PM)

Top
#114706 - 10/29/08 01:24 PM Re: Snippet Manager [Re: Nifflas]
MuddyMole


Registered: 07/14/08
Posts: 53
Thanks, I'm flattered

Anyone hasn't downloaded it yet and wants to, the latest version is here:
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Snippet%20Manager.zip

Anyone who has already downloaded the app, but wants the latest snippets, the download is here:
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Snippets.zip

Dragonguy: I'd really appreciate it if you could take a look at those 3D Engine snippets - see if they work first of all, and if not maybe you could help me understand why. I will also need to write an extra readme to tell people how to use them...

I've also added some snippets to calculate X and Y array coordinates from a fastloop index. This should hopefully make it really easy to load maps etc stored in arrays using fastloops. That was inspired by Pixelthief.

Top
#114711 - 10/29/08 02:02 PM Re: Snippet Manager [Re: MuddyMole]
lincore


Registered: 10/15/08
Posts: 25
Loc: Germany
this is great, thanks muddymole. the only thing that could make the tool even greater would be an online database where users can upload, download and rate snippets...

yeah, that would be great...
lincore
_________________________
hm... . o O (xkcd?)

Top
#114712 - 10/29/08 02:10 PM Re: Snippet Manager [Re: MuddyMole]
dragonguy


Registered: 04/03/08
Posts: 1836
Loc: england
I found theres a few slight errors in your 3D Engine Math (I compared your Math to the working Math in the 3D Engine of my 3D Game), you had X Position Relative to Camera & Z Position Relative to Camera the exact wrong way round, it should be.

X Position Relative to Camera.
Code:
Cos(0->Camera Angle<)*(Alterable Value >Z Position Value<( ">Object<" )->Camera Z<) -
Sin(0->Camera Angle<)*(Alterable Value >X Position Value<( ">Object<" )->Camera X<)
Z Position Relative to Camera.
Code:
Cos(0->Camera Angle<)*(Alterable Value >X Position Value<( ">Object<" )->Camera X<) +
Sin(0->Camera Angle<)*(Alterable Value >Z Position Value<( ">Object<" )->Camera Z<)
Every other peice of Math you put in the 3D Engine Folder is 100% correct.

Also- Iv'e figured out how your INI's work so I can now create new Math Snippets.


Edited by dragonguy (10/29/08 02:16 PM)
_________________________
I'm the Orignal Dragonguy!
Maltar Draco

I like Games!

Liji isn't good with pets

Top
#114717 - 10/29/08 02:29 PM Re: Snippet Manager [Re: dragonguy]
Jeff


Registered: 06/28/06
Posts: 4574
Loc: Oregon
I have put it up as a sticky for now and see how it progresses.
_________________________
Flyin V Interactive


Top
#114720 - 10/29/08 02:34 PM Re: Snippet Manager [Re: Jeff]
dragonguy


Registered: 04/03/08
Posts: 1836
Loc: england
I have already created an update for the 3D Engine Snippet & I have built a new Snippet which allows you to click & drag a box like in your favourite RTS Games.

More Snippets to come from me.


Attachments
Dragonguy's Snippets.zip (37 downloads)



Edited by dragonguy (10/29/08 02:40 PM)
_________________________
I'm the Orignal Dragonguy!
Maltar Draco

I like Games!

Liji isn't good with pets

Top
#114725 - 10/29/08 02:42 PM Re: Snippet Manager [Re: dragonguy]
MuddyMole


Registered: 07/14/08
Posts: 53
Dragonguy: Thanks very much. I really appreciate that

The other thing I thought of, is do you actually need all of those?
I'm sure it's not too tricky to merge a couple of them, so all you have are snippets to calculate ScreenX, ScreenY, RelativeZ, and Scale without the "in-between" steps.

lincore: I thought about that, or atleast I thought about making it automatically download my latest snippets. To be honest though, I don't know much about doing online stuff in MMF. Perhaps if I can get some help I'll add that in the next version.

I've thought of a few other modifications I'd like to make, such as tooltips to tell the user what each variable does, aswell as the option to link to a help file for each group of snippets - some complicated ones such as Dragonguys, really need their own detailed help or people won't understand how to use them.

EDIT: I see you just posted while I was typing - I'll take a look at those. thanks again


Edited by MuddyMole (10/29/08 02:43 PM)

Top
#114726 - 10/29/08 02:45 PM Re: Snippet Manager [Re: MuddyMole]
dragonguy


Registered: 04/03/08
Posts: 1836
Loc: england
Well yes they can be difficult to use, I will include a tutorial for each of my snippets in the next release of Dragonguy's Snippets.
_________________________
I'm the Orignal Dragonguy!
Maltar Draco

I like Games!

Liji isn't good with pets

Top
#114767 - 10/29/08 06:20 PM Re: Snippet Manager [Re: dragonguy]
Nifflas


Registered: 06/30/06
Posts: 1523
Some criticism though. Skip the whole deal about duplicate snippets for objects and values, it only makes simple things more complicated. If I want to use the X position of an active object as a value, I'd simply insert X( "Active" ) as the value.

This also makes it harder to update snippets when an easier expression is found. I've already found a rather huge mistake. For example:

Between Two Objects - Euclidean (normal) uses the nice and simple expression:
Sqr((>X Point 1<->X Point 2<) pow 2+(>Y Point 1<->Y Point 2<) pow 2)

while Between Two Points - Euclidean (normal) uses the bloated expression:
Sqr( ((>X Point 1<->X Point 2<)*(>X Point 1<->X Point 2<))+((>Y Point 1<->Y Point 2<)*(>Y Point 1<->Y Point 2<)) )

In addition to the mistake about having a poorly written expression in the list, don't you spot another? The first one uses values too, while other distance related "Object" snippets reffers to X(">Object 1<") etc. I noticed that this mistake occured in at least one other snippet, so be sure to validate them all again.

Having separate snippets for objects and values fails at many points.

* People might forget to update the math in both of a twin object/value snippet.
* People might forget to use values in Value snippets and objects in Object snippets.
* It's hard to teach people who write snippets what the difference is, and to not make the mistake in the two points I made above. They have already been made after all, and my experience tells me that a lot of people are not careful enough to keep an eye open for these things.
* The ease of use. It's easier to remember a smaller list of snippets, nobody wants to have duplicates of everything (it clutters the list), and everyone who even only knows the basics of how expressions works should understand they can use anything as values, including positions and alterable values of objects.

Although I guess twin snippets for object/value can have it's upsides, the downsides outweight them by far. The only reasonable soliution is if twin object/value snippets can be integrated into a single snippet with a object/value selector. Having the object/value variations as two lines of text next to each other should make it a whole lot easier to keep them in sync.

Edit:
Looks like I had forgot to get the latest version of the snippets, but as I did, I spotted that the issue with the distance snippet which used values instead of objects was fixed. However, in this case, the maths was replaced by the ones in the bloated expression which used too much parenthesis and didn't take advantage of "pow 2". Even the fix was a fail. This is why I really think the system must change. Oh, and "Between Two Points - Approximation.ini" is still wrong.

Despite my criticism, don't forget the "this is an awesome piece of software" aspect in all this.


Edited by Nifflas (10/29/08 07:16 PM)

Top
#114785 - 10/29/08 07:24 PM Re: Snippet Manager [Re: Nifflas]
Nifflas


Registered: 06/30/06
Posts: 1523
Small things, does the drag box Y and X scale/position stuff really need different snippets for X/Y? It could just be called Scale/Position, the math is identical except the X/Y letters. In addition, the snippet assumes that you don't name your alterable values (see: Alterable Value >Relative Y Origin Value<), that's like encouraging to not comment your code.

Oh, and although I agree that it was dragonguy who created the snippets, I'd like to claim that I had a little to do with them too (link), although I don't want credits for it.

Oh, and the Doom expression is my creation as well, although it was originally made as a joke: Abs(360*Min(Max(Y( "Point A" )-Y( "Point B" )+1, 0), 1)-(ASin((X( "Point B" )-X( "Point A" ))/Sqr((X( "Point A" )-X( "Point B" )) pow 2+((Y( "Point A" ))-Y( "Point B" )) pow 2))+270))

Worth to mention is that it is only guaranteed to work with integers. Float Y values between 0 and 1 generates invalid angles (it can happen if you're not dealing with object positions).


Edited by Nifflas (10/29/08 07:33 PM)

Top
#114786 - 10/29/08 07:34 PM Re: Snippet Manager [Re: Nifflas]
MuddyMole


Registered: 07/14/08
Posts: 53
Ok, thanks for the suggestions.

I can see that it would have been easier to use the "pow" function in that expression. I'll make the changes.

I'm a bit confused though.
I don't understand what you mean about the other mistake. If it says >Object< or >Object 1< or anything like that, then it wants you to enter just an object name. If it says something else, then it wants you to enter a value. You wrote that first expression as an example right, cos mine does use object names?
I don't want to sound argumentative, but I just don't get what you're saying.

Obviously it's less work for me to not have duplicates for object names and values, but it means more effort for the user.

Take the distance example you mentioned. By using the "object" version, the user only has to enter two variables - the objects' names. If they are forced to use the "point" version they have to enter 4 different variables, all of which are more complicated than just a name.

Can I just check - you are entering the values in the boxes in the Snippet Manager, before you copy the expression to MMF aren't you?

The next version I make will also have tooltips for each variable, to explain to the user exactly what they do and the type of thing they have to enter. Hopefully that would help prevent making the mistakes you mentioned.

I agree that it looks a bit clumsy when you have something like "Alterable Value >Angle<(">Object<")" but it makes it easier to use because the user doesn't have to retrieve any values - everything they need to enter is really simple.

Still, I will bear your comments in mind. If you have any suggestions on how to improve the actual app itself I'd like to hear those too.

Top
#114788 - 10/29/08 07:42 PM Re: Snippet Manager [Re: MuddyMole]
MuddyMole


Registered: 07/14/08
Posts: 53
Again, you've posted while I was typing!

I didn't know any of that about those Drag Box snippets. Like you say, it wasn't me who made them. My apologies for not crediting you with the "doom" expression. I'll rectify that too.

I get what you're saying about the alterable values, and I thought about it myself. It's just that I don't want the user to have to be using "retrieve from object..." all the time - that pretty much defeats the purpose of the app.

Top
#114789 - 10/29/08 07:43 PM Re: Snippet Manager [Re: MuddyMole]
Nifflas


Registered: 06/30/06
Posts: 1523
You completely misunderstood me about the other problem. It has nothing to do with usage (I understand how it's used), in fact, the other mistake I mentioned is when the snippet creator confuses point snippets with object snippets. In an earlier version, the problem was this:

Between Two Objects - Euclidean (normal).ini
Sqr((>X Point 1<->X Point 2<) pow 2+(>Y Point 1<->Y Point 2<) pow 2)

...and in the process of fixing that, the one with good maths was replaced by the one with bloated maths, so that's how a fix became a fail.

What I suggest is an improvement of the app. Integrate object and value twins into a more advanced single-snippet file with multiple modes for each. That provides a better overview and prevents further mistakes of the kind I've already seen. Since mistakes have already happened at this early stage, I'd doubt it will get easier to manage when more third parties are involved in snippet creation. Only having them in a single file will provide an overview obvious enough for all users to handle. We're talking about a community where 90% of the programmers doesn't even comment code they upload as examples for other people to learn from. Things needs to be carefully organized here.

Quote:
I agree that it looks a bit clumsy when you have something like "Alterable Value >Angle<(">Object<")" but it makes it easier to use because the user doesn't have to retrieve any values - everything they need to enter is really simple.

I can not see that really. Even back in the MMF1 days, I always named alterable values before I started to use them. The snippet only really works for programmers who's not organized enough to do that.

Quote:
If it says >Object< or >Object 1< or anything like that, then it wants you to enter just an object name.

That would be true if people remembered to use the terms correctly. However:

Between Two Points - Approximation.ini
((Max(Abs((>X Object 1< - >X Object 2<)), Abs((>Y Object 1< - >Y Object 2<)))) * 0.941246) + ((Min(Abs((>X Object 1< - >X Object 2<) ), Abs((>Y Object 1< - >Y Object 2<)))) * 0.41)

Here, >Object< does obviously not symbolize actual object names. I'd have expected >Point<.


Edited by Nifflas (10/29/08 08:33 PM)

Top
#114793 - 10/29/08 08:09 PM Re: Snippet Manager [Re: Nifflas]
MuddyMole


Registered: 07/14/08
Posts: 53
I see. You'd prefer it to say ">X Point 1<" rather than ">X Object 1<".

Yes, it's usually good to rename alterable values. Here's the problem though...
Take the 360 degree movement expression as an example. The user is having to use MMFs "retrieve data from object" 3 times. The only thing left to add is a "Cos" here or a "*" there. Why bother using a snippet?
Maybe the whole concept of snippets *is* flawed - perhaps we're just better off with a long text file full of expressions, that you just open up in notepad and press "search".

In my own opinion though, I'd rather just enter a name and a couple of letters, even if it means not having the luxury of renameable alterable values.

Top
#114794 - 10/29/08 08:14 PM Re: Snippet Manager [Re: MuddyMole]
Nifflas


Registered: 06/30/06
Posts: 1523
No, my idea is that if the app features single-snippets with both object and value modes that you can toggle between, you can just select the snippet, chose "object mode" and insert the object name, and get the entire output to paste. I'm talking about a snippet format that would look something like this:

Between Two Points - Manhattan.ini
[Details]
Description=This calculates the Manhattan distance between two objects or points. That is, the distance covered when allowed to move only horizontally or vertically.
[Mode 1]
Mode Name=Objects
String=Max(Abs(X( ">Object 1<" )-X( ">Object 2<" )), Abs(Y( ">Object 1<" )-Y( ">Object 2<" )))
Variable1= >Object 1<
Variable2= >Object 2<
[Mode 2]
Mode Name=Points
String=Max(Abs(>X Point 1<->X Point 2<), Abs(>Y Point 1<->Y Point 2<))
Variable1= >X Point 1<
Variable2= >Y Point 1<
Variable3= >X Point 2<
Variable4= >Y Point 2<

If a snippet only features one mode, the text fields the other mode uses can simply be hidden.

That kind of overview doesn't leave much room for mistakes, does it? Seeing it all at the same time will make it hard for the creator to confuse objects with points (have happened two times), and to have different maths for object/points mode (have happened one time), or replacing the effectivent formula with an ineffectivent one (which have also happened one time).

Anyways, unless there's any further misunderstandings, I've pointed out what I think, I won't bug you any further about it. The reason I suggest this is only because I think the Snippet Manager is so good that it would be best if everything was perfect. As a bribe, I'll send you a paypal donation if you add this feature


Edited by Nifflas (10/29/08 08:35 PM)

Top
#114799 - 10/29/08 08:31 PM Re: Snippet Manager [Re: Nifflas]
MuddyMole


Registered: 07/14/08
Posts: 53
Now I get it...

Yes, that's a very good idea.
It seemed before like you had something much more complicated in mind, but I'm sure that was just me being confused again.
That actualy looks very do-able.

Sorry if it seemed like you were talking to a brickwall. I've just had a hardtime understanding - in my defense it is 1am and I'm tired

Top
#114800 - 10/29/08 08:34 PM Re: Snippet Manager [Re: MuddyMole]
Nifflas


Registered: 06/30/06
Posts: 1523
Don't worry As promised, if you add it, I'll send money by paypal (not that much, but something around $50). Also, don't take it personal that I may sound a bit more harsh than I intended when I debate things at 2am

Quote:
In my own opinion though, I'd rather just enter a name and a couple of letters, even if it means not having the luxury of renameable alterable values.

I just came up with a great solution to that, so now I'll bug you one more time despite that I said I wouldn't.

After all, you do normally remember what you name your values, right? How about: >Name of Alterable Value<(">Object<")? If you add the possibility to fields to have default content, the >Name of Alterable Value< field could have the default string "Alterable Value ?" - all the user would have to do is to either replace the ? with the letter of the alterable value OR erase the default string and write the custom name of the desired value. That works for both users who name their values, and users who doesn't.


Edited by Nifflas (10/29/08 09:02 PM)

Top
#114829 - 10/30/08 12:38 AM Re: Snippet Manager [Re: Nifflas]
Dynamite


Registered: 02/05/07
Posts: 1418
Loc: Sydney, Australia
You should use the download object to automatically download the latest version

This is AMAZING!
_________________________
Hola, if you need someone to create anything with art:
-Sprites
-Cut scenes
-Logos

Then tell me and I'll see what I can do!

Top
#114832 - 10/30/08 12:55 AM Re: Snippet Manager [Re: Dynamite]
DarkeSoft


Registered: 07/23/07
Posts: 763
Loc: Hythe,AB
As I said in Gwerdy earlier today....
MMF needs the ability to recognize named variables. That is, you name AltValA "grav", and while in the expression editor you type Alterable value A( "Active" ) instead of grav( "active" ), as soon as you hit ok it will continue and rename AltValA to grav in the expression. This would stop the problem here with the snippets as Nifflas noted.

Top
#114847 - 10/30/08 05:36 AM Re: Snippet Manager [Re: DarkeSoft]
Atom


Registered: 08/30/06
Posts: 296
Just wanted to jump in and say this looks like it will be very helpful, looking forward to how this project evolves in the future, thanks

Top
Page 1 of 4 1 2 3 4 >


Site Links
Forum Index

Home Page
Online Store
Tutorials
Download Center
French Forum
Quick File Links
Multimedia Fusion 2
Updates - build 248
Standard Version
Developer Version

Extension Packs
Bonus Pack 1
Bonus Pack 2
z33z Extension Pack
LIJI Extension Pack

The Games Factory 2
Latest Update - build 248
Community Links
Madword Arcade

GameBuilder
Fusion2Developers
The Daily Click

Extensions
Neatwares Extension List
Extension Updater (FusionUpdater)
Zoom Gamer
Click Chat
6 People are chatting