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 Studio Chat / [LOCKED] A few useful tools to get us started

User Banned
Posted: 16th Aug 2023 18:01 Edited at: 20th Aug 2023 11:55
Here are some useful commands that maybe of interest, all written from memory so hope they work


Polar coordinates
Getting a point in 2D space depending on an angle and distance from the origin 0,0


Returns the fractional component eg



An interpolation between two numbers
Time# should be between 0 and 1 so .5 is half way for example, so 0 is the start and 1 is the end.


A smoother approach to Lerp, returns values on a curve style between two numbers.

Keeps a value clamped to a lower limit or upper limit.


Remaps a number from one range to another

map ( 50, 0, 100, 0, 500 )

will return 250 cause 50 in the range 0-100 is exactly half, So it must return exactly half of 0 to 500 which is 250


Normalize 2d or 3d vectors

Returns a type of x and y or z values into a vector type.


Calculates the distance between 2 or 3 points

Min and Max

Returns the largest number in a sequence of numbers or two individual numbers.

Mean and median averages

Get the average of all numbers added then divided by the amount of numbers in the array

Get object in screen

Marching cubes

To do and coming soon

noise 2D

noise 3D

Mesh memblocks

Adding vertexes to create an object.

You can have as much as you need on a mesh, say you wish to apply thousands of objects to the mesh it will only provide 1 drawcall to the GPU but if you did those thousand objects individually then it will be thousand drawcalls per sync. Just remember that concept to decide is a mesh suitable for your app. Having physics to your objects will be complicated so this may not suit that requirement, but maybe good for static 3D worlds and place removable objects as different entities of the mesh to help with FPS and good for big world apps


A UV coordinates apply for texturing a triangle.
The image to use can be as small or big as you need, but only normalized between 0 and 1.

The following applies to a texture image

X = 0, Y = 0 or 0,0 is top left corner
X = 1 , Y = 0 or 1, 0 is top right corner

X = 0, Y = 1 or 0,1 is bottom left corner
X = 0, Y = 1 or 0,1 is bottom right corner

If you wish to use multiple areas of the texture to apply to different object faces inside 1 texture.

Like 4 textures in one image then think of it as a 4x4 grid each occupying exactly half top and bottom then the cords will be

First quadrant - top keft square
0,0 to .5 , .5

Second quadrant - top right square
0, .5 to 1, .5

Third quadrant - bottom left square
0, .5 to .5, 1

Forth quadrant - bottom right square
.5, .5 to 1, 1

If that makes any sense

This will do for now, I'm working on image manipulation like merging and blurring.

Merging two images together


Blurring with likes of mean, median, gaussian, motion which uses a convolution and these matrices which scans through the images applying the values in them to produce the blurring.

I'll add more as and when I think if any that may help achieve our programming problems

That's all for now to keep us going for a while and hope they are useful and indeed work as I dont have AGk at moment
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 17th Aug 2023 22:21 Edited at: 17th Aug 2023 22:22
There's already a thread for useful functions in the Newcomer's AppGameKit Corner which is quite extensive and always worth a look:

Useful Functions

Coders don't die, they just gosub without return
User Banned
Posted: 20th Aug 2023 10:47
Thanks for that, I've checked and last post was made in 2018 for that thread or I beleive was that thread

I would like to keep my codings with me on my own threads so can quickly get to in preparation to when I start coding properly in few months time

thanks for that info though

Virtual Nomad
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 20th Aug 2023 15:01 Edited at: 20th Aug 2023 15:12
Quote: "I would like to keep my codings with me on my own threads"

the problem with your wanting your own reference thread is, imagine each of us doing the same thing and the forum is full of them.

perhaps start a github repository for such things; maybe call it Puzzler's Code from Memory.

which is another problem. you're posting from memory and hoping the code works while the other, similar threads are stickied and included here for a reason while you, apparently, intend to continue adding to and bumping this, (in effect, stickying). those contain all tested code from multiple members of the community regardless of the last post date.

3rd, those threads are solid reference while they can be a bear to contend with as some are unorganized, like this one and fubarpk's collection.

so, a reference thread of random, "might work" code is really not a "A few useful tools" to get anyone "started".
User Banned
Posted: 20th Aug 2023 15:14
Thanks virtual nomad,

I shall wait till I get my hands on AGk to make sure things are tested and then peruse your thread for any potential duplications and if not then share on

Is that ok with you

I'm running before I can walk
Virtual Nomad
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 20th Aug 2023 15:31
Quote: "I'm running before I can walk"


and, when you do get up and running, note what i consider currently an under-utilized feature of the forum which is Code Snippets.

for the most part, they are clearly labelled, easy to find/search and "filter". it's why i carry my own in my sig (to promote CS usage).

otherwise, i'm glad you understand.

Login to post a reply

Server time is: 2023-12-04 20:56:42
Your offset time is: 2023-12-04 20:56:42