Specials
Top sellers

JPThread

JPThread
JPThread
Product Code: jpthread
Availability: In Stock
Built for: Execute a single function over several frames
Product Version: 1.2
Online Demo: http://www.julien-pierron.com/sample.php?sample=jpsmoothloadingsample
Forum Link: http://www.shivaengine.com/developer/forum/viewtopic.php?f=82&t=29258
Req. ShiVa Version: ShiVa 1.9.2 Engines
Plugin Platform Compatibility: iOS, Android, WinRT ARM/Phone 8, WinRT x86/_64, Windows Legacy, Mac OS X, Linux, Flash, Web Browser, Palm, Marmalade, BlackBerry, Windows Phone 7, Playstation 3, Playstation 4, Xbox 360, Xbox One, Wii
Price: $26.00
Seller information: Julien Pierron
Country: France, Metropolitan
Company: Julien Pierron
Qty:     - OR -   Wish List
Compare
JPThread is another magic pack, allowing you to think your game conception in a new manner. It allows you to execute the code of a function over several frames.

-------------------------------------------------
JPThread.create ( this.preloadSceneResources )
-------------------------------------------------

-------------------------------------------------
function MyAIModel.preloadSceneResources ( )
-------------------------------------------------
for i = 0, table.getSize ( this.tTextures ( ) ) - 1
do
local sTextute = table.getAt ( this.tTextures ( ), i )
application.forceResourceToStayLoaded ( sTexture, application.kResourceTypeTexture, true )
JPThread.addYieldPoint ( )
end
-------------------------------------------------
end
-------------------------------------------------

As a result, the loading process will be executed over several frames, at a speed of 1 texture loading per frame. Your game execution will be much more fluid. JPThread.addYieldPoint ( ) mean the function execution pauses here and will start from here at the next frame. Of course, you can add this call several times in your function code.

Here is a screenshot of the Performance Reporter in ShiVa, you can see clearly that the function does not create a freeze at all as it is executed over several frames:

http://www.julien-pierron.com/images/jpthread_comparison.jpg

This feature is also very useful in many other cases, think for instance how you currently load a file into the cache. Now, you will be able to do the whole process with a single function call:

-------------------------------------------------
function MyAIModel.loadFile ( sFile, sUrl )
-------------------------------------------------
cache.addFile ( sFile, sUrl )
while ( cache.getFileStatus ( sFile ) >= 0 and cache.getFileStatus ( sFile ) < 1 )
do
JPThread.addYieldPoint ( )
end

local nStatus = cache.getFileStatus ( sFile )

if ( nStatus == 1 )
then
--Success
else
--Fail
end
-------------------------------------------------
end
-------------------------------------------------

This pack is really powerful.

Requirements:
- ShiVa 1.9.2 or greater
- LUA project (not compatible with full c++ projects, compatible with LUA projects that use c++ plugins)

You can find an introduction to the packs and how to load them in your game here:
http://www.julien-pierron.com/shiva-store.php

API & Instructions
http://www.julien-pierron.com/product-api.php?product=jpthread

Changelog
http://www.julien-pierron.com/product-changelog.php?product=jpthread

Sample projects that use my packs
http://www.julien-pierron.com/samples.php

Write a review

Your Name:


Your Review: Note: HTML is not translated!

Rating: Bad           Good

Enter the code in the box below:



ShiVa Store © 2017 - Powered By OpenCart