Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - bigsofty

#61
My game editor uses a spinning 3D triangle as it cursor, I have noticed that it's rotation slowed a couple of seconds into the app run. So I added an FPS routine and it told me that the app is dropping from 60 frames per second down to about 22!

I then started to cut stuff out to try and find the problem, until eventually there was nothing left. Something like this...

while 1=1
displayFPS()
SHOWSCREEN
wend

And I'm still getting a slowdown (although not as bad, there should be none), from 60 FPS down to 45 FPS in about 2 or 3 seconds after launch?!?

I'm kinda hoping someone has run into this before with Android?

I'm using a Nexus 10 with Lollipop BTW.

#62
Here is an Easing library, handy for motion, animation etc.

1st a quick example:

Code (glbasic) Select
// --------------------------------- //
SETSCREEN 1024,768,FALSE
TweenInit()

LOCAL tween AS TTween
LOCAL endtime = GETTIMERALL()+5000
LOCAL time

WHILE time < endtime

time = GETTIMERALL()

LOCAL x#=tween.Call(LINEAR_TWEEN, time, 512, 502, endtime)
LOCAL y#=tween.Call(EASE_OUT_BOUNCE, time, 0, 758 , endtime)

DRAWRECT x#,y#,10,10,0xffffffff

SHOWSCREEN
WEND
END


Add the Tweening lib to your project, call "TweenInit()" and your good to go.

Each tween is a type and it has 3 fields, "Power", "Amplitude" and "Bounce". You can set these ("tween.Amplitude=2.0") and it will have an effect on the relative tween algorithm.

Cheers,


Ian


P.S. Look at the list of tween constants at the top of the library file to select a specific tween algorithm for tween.Call().

Code (glbasic) Select
// --------------------------------- //
// Project: tween
// Start: Saturday, October 18, 2014
// IDE Version: 12.308
// Bigsofty aka Ian Thompson


INLINE
/*
---------------------------------------------------------------------------
Disclaimer FOR Robert Penner's Easing Equations license:

TERMS OF USE - EASING EQUATIONS

Open source under the BSD License.

Copyright ? 2001 Robert Penner
Monkey version by Shinriko
All rights reserved.

Redistribution AND use IN source AND binary forms, with OR without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions AND the following disclaimer.
* Redistributions IN binary form must reproduce the above copyright notice,
this list of conditions AND the following disclaimer IN the documentation AND/OR other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used TO endorse OR
promote products derived from this software without specific prior written permission.

this SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF this SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---------------------------------------------------------------------------
FOR all easing functions:
t = elapsed time
b = begin
c = change = ending - beginning
d = duration (total time)
---------------------------------------------------------------------------
*/
ENDINLINE


INLINE
/*

---------------------------------------------------------------------------

CALLBACK API built on top of Robert Penners Functions

Simply call Tweening() function every Update()

- TYPE: one of the constantants below (LINEAR_TWEEN, EASE_IN_QUAD, ...)
- Returns: A float value which represents the current progress

---------------------------------------------------------------------------
*/
ENDINLINE

CONSTANT PI#=3.14159265

PROTOTYPE TweenProto#: t#, b#, c#, d#, tw AS TTween

GLOBAL TweenArray[] AS TweenProto

CONSTANT LINEAR_TWEEN%  = 0

CONSTANT EASE_IN_QUAD%  = 1
CONSTANT EASE_OUT_QUAD%  = 2
CONSTANT EASE_IN_OUT_QUAD%  = 3

CONSTANT EASE_IN_CUBIC%  = 4
CONSTANT EASE_OUT_CUBIC%  = 5
CONSTANT EASE_IN_OUT_CUBIC%  = 6

CONSTANT EASE_IN_QUART%  = 7
CONSTANT EASE_OUT_QUART%  = 8
CONSTANT EASE_IN_OUT_QUART%  = 9

CONSTANT EASE_IN_QUINT%  = 10
CONSTANT EASE_OUT_QUINT%  = 11
CONSTANT EASE_IN_OUT_QUINT%  = 12

CONSTANT EASE_IN_SINE%  = 13
CONSTANT EASE_OUT_SINE%  = 14
CONSTANT EASE_IN_OUT_SINE%  = 15

CONSTANT EASE_IN_EXPO%  = 16
CONSTANT EASE_OUT_EXPO%  = 17
CONSTANT EASE_IN_OUT_EXPO%  = 18

CONSTANT EASE_IN_CIRC%  = 19
CONSTANT EASE_OUT_CIRC%  = 20
CONSTANT EASE_IN_OUT_CIRC%  = 21

CONSTANT EASE_IN_BACK%  = 22
CONSTANT EASE_OUT_BACK%  = 23
CONSTANT EASE_IN_OUT_BACK%  = 24

CONSTANT EASE_IN_BOUNCE%  = 25
CONSTANT EASE_OUT_BOUNCE%  = 26
CONSTANT EASE_IN_OUT_BOUNCE% = 27

CONSTANT EASE_IN_ELASTIC%  = 28
CONSTANT EASE_OUT_ELASTIC%  = 29
CONSTANT EASE_IN_OUT_ELASTIC% = 30


//--------------------------------------------------------------------------


//--------------------------------------------------------------------------
// * Linear
//--------------------------------------------------------------------------
FUNCTION LinearTween#:t#, b#, c#, d#, tw AS TTween
RETURN c*t/d + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Quad
//--------------------------------------------------------------------------
FUNCTION EaseInQuad#:t#, b#, c#, d#, tw AS TTween
t = t / d
RETURN c*t*t + b
ENDFUNCTION

FUNCTION EaseOutQuad#:t#, b#, c#, d#, tw AS TTween
t = t / d
RETURN -c * t*(t-2) + b
ENDFUNCTION

FUNCTION EaseInOutQuad#:t#, b#, c#, d#, tw AS TTween
t = t / (d/2)
IF (t < 1) THEN RETURN c/2*t*t + b
t = t - 1
RETURN -c/2 * (t*(t-2) - 1) + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Cubic
//--------------------------------------------------------------------------
FUNCTION EaseInCubic#:t#, b#, c#, d#, tw AS TTween
t = t / d
RETURN c*t*t*t + b
ENDFUNCTION

FUNCTION EaseOutCubic#:t#, b#, c#, d#, tw AS TTween
t = t / d
t = t - 1
RETURN c*(t*t*t + 1) + b
ENDFUNCTION

FUNCTION EaseInOutCubic#:t#, b#, c#, d#, tw AS TTween
t = t / (d/2)
IF (t < 1) THEN RETURN c/2*t*t*t + b
t = t - 2
RETURN c/2*(t*t*t + 2) + b
ENDFUNCTION


//--------------------------------------------------------------------------
// * Quart
//--------------------------------------------------------------------------
FUNCTION EaseInQuart#:t#, b#, c#, d#, tw AS TTween
t = t / d
RETURN c*t*t*t*t + b
ENDFUNCTION

FUNCTION EaseOutQuart#:t#, b#, c#, d#, tw AS TTween
t = t / d
t = t - 1
RETURN -c * (t*t*t*t - 1) + b
ENDFUNCTION

FUNCTION EaseInOutQuart#:t#, b#, c#, d#, tw AS TTween
t = t / (d/2)
IF (t < 1) THEN RETURN c/2*t*t*t*t + b
t = t - 2
RETURN -c/2 * (t*t*t*t - 2) + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Quintic
//--------------------------------------------------------------------------
FUNCTION EaseInQuint#:t#, b#, c#, d#, tw AS TTween
t = t / d
RETURN c*t*t*t*t*t + b
ENDFUNCTION

FUNCTION EaseOutQuint#:t#, b#, c#, d#, tw AS TTween
t = t / d
t = t - 1
RETURN c*(t*t*t*t*t + 1) + b
ENDFUNCTION

FUNCTION EaseInOutQuint#:t#, b#, c#, d#, tw AS TTween
t = t / (d/2)
IF (t < 1)
RETURN c/2*t*t*t*t*t + b
ENDIF
t = t - 2
RETURN c/2*(t*t*t*t*t + 2) + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Sinus
//--------------------------------------------------------------------------
FUNCTION EaseInSine#:t#, b#, c#, d#, tw AS TTween
RETURN -c * COS((t/d * (PI/2)) * 57.2957795) + c + b
ENDFUNCTION

FUNCTION EaseOutSine#:t#, b#, c#, d#, tw AS TTween
RETURN c * SIN((t/d * (PI/2)) * 57.2957795) + b
ENDFUNCTION

FUNCTION EaseInOutSine#:t#, b#, c#, d#, tw AS TTween
RETURN -c/2 * (COS((PI*t/d) * 57.2957795) - 1) + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Exponential
//--------------------------------------------------------------------------
FUNCTION EaseInExpo#:t#, b#, c#, d#, tw AS TTween
RETURN c * POW( 2, 10 * (t/d - 1) ) + b
ENDFUNCTION

FUNCTION EaseOutExpo#:t#, b#, c#, d#, tw AS TTween
RETURN c * ( -POW( 2, -10 * t/d ) + 1 ) + b
ENDFUNCTION

FUNCTION EaseInOutExpo#:t#, b#, c#, d#, tw AS TTween
t = t / (d/2)
IF (t < 1)
RETURN c/2 * POW( 2, 10 * (t - 1) ) + b
ENDIF
t = t - 1
RETURN c/2 * ( -POW( 2, -10 * t) + 2 ) + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Circ
//--------------------------------------------------------------------------
FUNCTION EaseInCirc#:t#, b#, c#, d#, tw AS TTween
t = t / d
RETURN -c * (SQR(1 - t*t) - 1) + b
ENDFUNCTION

FUNCTION EaseOutCirc#:t#, b#, c#, d#, tw AS TTween
t = t / d
t = t - 1
RETURN c * SQR(1 - t*t) + b
ENDFUNCTION

FUNCTION EaseInOutCirc#:t#, b#, c#, d#, tw AS TTween
t = t / (d/2)
IF (t < 1)
RETURN -c/2 * (SQR(1 - t*t) - 1) + b
ENDIF
t = t - 2
RETURN c/2 * (SQR(1 - t*t) + 1) + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Back
//--------------------------------------------------------------------------
FUNCTION EaseInBack#:t#, b#, c#, d#, tw AS TTween
t = t / d
RETURN c * t * t * ((tw.Bounce + 1) * t - tw.Bounce) + b
ENDFUNCTION

FUNCTION EaseOutBack#:t#, b#, c#, d#, tw AS TTween
t = t / d - 1
RETURN c * (t * t * ((tw.Bounce + 1) * t + tw.Bounce) + 1) + b
ENDFUNCTION

FUNCTION EaseInOutBack#:t#, b#, c#, d#, tw AS TTween
t = t / (d / 2)
IF ((t) < 1)
tw.Bounce=tw.Bounce*1.525+1
RETURN c/2*(t*t*(tw.Bounce*t - tw.Bounce)) + b
ENDIF
t = t -2
tw.Bounce=tw.Bounce*1.525+1
RETURN c/2*(t*t*(tw.Bounce*t + tw.Bounce) + 2) + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Bounce
//--------------------------------------------------------------------------
FUNCTION EaseInBounce#:t#, b#, c#, d#, tw AS TTween
RETURN c - EaseOutBounce(d - t, 0, c, d, tw) + b
ENDFUNCTION

FUNCTION EaseOutBounce#:t#, b#, c#, d#, tw AS TTween
t = t / d
IF (t < (1 / 2.75))
RETURN c * (7.5625 * t * t) + b
ELSEIF (t < (2 / 2.75))
t = t - (1.5 / 2.75)
RETURN c * (7.5625 * t * t + .75) + b
ELSEIF (t < (2.5 / 2.75))
t = t - (2.25 / 2.75)
RETURN c * (7.5625 * t  * t + .9375) + b
ENDIF
t = t - (2.625 / 2.75)
RETURN c * (7.5625 * t * t + .984375) + b
ENDFUNCTION

FUNCTION EaseInOutBounce#:t#, b#, c#, d#, tw AS TTween
IF (t < d/2)
RETURN EaseInBounce(t*2, 0, c, d, tw) * .5 + b
ENDIF
RETURN EaseOutBounce(t*2-d, 0, c, d, tw) * .5 + c*.5 + b
ENDFUNCTION



//--------------------------------------------------------------------------
// * Elastic
//--------------------------------------------------------------------------
FUNCTION EaseInElastic#:t#, b#, c#, d#, tw AS TTween
LOCAL s#
IF (t = 0)
RETURN b
ENDIF
t = t / d
IF (t = 1)
RETURN b+c
ENDIF

IF (NOT tw.Power)
tw.Power = d * .3
ENDIF
IF (NOT tw.Amplitude) OR tw.Amplitude < ABS(c)
tw.Amplitude = c
s = tw.Power/4
ELSE
s = tw.Power/(2*PI) * ASIN(c/tw.Amplitude)
ENDIF
t = t -1
RETURN -(tw.Amplitude*POW(2,10*(t)) * SIN((t*d-s)*(2*PI)/tw.Power)) + b
ENDFUNCTION

FUNCTION EaseOutElastic#:t#, b#, c#, d#, tw AS TTween
LOCAL s#
IF (t = 0)
RETURN b
ENDIF
t = t / d
IF (t = 1)
RETURN b+c
ENDIF

IF (NOT tw.Power)
tw.Power = d * .3
ENDIF
IF (NOT tw.Amplitude) OR tw.Amplitude < ABS(c)
tw.Amplitude = c
s = tw.Power/4
ELSE
s = tw.Power/(2*PI) * ASIN(c/tw.Amplitude)
ENDIF
RETURN (tw.Amplitude*POW(2,-10*t) * SIN((t*d-s)*(2*PI)/tw.Power)+c+b)
ENDFUNCTION

FUNCTION EaseInOutElastic#:t#, b#, c#, d#, tw AS TTween
LOCAL s#
IF (t = 0)
RETURN b
ENDIF
t = t / (d / 2)
IF (t = 2)
RETURN b+c
ENDIF

IF (NOT tw.Power)
tw.Power = d * 0.3 * 1.5
ENDIF
IF (NOT tw.Amplitude) OR tw.Amplitude < ABS(c)
tw.Amplitude = c
s = tw.Power/4
ELSE
s = tw.Power/(2*PI) * ASIN(c/tw.Amplitude)
ENDIF

IF (t < 1)
t = t - 1
RETURN -0.5*(tw.Amplitude*POW(2,10*(t)) * SIN((t*d-s)*(2*PI)/tw.Power)) + b
ENDIF

t = t - 1
RETURN (tw.Amplitude*POW(2,-10*t) * SIN((t*d-s)*(2*PI)/tw.Power)*0.5 +c+b)
ENDFUNCTION


FUNCTION TweenInit:
DIM TweenArray[31]

TweenArray[LINEAR_TWEEN] = LinearTween

TweenArray[EASE_IN_QUAD] = EaseInQuad
TweenArray[EASE_OUT_QUAD] = EaseOutQuad
TweenArray[EASE_IN_OUT_QUAD] = EaseInOutQuad

TweenArray[EASE_IN_CUBIC] = EaseInCubic
TweenArray[EASE_OUT_CUBIC] = EaseOutCubic
TweenArray[EASE_IN_OUT_CUBIC] = EaseInOutCubic

TweenArray[EASE_IN_QUART] = EaseInQuart
TweenArray[EASE_OUT_QUART] = EaseOutQuart
TweenArray[EASE_IN_OUT_QUART] = EaseInOutQuart

TweenArray[EASE_IN_QUINT] = EaseInQuint
TweenArray[EASE_OUT_QUINT] = EaseOutQuint
TweenArray[EASE_IN_OUT_QUINT] = EaseInOutQuint

TweenArray[EASE_IN_SINE] = EaseInSine
TweenArray[EASE_OUT_SINE] = EaseOutSine
TweenArray[EASE_IN_OUT_SINE] = EaseInOutSine

TweenArray[EASE_IN_EXPO] = EaseInExpo
TweenArray[EASE_OUT_EXPO] = EaseOutExpo
TweenArray[EASE_IN_OUT_EXPO] = EaseInOutExpo

TweenArray[EASE_IN_CIRC] = EaseInCirc
TweenArray[EASE_OUT_CIRC] = EaseOutCirc
TweenArray[EASE_IN_OUT_CIRC] = EaseInOutCirc

TweenArray[EASE_IN_BACK] = EaseInBack
TweenArray[EASE_OUT_BACK] = EaseOutBack
TweenArray[EASE_IN_OUT_BACK] = EaseInOutBack

TweenArray[EASE_IN_BOUNCE] = EaseInBounce
TweenArray[EASE_OUT_BOUNCE] = EaseOutBounce
TweenArray[EASE_IN_OUT_BOUNCE] = EaseInOutBounce

TweenArray[EASE_IN_ELASTIC] = EaseInElastic
TweenArray[EASE_OUT_ELASTIC] = EaseOutElastic
TweenArray[EASE_IN_OUT_ELASTIC] = EaseInOutElastic

ENDFUNCTION

TYPE TTween

Bounce# = 1.70158
Power# = 1
Amplitude# = 1

FUNCTION Call#: tw%, t#, b#, c#, d#
ALIAS tween AS TweenArray[tw%]
RETURN tween(t#, b#, c#, d#, self)
ENDFUNCTION

ENDTYPE
#63
Off Topic / Photogrammetry
2014-Oct-03
Really nice method for creating 3D objects with stunningly realistic textures explained here...  :blink:

http://www.theastronauts.com/2014/03/visual-revolution-vanishing-ethan-carter/
#64
Feedback / Small request
2014-Sep-23
Messing around with the iPad version here.

Could there be an option for scaling the game-play area using square pixels please? My lovely little sprites are getting distorted and irregularly stretched in-game which makes them look very rough when compared to how they originally looked in the sprite designer.

I realise this could mess up the aspect ratio a bit but if the game-play area was centred, with a small border perhaps, using the square pixels would look a lot nicer IMHO.

#65
Just discovered this one, any one tried it, good for quick Android testing?  :blink:

http://www.genymotion.com

#66
GLBasic - en / Gernot
2014-Aug-14
Hi,

I was considering doing a small GLBasic app but I've noticed, after looking at the forum, that Gernots presence has become rather sparse. Is GLBasic still being developed? How is it's current state, any bugs that are causing people problems on any platforms?

Many thanks,


Ian
#67
Off Topic / Steam OS
2013-Sep-23
Steam OS has been announced today...

http://store.steampowered.com/livingroom/SteamOS/

The Steam Box hardware will be announced on Wednesday, with the release titles announced on Friday.

Good news for this new OS is that it will be released free and will also run on most PC hardware. This is basically a Linux based console centricly designed OS. So this is aimed to compete with the big 3, Microsoft, Nintendo and Sony but give the PC a better chance to enter the living room console games market.

Good luck to them, competition is good for us.
#68
Voxatron -  http://www.lexaloffle.com/voxatron.php

Retro pixel graphics inspired arcade game, with a mouth wateringly good voxel engine. Love it!  :good:

It's still in Alpha but well worth picking up already IMHO.

#70
See... http://torinak.com/qaop/games

From a coders point of view this is impressive stuff, it even works on the iPad! From a nostalgia point of view, being an ex Spectrum owner, this gives me a warm cosy feeling all over!  =D
#71
Not my image but a handy reference to DPI, Ratio's, icone sizes, GUI elements and positions etc.

Click on image to enlarge.
#73
http://lists.libsdl.org/pipermail/sdl-libsdl.org/2013-August/089854.html

They got there in the end and it looks well worth the wait too! :D
#75
A lot more powerful and efficient when compared the stock Android emulator. You can communicate via ADB as usual too...

http://www.genymotion.com/
#76
Hi,

iOS In App Purchases, has anyone used them to monetise their app with GLBasic lately?

Also, is it still feasible too? I realise that some of the iOS libs(Banners) were knocked out when iOS 5+ came around.

It's been a while since I used any of this stuff and would appreciate any feedback.  :)

#77
http://www.bbc.co.uk/news/technology-22613948



Should be quite an interesting Christmas this year with a new console battle about to commence!  =D
#78
Off Topic / 8bit chip music
2013-Mar-19
Hi,

I've been scouring the net for some decent 8bit chip music, for my retro'ish game, which is on temporary hold till I've finished the new Vycaria medsim.  But I am looking in my spare time for music and I've heard tonnes I like but it's kinda frustrating, the ones I do like are in old ST/C64/CPC demos mainly but it's almost impossible to find the authors for permission after 15 years or so. So could anyone recommend a good source of chip music, preferably with an on-line catalogue that you can actually hear some chip-tunes?  :booze:
#79
Some nice games at a very nice price! ;)

http://www.indieroyale.com
#80
Off Topic / Galaxy Note 10.1
2013-Feb-11
Anyone have one, tried one? if so, I am interested in how it performs with regards to its stylus and drawing, how do you rate its performance(accuracy, pressure sensitivity, touch lag etc.)?