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 - Wampus

#21
You've all probably taken a lot of 'thinking style' quizzes online or have a sense of your preferred approach to learning and thinking from education.

So, what kind of thinker are you? What are your habits, strengths and weaknesses when it comes to problem solving? How does this manifest when it comes to coding?

Here is a quick thinking style quiz if you want to take one: http://www.bbc.co.uk/science/leonardo/thinker_quiz/
#22
I'm sure some of you got the notice about Gatekeeper for [Mountain] Lion OSX. I'm not sure but I think this means that many Mac users will get a security warning when running apps made with GLBasic, unless GLBasic integrates with the Mac Developer Program somehow.

https://developer.apple.com/resources/developer-id/

#23
Is there a quick way to allocate a set amount of memory to a GLB string? I'm copying from memory directly to a string like this:-

Code (glbasic) Select
FUNCTION peekString$:mem%, BYREF str$, size%
INLINE
memcpy((char *) str_Str.c_str(), (char *) mem, size);
ENDINLINE
ENDFUNCTION


The above works great (afaik). However, the string must be of adequate size. Getting it to be the right size when there is a large amount of data is fairly crude right now. I use a loop with inc str$, "     (lots of space)   ".

More efficient way? This is hardly critical to say the least. I'm just curious.
#24
Lots of interesting info in this slide deck here: http://www.businessinsider.com/the-future-of-mobile-deck-2012-3?op=1

Snippet: in one slide there are four possible notable trends offered in answer to the question, "What's the mobile platform future?" -


  • Android gets its act together (...and therefore dominates)
  • Microsoft completes Hail Mary pass
  • HTML5 nukes native apps
  • Apple will take over the world
#25
Which directory can I write to that I can easily access in Android?

Might seem like a dumb question but I'm dumb. :)

On my main test device the documents and application directories sent back from PLATFORMINFO$() both have /data/data/com.livingmidnight.[whatever]/files. Unfortunately I can't seem to get to these directories with File Manager. I've checked over the SD card storage and the main memory but find nothing. Is the directory hidden when testing a debug version of an app?
#26
Check it out: http://yourgameideaistoobig.com/

Is your game idea too big?

:whistle:
#27
How about a BACK button to return to a section of code after jumping to another Function or File? It could be part of a history of last known locations before jumping to a new area of code or new file.

I often hop around code by clicking on a Function to make a change then go back to some code that calls the Function. I've noticed I can be quite slow finding my way back again sometimes. I instinctively look for a 'BACK' button to return to my previous location.
#28
MaxRects function - optimally pack many sprites/rectangles into an area

Attached is source code that demonstrates an implementation of the MaxRects algorithm in GLBasic. You'll find an example of its use to play with and the function itself in the file MaxRects.gbas. I used the study 'A Thousand Ways To Pack The Bin - A Practical Approach to Two-Dimensional Rectangle Bin Packing' by Jukka Jylänki as reference material.

The purpose of the MaxRects algorithm is to find an optimum way to pack many rectangles into another larger rectangle. Other algorithms exist but MaxRects is the best to use in most scenarios. I've also included the three most effective known heuristics for MaxRects in the code. I could add more but others are unlikely to find better solutions 99% of the time so I'm leaving them for now.

A well known use for MaxRects is packing sprites into an OpenGL sprite sheet for use in games. So, if you use Polyvector sprites this might be very handy. If all you need is a pre-packed sheet I recommend commerical tools like Texture Packer. They can use the same packing algorithm as MaxRects. They also tend to come with a ton of useful options for other aspects of sprite management. However, if you need your apps to pack sprites sheets on the fly, e.g. to adjust to different resolutions before running, then use this GLBasic code.

My code is a little crazy (just one large function) but its very fast. Below is a screenshot of the demonstration example. Red rectangles have been rotated and blue rectangles are in their original form.



How to use the MaxRects function

ok = MaxRects ( BinWidth, BinHeight, Textures[], rotate )

The array you put for Textures[] will contain the dimensions of the sprites/rectangles you want to pack together. The array should use this type:-

TYPE reclist
   w      // width of rectangle
   h      // height of rectangle
   x      // x position
   y      // y position
   r      // 0 = normal, 1 = rotated 90 degrees
ENDTYPE


Before you send the array to be sorted you only need to define the width and height. Any information in x, y and r will be overwritten if a solution is found.

The rotate variable can be either FALSE = no rotation, or TRUE = rotation is allowed. If you use MaxRects to pack sprites into a sprite sheet for use with Polyvector commands then it makes sense to make use of rotation. If you're planning on using commands like DRAWANIM then it shouldn't be used.

BinWidth and BinHeight are the dimensions of the space you want to put the sprites/rectangles in. If you're creating sprite sheets for polyvector use make sure these are set to powers of 2 and keep in mind the maximum texture size for the platforms you're targeting, e.g. 1024x1024, 64x128, 2048x2048 are good - 36x1002 is bad.

The value returned to ok will be -1 if no solution could be found or, if the attempt was successful, ok will contain the amount of pixel area space that could be potentially cropped without losing anything. In practice cropping is rarely worth bothering with, so long as the sprites fit.

If successful every element in the Textures[] array will have x and y coordinates and rotation r values if rotation was allowed.

Hope someone finds this helpful.

[attachment deleted by admin]
#29
I came across this today: http://brashmonkey.com/spriter.htm

A kickstarter vid explaining what it is intended for is here: http://www.kickstarter.com/projects/539087245/spriter

Don't know about you but I've wanted something like this for a while now. It would make the creation of great looking animation so much easier. Shouldn't be too hard to support it in GLBasic either.

[edit]
GLBasic loader here:
http://www.glbasic.com/forum/index.php?topic=7887.msg67801#msg67801
#30
I've been feeling something for a time and thought I should bring it up. In my opinion, for what it is and what it can do, GLBasic isn't well known enough.

Just prior to posting I was looking at a Wikipedia page about mobile application development. I noticed there was a list of development kits that support one or more platforms and GLBasic wasn't on the list, despite the very wide platform support it offers.

The above strikes me as crazy. I've tried a lot of the dev kits listed and GLBasic is one of the most flexible I've seen. Its not just what it can do but the price, speed of development time and ease of use that, on balance, make it stand out.

I'd like to propose a group project: We could collectively promote GLBasic on the web - make people aware it exists and what it can do.

Even as an experiment it would be interesting to see what we'd be capable of and what impact it had if a lot of us put in an effort. Whether its people working alone or collaborating in a targeted and coordinated way, we'd all benefit somehow.

What do you think? Any ideas? And would you want to be in on such a thing?
#31
Hi

When I try to compile code with the line ?IF GLB_DEBUG the code works fine when debug mode is turned on. When I try to compile without debug mode I get the following error message: error : syntax error : ... lb_debug

Its as if ?IF GLB_DEBUG has been changed to ?IF glb_debug. The change of case will cause the same error whether or not debug mode is on.
#32
Wampus's Basement







Download is attached to this post

This is the result on an attempt to create a game in 5 hours. Trying that was ambitious so the time doubled to 10 hours! (including a couple of breaks.) The person working on the art and sound managed to get everything done much quicker. A video showing the creation of the game will be uploaded to YouTube soon.

Instructions: Use arrow keys or a joypad to control Wampus as he searches for a way out of his haunted basement. Collect a key before going to the way out (an upward pointing arrow). Be careful of monsters! Contact with them will wear you down and kill you. They're smart too so don't underestimate them.

     Enemies:-

          Creepy Ghost Girl - She is slow and doesn't do too much harm. Beware of her catching you in a dead end.
          Manic Frankenstein - Strong and persistent, he'll hunt you forever until he catches you.
          Big Brown Bear - The bear is a formidable opponent. He'll tear you to pieces in seconds if you can't escape him.
          Mystery Monster - This dangerous creature may be the last thing you'll ever hear or see.




Developer notes: This was very rewarding and fun to do. It was also stressful because of the pressure. I found that GLBasic shows some of its greatest strengths when it comes to getting something created quickly. I did cheat a bit, i.e. wanting to limit the vision of the player character to what could be seen from his perspective I imported some line of sight code I created previously. Since the code is unlikely to get used ever again I thought I should use it for this at least.

A lot of time was spent on bug fixing because I made some dumb mistakes by not thinking about what I was doing before I tried to code. Play testing also took up a lot of time at the end. Initially the game was way to hard and the mazes were too big. Its still a tough game though.

Because this worked out I want to try to create a small-ish game in a week when the opportunity arises.


[attachment deleted by admin]
#33
So you want to be a game developer? Click here...

I know just how this guy feels.  :)

How about you?
#34
My Kindle Fire occasionally has intermittent slowdown in apps when I stream ogg files. Shutting down and rebooting the Fire fixes the issue but it does return after a while.

Anyone else seen this happen? I'm taking it as another sign I should be using tracker music for Android apps, since the issue doesn't occur with tracker music.  ;)
#35
So, as has been noticed previously MikMod tracker playback is working for Android. Using PLAYMUSIC with mod files will play just like an MP3. Its part of SDLmixer so it could also work for Windows and iOS too.

Please consider making MikMod compile for other platforms. Bearing in mind the size restrictions on mobile apps it would be very helpful to have tracker music playback for iOS as well as Android. MP3 music files are often the largest media files in a mobile app project. Being able to use tracker music instead would allow for considerably smaller packages.

I think its worth pointing out that cery few successful popular mobile apps use MP3 files or their equivalent for music content. Most use tracker playback of some kind for the reason mentioned above.
#36
The code below creates medium quality pseudorandom numbers using Xorshift. With better quality pseudorandom number generation that is almost as fast the Mersenne Twister code found on this forum would be a better choice for most tasks. I thought I'd post this Xorshift code anyway.

XorShiftSeed(num) - Sets the Xorshift randomizer with seed num.

XorShift(maxnum) - Generates a random number with the range 0 to maxnum-1.

Code (glbasic) Select
INLINE

static unsigned long xxs=123456789, yxs=362436069, zxs=521288629;

unsigned long xorshrseed(unsigned long int SeedNumXS) {
xxs = SeedNumXS, yxs=362436069, zxs=521288629;
}

unsigned long xorshf(unsigned long int mmaxNumXS) {       
unsigned long txs;
xxs ^= xxs << 21;
xxs ^= xxs >> 35;
xxs ^= xxs << 4;

txs = xxs;
xxs = yxs;
yxs = zxs;
zxs = txs ^ xxs ^ yxs;

return (zxs % mmaxNumXS);
}

ENDINLINE



FUNCTION XorShiftSeed: snum

INLINE
xorshrseed((unsigned long) snum);
ENDINLINE

ENDFUNCTION



FUNCTION XorShift: mnum

INLINE
return xorshf((unsigned long) mnum);
ENDINLINE

ENDFUNCTION
#37
Its possible to use the compression method used when saving PNG files to compress pretty much anything. Attached to this post is some code which does just that. Works nicely for large files. For smaller files the advantage diminishes since saving array data as a PNG file will add ~800 bytes of data.

The functions:-

LoadDataSprite( filename$ )
Loads a file into the array datasprite%[]

SaveDataSprite( filename$ )
Saves a file from the data contained in the array datasprite%[]

DeflateDataSprite (filename$ )
Compresses and saves the data in array datasprite%[]

InflateDataSprite ( filename$ )
Loads and uncompresses a file and puts the data into datasprite%[]

ClearDataSprite()
Clears the array datasprite%[] and size register

[attachment deleted by admin]
#38
Hi!

I found Easyzlib, which simplifies the task of including zlib compression. However, when I try to compile there seems to be a lot of clashes with GLBasic. I've attached the code I'm trying to use as a starting point. Could someone give me some hints as to how to fix the errors? Would simply renaming variables work, for example.

First few errors...
Code (glbasic) Select
easyzlib.c:1608: error: `const char*__GLBASIC__::zError' redeclared as different kind of symbol
easyzlib.c:1308: error: previous declaration of `const char* __GLBASIC__::zError(int)'
easyzlib.c:1608: error: declaration of `const char*__GLBASIC__::zError'
easyzlib.c:1308: error: conflicts with previous declaration `const char* __GLBASIC__::zError(int)'
easyzlib.c:1608: error: `err' was not declared in this scope
easyzlib.c:1609: error: expected `,' or `;' before "int"
easyzlib.c:1610: error: expected unqualified-id before '{' token
easyzlib.c:1775: error: `void*__GLBASIC__::zcalloc' redeclared as different kind of symbol
easyzlib.c:1564: error: previous declaration of `void* __GLBASIC__::zcalloc(void*, unsigned int, unsigned int)'
easyzlib.c:1775: error: declaration of `void*__GLBASIC__::zcalloc'
easyzlib.c:1564: error: conflicts with previous declaration `void* __GLBASIC__::zcalloc(void*, unsigned int, unsigned int)'
easyzlib.c:1775: error: `opaque' was not declared in this scope
easyzlib.c:1775: error: `items' was not declared in this scope
easyzlib.c:1775: error: `size' was not declared in this scope
easyzlib.c:1776: error: initializer expression list treated as compound expression
easyzlib.c:1776: error: expected `,' or `;' before "voidpf"


[attachment deleted by admin]
#39
Has anyone ever got a decent lossless compression library working with GLB arrays?

I'm trying to reduce disk space used by large tile maps. For games that use procedural generation and create potentially very large worlds this is very useful for small devices.

I wrote a simple run-length encoding compression algorithm with sequence recognition. It works a little but is nowhere near as good as zip style compression. I figure, why re-invent the wheel? zlib is free and available, so maybe someone out there has already created a wrapper or whatnot.
#40
My first app PowFish won a prize in the recent WebOS App Hack competition: http://developer.palm.com/blog/2012/01/app-hack-winner-got-game/

Feels good. Not sure what else to say, so here is a picture of a cat drinking Tequila:-



(If the screenshot from the Palm blog looks odd know that its not like that on actual WebOS devices. Not sure what went wrong there but it weren't me, honest.)