Beta release 3.1b

Information and change log about the latest ZGameEditor release.

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Rado1,
Rado1 wrote:Kjell, this is a good example of incorrect naming.
That's why i chose it as example ;)
Rado1 wrote:Learned from good practices of OO languages, I rather prefer to use upper camel case for types and lower camel case for local variables.
Same here ( in C++ at least ), but in ZGE i follow the conventions that Ville set / uses in the examples & tutorials.
Rado1 wrote:Anyway, I agree with Kjell that having names for types as "model" and "Camera" is not consistent. I would prefer to have "Model". Also because ZGE uses upper camel case for all component types in project tree and Add Component dialog. Of course, renaming the "model" type in expressions to "Model" would be backward incompatible.
My primary complaint is that it's not consistent. So renaming the "model" keyword to "Model" would be the other solution. Either way is a improvement.

K
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Yes, I agree "model" and "Model" is not consistent. The first came up because we needed a built-in type to deal with models and I choose lower-case because the other types ("int" etc) were that too.

Then I needed "component reference types", i.e. types that could hold references to components in the project tree. At that point it made more sense to use the same casing as the component names. So "Model", "Camera" etc. I wonder which is the best way to clean this up without breaking backwards compatibility too much.


Anyway, here is an experimental build using the OGG-library from Benjamin "BeRo" Rosseaux.

You can now import OGG-files using the SampleImport plugin. Previously it could only import RAW files.

The benefit of loading OGG files like this is:
- no need for external ogg-library
- you can use sample expressions to modify the ogg audio
- it uses the internal audio engine so you can use play back ogg at different pitches, delay, master volume etc.

I'm sure there are problems with it, I haven't tested it much. Let me know if you think this is a useful feature. If not I'll just remove it again :)

http://www.zgameeditor.org/files/ZGameEditor_beta.zip
Attachments
OggExample.zgeproj
example project
(560.76 KiB) Downloaded 386 times
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion »

Awesome addition!

As I usually make games for several platforms, mostly Linux and Android, having functionality like this built in instead of through libraries is very useful. And especially ogg-support is something I really have use for. My friend, who makes all music for my/our games, exports to ogg/mp3 and neither of us can use midi or the built in systems. So I find this function very useful! Thanks again for adding it! :)

Also, cool that it uses the internal audio engine. Have been interested in doing slow-down effects in a game, and it would be cool if I could make music and sound effects slow down too. :)
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hej Ville,
VilleK wrote:The first came up because we needed a built-in type to deal with models and I choose lower-case because the other types ("int" etc) were that too.
Already suspected that was the reason behind it.
VilleK wrote:You can now import OGG-files using the SampleImport plugin.
Very cool! This also allows you to ( for example ) speed up a OGG sample 4 times, and then play it back at 25% of the original speed in order to reduce the sample size even further ( when quality isn't top priority ). Attached is a quick test :-)

K
Attachments
Hobbit.zgeproj
(90.95 KiB) Downloaded 377 times
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ville, nice update. Built-in OGG support is definitely a good feature , so please do not remove it :-) I'm going to perform some experiments wit hit since I'm using RAW samples in my current project and will try to replace them by OGG; to see what's the impact on quality, possibility to play in loops, size of the compiled exe and apk files, working on Android, support for various dynamic modifications of played samples, etc.
VilleK wrote:At that point it made more sense to use the same casing as the component names. So "Model", "Camera" etc. I wonder which is the best way to clean this up without breaking backwards compatibility too much.
Is the backward compatibility a real issue? Changing "model" to "Model" is quite a detail in maintained projects, isn't it?

BTW thanks also for fixing the problem with handling application focus in the Preview panel as requested in this post.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ville, I wanted to use OGG sample for background music, but the problem is that it plays just ca. 24 second loops of the whole sample which is about 105 seconds long. It is an intention?

If not and ZGE will allow to play longer OGG files, what about to add the possibility to load sample form a file in runtime? There may be several solutions, but I was thinking about a sample component referring to a "memory buffer" (byte array or File.FileEmbedded) or read the file specified as file name string (similar to File.FileName or ZExternalLibrary.ModuleName).
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Kjell: nice trick :)

Rado1: It should be possible to load sample at runtime by loading to an array and then using setBinaryProp. But I haven't tested it. There should be no length limit, although please not that Sample.Length and Sound.Length are both taken into consideration. Set Sample.Length to zero if Sound.Length should be used. If it still doesn't work, please send me the project.
fracteed
Posts: 43
Joined: Wed Apr 30, 2014 1:14 am
Location: Sydney

Post by fracteed »

Thanks Ville, the OGG support is very welcome indeed 8)
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

VilleK wrote:Rado1: It should be possible to load sample at runtime by loading to an array and then using setBinaryProp. But I haven't tested it.
It has not been implemented yet, right?
VilleK wrote:There should be no length limit, although please not that Sample.Length and Sound.Length are both taken into consideration. Set Sample.Length to zero if Sound.Length should be used. If it still doesn't work, please send me the project.
Please see the attached project. When the Sample.Length set to 0 after running the project, it is automatically set to the correct sample length (105.7176). The Sound.Length is long enough (1000) to play the whole OGG sample, but it loops after ca. 24 seconds.
Attachments
test.zgeproj
testing project
(1.81 MiB) Downloaded 374 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Rado1: Try again, the code wrapped the sample too early due to limited precision integer math. Beta updated.

Using a File component to load a ogg-file into an array and then setBinaryProp on a SampleImport.SampleData property should work already but I haven't tried it.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

VilleK wrote:Using a File component to load a ogg-file into an array and then setBinaryProp on a SampleImport.SampleData property should work already but I haven't tried it.
Ville, I completely forgot the setBinaryProp() function. Attached is the example which loads an ogg file in runtime and plays it. Great! Thanks Ville for advice!

Now, I'm going to test it on Android.
Attachments
test.zip
test of loading ogg file in runtime
(804.01 KiB) Downloaded 370 times
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

8)

Just for fun .. click to start / stop.

K
Attachments
Mario.zgeproj
(274.48 KiB) Downloaded 411 times
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Nice one Kjell,. lol.

Seems like a cool new feature Ville. However, if you are using SunVox for sound anyway, you can also add OGG files to the modular setup. OGGs get embedded into the .sunvox file and can therefor be embedded into a .zgeproj when wanted as well.

on another note,. I have been experimenting with ways to do simple bitmap tile based stuff,. seems with a bit of editing the current Font component could be adapted to be a nice little Tile system. I will post an example in a new thread..,
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Nice example Kjell :). Cool that it works to speed up/down the sample at runtime and it sounds pretty smooth. Also clever to use a jpg and then add alpha using an expression.
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hej Ville,
VilleK wrote:Cool that it works to speed up/down the sample at runtime and it sounds pretty smooth.
It surprised me how smooth it was .. it's a lot better than when you use a real-time synth somehow. Too bad you can't play sounds backwards ( for people who'd want to do something like Braid ).

And the BaseNoteNr approach isn't very intuitive for these kind of things. Would have been convenient if you could use a percentage ( 100% being regular playback speed ) as well.

K
Post Reply