Library Update

Do you want to contribute to improving ZGameEditor? Check out the list of open activities and find out where you may be able to help!

Moderator: Moderators

User avatar
diki
Posts: 140
Joined: Thu Sep 11, 2008 7:53 pm
Location: GMT+1
Contact:

Library Update

Post by diki »

hi,
i recently remembered that zge sports a library from which you can add useful templates. it currently contains a number of awesome meshes & two bitmaps; i was thinking about adding more things from the 'tips & tricks' section of the board (and already started doing so), especially reoccuring things like input handling.
i just wanted to hear back if all involved parties think that is a good idea (maybe nobody uses the library anyway, or people don't want their tricks in there...). what do you think?
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

Well, I read tips & tricks, and I'm sure there is some very valuable info. in there, but...

//comment lines are amazingly sparse, so that's something to consider.

I love comment lines. I write paragraphs in ZExpressions, just so when I look at it a year from now, I'm up to speed in one read.
User avatar
VilleK
Site Admin
Posts: 2318
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

It's a great idea to fill the library with more useful items. I've been meaning to create a thread like this one to collect more suggestions what to include. Please post your ideas here so that we can update the standard library for next release, thanks!
User avatar
VilleK
Site Admin
Posts: 2318
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I'm updating the Library with some external libraries. So far I've got bass, opengl and dikis Box2d. If you make a mapping to a dll then please post it here for inclusion in the library.
User avatar
diki
Posts: 140
Joined: Thu Sep 11, 2008 7:53 pm
Location: GMT+1
Contact:

Post by diki »

i just filled the library with tips n' tricks only to discover that ZGE does not like duplicate names in the library. could ZGE be made to ignore double names inside the library - for the sake of readability?
User avatar
diki
Posts: 140
Joined: Thu Sep 11, 2008 7:53 pm
Location: GMT+1
Contact:

Post by diki »

attached is the library ... i resolved the double names, but for some reason some of the examples don't run - they mostly claim that some array is not an array, although it clearly is. appears to be a naming problem; ZGE also bugs out hard when trying to rename the array in question :P
Attachments
Library.zip
(21.24 KiB) Downloaded 1460 times
User avatar
VilleK
Site Admin
Posts: 2318
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Good work compiling this diki! I'll see what I can do to fix the problems.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

BASSMOD.dll

Post by jph_wacheski »

I hacked your setup for bass.dll to work with BASSMOD.dll [ http://www.un4seen.com/bassmod.html ] it is a subset of the sound functions, so only mod playing and it is 1/3 smaller at 33kb. Only had to change the function names and amend some parameters.
I am interested in getting data out of the dll from the playing mod, however I am a bit confused by these things,. DWORD, HIWORD, LOWWORD,. . I get that it is just a way to store a couple values packed into a larger one,. it is just the way to access them, and use them, that is confusing. Anyone like to try a simple explination/crib sheet for me??
Parameters
chanins The channel or instrument to retrieve the volume of... if the HIWORD is 0, then the LOWORD is a channel number (0 = 1st channel), else the LOWORD is an instrument number (0 = 1st instument).
so how would I set HIWORD=0 and LOWORD=3, and HIWORD=1 and LOWORD=2 say?

Also, when getting values back as int you use these lines;
int left=level >> 16; // this is a Binary Shift but why?
int right=level & 0xffff; // and this is a Binary AND also why?

Rbeams1.Length = (left/32768.0) * 20; // why these values?
Many thanks in advance for any help.

I see Kjell posted a similar tip here; viewtopic.php?p=3403#3403
interesting
Attachments
BASSMOD_test2.zgeproj
.zgeproj setup for BASSMOD.dll
(1.98 KiB) Downloaded 1351 times
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2318
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Aha, I did not know about that trimmed down version of the dll. Looks good, and it should work for Mac/Linux as well.

When two 16-bit values are packed in a 32-bit value you need bit-shifting to split the value:

int hiword=level >> 16;
int loword=level & 0xffff;

When you shift the value 16 bits to the right then the lowest 16 bits are removed.

The AND-operation makes it only keep the lowest 16 bits. If you've wanted to keep the high bits you would have used 0xffff0000 instead.

To pack them back together to a 32-bit value you do this (untested):

level = (hiword << 16) | loword;

It takes some time to get used to bit-shifting but it is really useful sometimes :)

http://en.wikipedia.org/wiki/Bitwise_operation
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

@jph

GLSL supports bit-shifting as well, but to keep things easier to read for novice users, I only use "normal" operations ( like * and / ) in examples. But when you know what you're doing you'd write "<<16" instead of "*65536" and ">>8" instead of "/256" obviously :wink:

+ Not exactly sure why you posted this here though .. this thread is about the Library, not ZExternalLibrary ( neither ZLibrary ). But I can understand the confusion ( Library = Resources, ZLibrary = Functions, ZExternalLibrary = Extensions ) :)

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

I'm updating the Library with some external libraries. So far I've got bass, opengl and dikis Box2d. If you make a mapping to a dll then please post it here for inclusion in the library.
the BASSMOD.dll mapping may be usefull to ppl that just want mod playback in games,. . although I still want to figure out how to get some level/pattern info back out,. for game event triggering. I also noticed when looking at the docs for the dlls that bass.dll has many more sound functions, realtime effects, streaming audio, and 3d sound,. cool.

My question should probably have been posted in a new tread through.
iterationGAMES.com
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Oops,

Missed that remark from Ville :oops:

One question ; Will dll's be copied to your project folder automatically when you add a ZExternalLibrary from the Library? Or will you have to copy from your ZGE installation / download yourself?

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

I just put the .dll in the folder I'm saving my .proj and generating my .exe in. i.e. I do not use the main zge folder for that stuff,. so I would just drag them to the distribution zip. However you make a good point; with GameMaker there is a mechanism to 'include files' and any files added to that list are self extracted by the exe when you run it,. (and destroyed after, or not, as an option if i recall?) wunder if one of our compresion options could have an include external files setting?? Would give a nice single file distribution,. although, having a few files with an .exe in folder is not a bad setup, and very common anyway.
iterationGAMES.com
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:)

That's not what I meant .. but what you mention is another thing to consider indeed. Perhaps it is possible to include a dll using the File Component, and simply deploy the dll when it has not been found .. haven't tried this though.

Anyway, what I meant was that when you're using ZGE, and you add a ZExternalLibrary using the "Add From Library" option, the functions you've just added won't work unless you have the required dll in your project folder ( or installed on your system ).

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Ah yes, I see what you are on about. I almost forgot we get access to all the dlls in the system too,. . I will have to have a look at what is in the standard xp setup,. . Ha! there are only >1500 dll files in my win32 folder,. lol. Guess I will never know what they all do. opengl32.dll has 368 functions,. . fun fun.
iterationGAMES.com
Post Reply