BallZ

Post screenshots, binaries and projectfiles of the projects you have made with ZGE that you want to share!

Moderator: Moderators

User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

BallZ

Post by Rado1 »

My experiments with 3D surfaces ended up in a small framework for dynamic visualization of surfaces in the form of small spheres; I call it BallZ. The intention was to create a generic and extensible code enabling simple specification of new shapes. Because BallZ seems to be not only useful, but also nice, it can be used as a screensaver.

I provide the source code for your fun. You can extend it by new surfaces easily: just add new update* (and maybe also init*) function(s) to the OnLoaded/ZLibrary, update the States/SceneState/OnState+OnUpdate code by adding calls of your function(s), and update the SCENES constant.

For ZGE gurus (Ville, jph, Kjell, y offs et, ...): I would really appreciate if you commented my code.
Attachments
Ballz.zip
screensaver
(51.03 KiB) Downloaded 1257 times
ballzscr.jpg
ballzscr.jpg (30.63 KiB) Viewed 37488 times
Ballz.zgeproj
source
(9.39 KiB) Downloaded 1111 times
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

It's a beautiful piece of work, and a substantial contribution to the code repository.

I'm flattered to be included in a group of real gurus. I'm more the resident noob / translator.

Nevertheless, I did find a 5% FPS improvement by substituting MeshSphere into your SphereMesh / Mesh and removing your two components.

Considering I tried a multitude of other techniques without any appreciable difference, I think that little bit is significant.
"great expectations"
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I really like it too. The transitions between shape and color are mesmerizing to watch.

Thanks for sharing the code. It looks well structured and reusable with a good understanding of when to use components and when to use scripting. In my opinion you can now call yourself a ZGE guru too :) ;)
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:)

Excellent work Rado1 ~ Somehow I get the feeling you've watched some of the video tutorials :wink: The only thing I would have done different is using a single 3D array for the colors instead of three 2D arrays.

@y_offs_et - Did you set the MeshSphere to 8x7 Samples like his MeshBox? Since in that case it makes sense .. it's one of those ( slightly annoying ) inconsistencies of ZGE. A 8x7 MeshBox ( 2D ) generates 9x8 ( triangulated ) quads, while a 8x7 MeshSphere generates 7x7, hence the difference in performance.

K
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

y offs et wrote:Nevertheless, I did find a 5% FPS improvement by substituting MeshSphere into your SphereMesh / Mesh and removing your two components.
I tried MeshSphere with the identical number of triangles (144) and FPS was the same on my machine (60 in average). The used SphereMesh (originally provided by Kjell) looks better in larger scales of models.
Kjell wrote:The only thing I would have done different is using a single 3D array for the colors instead of three 2D arrays.
You're right, 3-dimensional arrays would reduce amount of variables... I used more "didactic" approach.
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

Actually I used a 10x10 meshSphere which looked the same to me. I based my measurement on the fourth scene only, which is the most drain on resources. At one point my FPS would drop to 7.3 as compared to 7.6 or so ( 1680x1050 ) , which seemed about 5%. I mused the increase might be due to an optimized component vs. working thru code.
"great expectations"
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:?

Sounds very strange .. the Producer components are only executed once ( upon creation of the mesh ), after that it doesn't matter anymore whether the mesh has been created using a Expression or a MeshPrimitive.

Perhaps the difference is solely caused by the fact that Rado1 accidentally enabled HasTexCoords on his SphereMesh ( unnecessary since he's not using any textures ) while a MeshSphere doesn't have any texture coordinates.

K
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

Since you can't take a screenshot of a screensaver, I put the zproj in a 1280x800 window for both. I waited thru three cycles on each run and grabbed the lowest num I could. The results were consistent with the shots. I'm satisfied this is fact.
Attachments
altered.gif
altered.gif (37.29 KiB) Viewed 37420 times
stock.gif
stock.gif (50.52 KiB) Viewed 37420 times
"great expectations"
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

That is a nice display,. I really like the smooth transitions between the set animations. Your code is very well done as well,. I always get new ideas, for ways of doing stuff, when I look at other peoples code. Thanks for posting it.
iterationGAMES.com
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Thank you all for encouraging feedback. I updated the code according to your comments. Based on additional comments of my friends, I added clock, new fractal shape, and also the possibility to configure execution. If you put the Ballz.cfg file in the same directory as executable, you can configure switching the clock on/of and also rotating of all shapes vs. displaying just one selected. The description of config file format is contained in the attached example.
Attachments
Ballz.zip
v2
(56.81 KiB) Downloaded 1116 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I love the new shape, the morphing effect looks great for that one! And the clock is very neatly made too. Good improvements.
User avatar
Deozaan
Posts: 2
Joined: Wed Jun 30, 2010 11:44 pm

Post by Deozaan »

I like your screen saver. It was pointed out to me on DonationCoder.com.

I'd like to suggest an improvement:

Screen savers shouldn't have the same image in the same location the entire time the screen saver is running. That defeats the purpose of running a screen saver in the first place.

Could you do something about the copyright and the clock always being in the same location? (The problem with the clock is the colons, which are always on and always in the same place.) I'm not sure what would be best, as others have stated (in the DonationCoder thread) that they didn't like the copyright moving around with the balls.

Maybe the copyright could just move to another corner of the screen after 5 minutes or so? And the clock could move from bottom to top and vice versa.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

I would suggest fading it in and out and moving it around,. clock color could change as well.
iterationGAMES.com
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Update of BallZ is here. The clock is slowly moving and changing its color. Also a new shape was added. Copyright was moved to the config file.
Attachments
ballzscr2.jpg
ballzscr2.jpg (17.91 KiB) Viewed 37084 times
BallZ.zip
(52.14 KiB) Downloaded 1179 times
User avatar
Deozaan
Posts: 2
Joined: Wed Jun 30, 2010 11:44 pm

Post by Deozaan »

Thanks for incorporating my suggestions. I like your method of sliding the clock across the bottom rather than just having it jump to another location every few minutes.

I really like the new shape, too. It reminds me of something from the Cthulhu mythos.
Post Reply