Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tips and tricks i learned.

Author
Message
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 29th Jan 2015 13:25 Edited at: 29th Jan 2015 13:32
Was trying to make a physics highmap , and ended up with this.

Video is flickering because of the grapper software. Is there any software that can grap without flickering ?
It looks really cool when everything runs smoothly, and it do even on mobile devices.

Things i learned from this:

1. music mp3 loops: cut off the last 1 sec. of the mp3 and save it as a wav, then 1 sec. before the mp3 ends, you start the 1 sec wav using playsound (playsound is really fast) , and just after you start playsound you stop the mp3 and start it again using playmusic.
it takes around 1 sec. before the playmusic starts so you have a perfect loop, the wav is playing while the mp3 loads.
Actually you need to cut off small parts of the 1 sec. wav to get it 100% correct but its possible.
Im nearly there in this video on the main menu, listen around 48 sec into the video to hear the looping.


2. When using SetViewOffset, it will flicker on some mobile/tablet devices, i found that if i use SetSyncRate( 62, 0 ) on mobile devices, the flicker nearly stops.
( sure your code should be fast enoff to process 60 fps. ) i do not know why, when you do some timer testing you see that the waiting in Swap() for the sync 60 is working,
but perhaps it miss a sync now and then, looks like around every 200-500 sync.
Perhaps swap returns faster when the device forces a max 60 fps ?
( when running in windows it must be set to 60 fps. )


3. SetWindowSize , depending of your game , sometimes you get a mush better fps when you make the screen size larger. give it a try , think this has to do with how many
objects on the screen overlap, so making the screen larger could make less objects overlap.

4. The physics highmap: everything in the video is random generated, so endless landscapes/levels. Its done like this:
Only one tile is used to make all the hills.

for a = 0 to 999999
road[a] = sin.... random ...
next a
...
changelength = wide of the tile you use, i use a 200x200.
...
for a = 0 to (changelength) step 1
roadimg[a] = CopyImage( roadimage, a, 0, 2, 200 )
next a
...

drawroad posx# = view offset , roadstep = graphics quality, i use 2 for high and 4 for low graphics setting (for old slow mobile devices):
for a = 0 to screenwidth step roadstep
...
SetSpritePosition(roadsprites[a],a+(posx#)-roadstep,road[ a+px ]+posy#+(screenheight-250)+graphicsaddx)
imagetouse = FMod( a+posx#, changelength-roadstep)
SetSpriteImage(roadsprites[a],roadimg[ imagetouse ] )
next a
....
I tried everything and SetSpriteImage is the fastest way to make the road follow the viewoffset.

Thats it, should give you an idea of how to make the terrain. you can use the roadsprites with physics on screen , and the road[..] highmap off screen.
...

The game only has one control ( anywhere on the screen) and thats jump, but its really hard/addicting, nearly done, perhaps its released tomorrow.

Hope you can use some of the things i learned, so you dont have to spent the extra hours

Flickering video:





best regards Preben Eriksen,
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 29th Jan 2015 13:48
That is IMPRESSIVE!

Onwards and sometimes upwards
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Jan 2015 14:44
Nice work, and thanks for the tips.

There's something very hypnotising about games like this.

Quidquid latine dictum sit, altum sonatur
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 30th Jan 2015 13:35 Edited at: 30th Jan 2015 13:36
Thanks

I have just released it, here is the android link.

https://play.google.com/store/apps/details?id=com.plemsoft.game2015m

And a link to a new video , still flickering but a little better:

http://www.youtube.com/watch?v=woGnrYNBhb8

best regards Preben Eriksen,
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 3rd Feb 2015 11:16
Nice idea for creating the ground

I use Fraps to capture video on Windows and have no problems.

CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 6th Feb 2015 10:14
Great stuff Preben! Do you do all the artwork yourself?

V2 T1 (Mostly)
Uzmadesign
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 20th Feb 2015 15:28
CJB:
I purchase some graphics and make some myself, and reuse graphics from my older flash games, i have around 50+ flash games ( all the games on slungo.eu ) , so with the new cs6 spritesheet feature its pretty easy to reuse the graphics

best regards Preben Eriksen,

Login to post a reply

Server time is: 2024-11-25 17:30:54
Your offset time is: 2024-11-25 17:30:54