Posted: 30th Nov 2019 1:39
integer GetErrorMode()
Returns the current Error mode as set by SetErrorMode()
Posted: 3rd Dec 2019 20:20
Are there any plans to include commands for Anisotropic filtering of textures in 3D?


I was really surprised that there was no option to enable it in AGK? Its been around for ages.

So, I decided to add the code into visual studio and recompile the AppGameKit player with anisotropic filtering in as an option (using setimageminfilter()) to see if it made much difference to the rendering.

LEFT (Standard linear filtering in AGK) RIGHT (Includes Anisotropic)





On high aspect surfaces (like int the hallway) it really does make a nice difference!

All the textures used in these screen grabs are the same size and quality....its just the texture filtering OpenGL is using thats changed.
Posted: 7th Dec 2019 7:28
In c++ you can catch an exception and deal with it
wondering how complex that would be to implement in Tier1
and if it would effect performance in anyway

Would be great if we could catch exceptions so we didn't just get that popup that quit program on errors
Posted: 7th Dec 2019 21:04
Would be great if we could catch exceptions so we didn't just get that popup that quit program on errors

You can SetErrorMode(0) and then use GetErrorOccurred() and GetLastError() to determine the actual error
Posted: 7th Dec 2019 23:00
Thanks blink I wasn't aware of that

so GetErrorOccurred() could be placed before sync()
to catch and deal with the error

I was sure I looked for commands like that before lol
Posted: 8th Dec 2019 0:14
It should prevent any popups. I have tested it with bad shaders and it doesn't show a popup
Posted: 8th Dec 2019 14:53
@Bengismo: Nice! I'm using Tier 1 at the moment, but I've been meaning to move to T2 so I'll definitely do it now for my next project.
Posted: 7th Jan 2020 11:05
I would like to be able to append a network message to another message. I am working on my own packet guarantee arrival system based on the UDP message so that my app can go through NAT. I am happy that the CopyMessage function is available, but I would like to make a header in the message, but some information that should be at the start of the message will only be available when I send the message.

EDIT: Nevermind, I can use memblock commands for a temporary message that is converted to a network message right before sending the message for the first time. The memblock commands are really fine for this!
Posted: 12th Jan 2020 21:32
please add Set/GetClipboardText() for HTML (was never included since 2018.08.30 addition of the commands).

and, what's the proper way to submit a request like this on the git? i add THIS but not sure if that's how to do it (but assume the request will be seen there where i'm unsure if this thread is regularly perused).
Posted: 31st Jan 2020 0:15
Can we have a single function that we could call at the top of our code please that would give us two options for overlapping sprite selections? The default current way now where you could trigger Get Sprite Hit checks if they are overlapping, and one setting that would ignore any touches of sprites if they are underneath another. Think of two overlapping buttons where pressing one also triggers the one below. That's the current way AppGameKit works. It would save having to add in extra checks for every sprite/button to make sure that you're pressing one sprite and no other.
Posted: 2nd Mar 2020 12:13
DEBUGGER REQUEST: When debugging and the app crashes in a function, it would be nice to be able to choose to see call stack for that function. I just had this happen, I had to set a breakpoint where the error was and I tried re-creating the incident but it turned out the function was called from a totally different place than I thought, but luckily it didn't matter in this scenario.
Posted: 7th Mar 2020 21:08
Yeah I can see where that would be useful it has happened to me quite a bit, in the end I had to make a log file so I can see what function was called before the issue.
Posted: 1st Apr 2020 5:12
Please allow an option to make app to run without OpenGL/headless mode.

This will allow 'server' app made in AppGameKit to be run in a normal server, without graphic card attachment, which is significantly cheaper.

Because of OpenGL mandatory requirement, server app made for online multiplayer game need an expensive hosting service that includes graphic cards.

If AppGameKit app (stripped of graphics) can be run without OpenGL/headless mode, this will allow a whole kind of online multiplayer game to be made without restriction using AGK.
The affordability will enable AppGameKit users to launch their games on affordable servers, which will increase AppGameKit use.
Posted: 1st Apr 2020 5:23
Please preserve the 'SetRawWritePath( str )' command. It's rather convenient,.
If used with 'GetReadPath()', this command is VERY useful to redirect the file write/save to to the game executable folder.
This means, we can put the game app to USB/ anywhere, and it will save the game files locally to that USB, and it makes the game transferrable/playable very easily.

Thank you for your considerations.


By the way, I want to thank AppGameKit Team for the 'Raw' files commands. Definitely useful, by allowing more control for user.
Posted: 8th May 2020 22:51
GetKeyboardHeight() or GetOnScreenKeyboardHeight(). I'd like a function to return the height of the keyboard on screen so that things can be centred appropriately in the remaining space. I want to add a dialog with text input to my OryUI framework as I can see that being useful so being able to centre the dialog correctly in the remaining space when the keyboard is visible.

I could guess and say just under 50% but getting the exact height would be better
Posted: 31st May 2020 23:58
I'm sure there would be much more suggestions the more I use the language, but having played with it for the last few days, here are some suggestions:

Better array initialization
Why bother doing:

+ Code Snippet
arr as integer[5]
arr[0] = 1
arr[1] = 2
arr[2] = 3
// etc...


Where you can do

+ Code Snippet
arr = [1, 2, 3, ...]


It can even be done in the syntactical analysis phase, just from looking at that you can tell it's an array and how big it is, no need for clutter. It shouldn't really be a hard change to do, and it would make the language look much nicer.

Optional Postfixes

When doing static analysis of the source code, the name prefix is not even needed to tell whether a variable is float, string or integer. If you are initializing it inline, then it would be simpler to just allow the user to define any value to the variable. This is not even consistent because you can get away this limitation by using `as`:

+ Code Snippet
myFloat# = 1.2 
// why can't this just be
myFloat = 1.2 // <- given the right hand side value you already know this is a float, why force the `#` convention

myFloat as float
myFloat = 1.2 // <- this works, so you can have variable names without # which are floats, so it's not even making things easier to understand


High Order Functions
Basically, allow to functions to return functions and allow functions to take other functions as arguments. This would make the language way more powerful and allow for many functional programming patterns to be implemented easily in AGK. Now this might be more tricky to implement. I wouldn't say this adds much complexity to the language as beginners would simply ignore this feature, but it's very powerful to have it.

Even if you can't make anonymous functions, at least allow us to take a function reference as parameter.

Default Arguments
Allow functions to have default values. This is not that important but it's a nice QoL improvement.

+ Code Snippet
Function Foo(name$ = "Mike")
  greet$ = "Hello " + name$
EndFunction greet

Foo() // "Hello Mike"
Foo("Another") "Hello Another"


Allow devs to choose which functions to export (or hide!) in each file
It would make things easier and not require so many prefixes to keep things organized. Not a big deal but still would be nice

Built-in Configurable Linter
With BASIC being such a permissive language, it would be nice to have some kind of linter which checks for consistency in our code.

Built-in Testing
It would be great to have a way to at least write some unit tests for our code. Nothing too fancy, just a simple runner and a few asserts would do. Having it integrated in the IDE would be awesome.
Posted: 2nd Jun 2020 19:34
Better array initialization


You can already declare arrays like that:

+ Code Snippet
global TestArray as integer[10] = [
        20,21,22,23,24,25,26,27,28,29]


'as'
Variable markers by type are pretty standard (sometimes with '.A' letter markers) and can help provide visual cues in languages where forced declarations are not required. I would not recommend changing this and if defining is desired, it's certainly possible now by declaring its type with 'as'. Best to adapt to any language nuances for types, so with AppGameKit, no marker for integers, '#' for floats, and '$' for strings. Only a few to keep track of there and pretty easy to manage.

High Order Functions
Again, you can do that kind of thing now:

+ Code Snippet
operator1(0,1,operator2(3))


function operator1(a,b,c)
endfunction a

function operator2(e)
endfunction e


If that isn't what you are referring to, maybe you could detail what kind of thing you are trying to accomplish. That is, what specific capabilities this would open that aren't already available.

Default Arguments
Just put the default value in the function and check for any swapping/changing that may be needed. You can even specify global or local. There is no need or benefit to follow a particular format aside from personal syntax preference.

Sounds like AppGameKit already provides most of what you're looking for, just a matter of technique and method.
Posted: 12th Jun 2020 18:23
You can already declare arrays like...


Thanks SFSW, I noticed that a few days after I posted. That surely helps, but still, doesn't help when you want to do:

+ Code Snippet
SomeFunction([1, 2, 3])
// Instead, you have to do
dim foo[3] as integer = [1, 2, 3]
SomeFunction(foo)


Which is not the end of the world, but programmer happiness is important to me This is not really an urgent issue though, I think the most urgent would be default arguments.

As you've said, sure, you can assign default values in your function by defining them at the top one by one, but one line per value can clutter up the code easily, where you could easily do it in the function header/signature with minimal effort. KevinCross in the Discord shared this code:

+ Code Snippet
type style
  size as integer
  colour as integer[4]
  icon as integer
endtype

uiStyle as style[]
uiStyle.size = 3
uiStyle.colour[1] = 255
uiStyle.colour[2] = 255
uiStyle.colour[3] = 0
uiStyle.colour[4] = 255
uiStyle.icon = imgAddIcon

CreateUIElement(uiStyle)

function CreateUIElement(uiStyle ref as style)
// Create the element
endfunction


That could be much easier with default arguments:

+ Code Snippet
CreateUIElement(size=3, colour=[255, 255, 0, 255], icon=imgAddIcon)

function CreateUIElement(size= 3, colour= [0, 0, 0, 255], icon=noImage)
// Create the element
endfunction


High Order Functions
What you used there is function composition, high order functions is basically passing functions around as if they were any other value. It would look something like this:

+ Code Snippet
type person
  name as string
  age as integer
endtype


function findByName(collection as person[], name as string, callback ref as function) {
  for i = 0 to collection.length
    // here I just call the given function
    if collection[i].name = name then callback(collection[i])
  endfor
endfunction

// Usage
function greet(person)
  Log("Hello, " + person.name)
endfunction

dim people[3] as person = ... // assume there is one person in the array with name "Mike"
findByName(people, 'Mike', greet) // this will print "Hello, Mike" -- note that if this doesn't match, the function never gets called, which is what you want


This is particularly useful if you have a way to define anonymous functions, that is, functions without a name, defined in-place.

I know that this feature might be too much for a dialect of BASIC though so it's unlikely we'll see it. It requires a lot of work on the type system for it to work. But it's pretty cool and it allows for a whole new way of programming. Just giving my 2cents

All in all, I think default arguments is the most urgent feature the language could use. Followed by more expressive literals.
Posted: 13th Jun 2020 17:20
Thanks SFSW, I noticed that a few days after I posted. That surely helps, but still, doesn't help when you want to do:


Yes, that would indeed come down to preference. I would personally prefer shorter individual lines aligned vertically for easier visual distinction, rather than multiple type elements containing multiple values all crammed into long lines and displaced horizontally (consider you have 9 elements with separate stop/start points all in a single line in your example). Using more dedicated lines with vertical alignment not only helps with faster visual cueing, but can also aid in error reporting when individual lines containing specific values/commands can be pinned down much more specifically. But that kind of thing does certainly come down to preference.

You can kind of do what you're after, but imo, you'd give up some precision in error reporting and lose some visual distinction/alignment in the process.

What you used there is function composition, high order functions is basically passing functions around as if they were any other value. It would look something like this:


Ah ok, I'll need to think on that one for a while. Not quite sure yet what the benefits of an approach like that might be over others. There should currently be a couple of different ways to achieve the same thing, perhaps even easier in some regards. But I'll ponder what advantages that specific approach might have over other methods currently available in AppGameKit using its existing string search, type, and function capabilities with minimal layers and interdependencies.

I know that this feature might be too much for a dialect of BASIC though so it's unlikely we'll see it. It requires a lot of work on the type system for it to work. But it's pretty cool and it allows for a whole new way of programming. Just giving my 2cents


It's an interesting line of discussion. I enjoy exchanging and exploring ideas like that as it can help discover new techniques and options. Another possibility for you might be to utilize Tier2 as that may align better with your objectives and methods.
Posted: 13th Jun 2020 22:39
To me, more expressive power is always better. Being able to do something with less code not only producess less bugs (less code = less bugs), but also write code faster. Of course, balancing those features with making the language easy to learn is always tricky. In the case of default arguements though I wouldn't say it makes it harder to learn, considering 99% of popular programming languages out there implement those.

(consider you have 9 elements with separate stop/start points all in a single line in your example).

Funny, this is the first time I see someone argue against default attributes May I ask what other languages besides AppGameKit do you use?

Anyways, I agree the list can get long, but:
a) A long argument list will suck be it with default arguments or not
b) The language already supports 9 elements argument lists
c) A function with so many arguments means there's something wrong with the program's design, meaning there's an object/type hiding in there, so you can refactor the arguments into one or more types and just pass that instead

Using more dedicated lines with vertical alignment not only helps with faster visual cueing, but can also aid in error reporting when individual lines containing specific values/commands can be pinned down much more specifically.

Also manually writing more code has a chance to introduce more bugs, and clutter the program with irrelevant, repetitive data, which ends up making it harder to read, especially when reading other person's code.


Not quite sure yet what the benefits of an approach like that might be over others. There should currently be a couple of different ways to achieve the same thing, perhaps even easier in some regards. But I'll ponder what advantages that specific approach might have over other methods currently available in AppGameKit using its existing string search, type, and function capabilities with minimal layers and interdependencies.


Basically you get most benefits of functional programming! You can write code which is easy to test, extend, reuse, and decoupled from the rest of the logic.

A classic example:

+ Code Snippet
type person
  name as string
  age as integer
endtype
 
function greet(person)
  Log("Hello, " + person.name)
endfunction
 
dim people[3] as person = ... // an array of person types

// Now, the previous example was able to just find by name. What if I want to find by age instead?
// I instead receive a filter function and call that to test each element in the array
function find(collection as person[], filter ref as function, callback ref as function) {
  for i = 0 to collection.length
    // here I just call the given function
    if filter(collection[i]) then callback(collection[i])
  next i
endfunction

// Now I can write as many filters as I want
function byName(name as string) // this function takes one argument, a name, and returns another function
  function filter(person as person) // this other function takes a person, and compares the name, returning 1 if it maches, 0 otherwise
      result = 0
     if person.name = name then result = 1
  endfunction
endfunction filter // here I return the filter function, so it's important to be able to take functions as arguments and return them from functions as well

function byAge(age as integer) // similar as above, comparing age instead
  function filter(person as person)
      result = 0
     if person.age = age then result = 1
  endfunction
endfunction filter

function olderThan(age as integer) // just one more example
  function filter(person as person)
      result = 0
     if person.age > age then result = 1
  endfunction
endfunction filter

// Now because my functions are so generic, I can make a lot of filters (on the fly!) and save up a lot of code
find(people, byName('Mike'), greet) // find by name
find(people, byAge(18), greet) // find by age
find(people, olderThan(21), greet) // older than

// alternative syntax
namedMike = byName('Mike')
find(people, namedMike, greet)


The benefit of that approach is that any filter function will work with any of my filters, so if your system is designed that way, you can reuse a lot of code. An example of this in real apps is JavaScript's filter, just to name a few.

Also, you can write callback-oriented code which is great for user interfaces, although it's known it can lead to callback hell, that is just bad code and it can be easily managed with proper refactoring.

Now, I know there's no way this is comming to AppGameKit but just wanted to show you how functional programming can make some crazy generic things and reduce interdependencies in your code

Another possibility for you might be to utilize Tier2 as that may align better with your objectives and methods.


Yeah, Tier 2 seems like the way to go for "advanced" usage, but I'm just not a C/C++ guy. Anyways, it's good to know there's that option if everything else fails