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 / AGK's 3 biggest problems (in my opinion)

Author
Message
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 29th Nov 2012 03:57 Edited at: 7th Dec 2012 04:49
From my perspective, the 3 biggest problems in agk v1.08 are:
1. Cant end from a function or gosub (EXTREMLY annoying, I have a program that uses a gosub for the main loop, but I can't exit the app from the loop any more
2. cannot collapse code in the IDE (it's annoying when you have to search throught 500 lines of code, or more.
3. large compile times

no.2 and no.3 aren't so bad, I can live with them, but no.1 takes a huge amount of rewriting code

What are your 3 biggest problems?

There are 10 types of people, those who understand binary and those who don't
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 29th Nov 2012 09:00
Do remember that v108 is currently a beta version which means it's still a work in progress, not an official release. Bugs are to be expected in beta versions. I'm sure the TGC team will get around to fixing those bugs.

You can report bugs here, just do a quick search to see that no-one else has posted the same bug so the AppGameKit CT team and TGC team don't have to deal with duplicates.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 29th Nov 2012 12:48
T2 users don't have any of those problems
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Nov 2012 15:56
Quote: "T2 users don't have any of those problems"

T2 users for v108<x> don't have these problems because T2 doesn't work in v1082, v1083. I hear a successful T2 was done for v1084 (and I'll try later).

Cheers,
Ancient Lady
AGK Community Tester
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 29th Nov 2012 18:57 Edited at: 29th Nov 2012 19:01
Quote: "1. Cant end from a function or gosub"

I may be behind the times, it may be the way people are taught programming these days, but I would never consider using an end in a function or subroutine.

It just doesn't sit right with my Assembly language origins - You're leaving the return stack loaded, that can't be good.

Back in the days of the Ark, a program started at one place and stopped at one place - everything else was a journey.

We had flow charts and everything

And we always wrote the full documentation before starting a single line of code. Yeah right - I'll admit that aspect of "traditional" programming was rarely followed where I worked

Now everyone has a computer on their phone and suddenly it's ok to have fifty end statements in your code - "garbage collection will pick it up" they say.

"Bah humbug" I say

edit (to prevent flaming);
</END HUMOUR>
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 29th Nov 2012 19:03
1084 works fine on T2.

I presume 1082 and 1083 had the same problem, missing .lib links in the interpreter project, which we now know what are!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Nov 2012 21:33
bjadams, I just installed v1084. I'll try T2 tomorrow.

Cheers,
Ancient Lady
AGK Community Tester
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 29th Nov 2012 21:47
Quote: "It just doesn't sit right with my Assembly language origins - You're leaving the return stack loaded, that can't be good."

You might get away with it in tier 1 because it runs on a VM so it's up to the VM to free all of the memory it uses, including its internal call stack. But I do agree with you, especially with languages like C. I did a little assembly programming at uni this semester and I have a new appreciation for languages like C now.

=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 29th Nov 2012 23:11
I'm with Marl on the 1st point, I only ever End from the main source, after I have deleted all the media etc. (I know this isn't strictly nessecary in AppGameKit, but old habits die hard)

I tend to break my code into multiple sources, divided by functionality; so it's usually just a simple Ctrl-f (or sometimes ctrl-g) to find the bit I'm after.

Don't get me wrong. The AppGameKit tier 1 editor isn't awesome and there is scope for improvement, but I think intellisense would be a more important addition.

And I have never had any issues with compile times, on any of my PC's. The oldest being a Turion x2 64bit with 2Gb of ram. Certainly speedier than VS2010 is on my old Inspiron

The biggest problems I have with AppGameKit are...

1) My inability to convert my existing DirectX and DBO models to .Obj (Although possibly a problem with me, not AGK)

2) Lack of intellisense/code auto completion (Or maybe VS2010 has spoiled me a little )

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 29th Nov 2012 23:15
What, exactly, is the End call meant to do?

If it means total the app right now, then it's probably better removed from language entirely!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 29th Nov 2012 23:21
Quote: "What, exactly, is the End call meant to do?

If it means total the app right now, then it's probably better removed from language entirely!"

The END command shuts down AppGameKit and is supposed to destroy all loaded media, release all allocated memory, and generally clean up after itself. It's not like the abort() function in C/C++, more like Win32's PostQuitMessage()[yes I'm aware that doesn't do anything with the application's manual memory allocations].

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 29th Nov 2012 23:32
Why would you want to do that inside a function call? Surely if it's game-over time you exit the main loop and fall through to the clean-up and end functions? It's not very good practice to bomb the program unless it's a serious fail condition.

Delphi has these two equivalents:

Application.Terminate;
Halt(0);

The first will roll everything back. The second is a direct Windows call which will simply zap the event. I use both in some units, but only under catastrophic circumstances.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 29th Nov 2012 23:34 Edited at: 29th Nov 2012 23:42
Issue 1) Can't exit within a function.

Then don't, produce an output then check for that output in the main program loop.

Do

If EndProg() = 1 then End

Sync()
Loop

Function EndProg()
output = 1
EndFunction output

Issue 2) Can't collapse code, makes it hard to find stuff.

Use mutliple source code files. That's all I do, AI_Functions.agc, Phy_Functions.agc, main.agc, etc etc.

500 lines of code to search through is nothing if you organise yourself properly, none of my projects are less than 1000 lines of code these days and I have no problems finding anything. If I really need to find a function quick then I press Control + F and type in the function name, or I add a bookmark to common functions.

Control + B adds a bookmark then it's Alt + PageUp or Alt + PageDown to find them

Issue 3)Long time to compile.

I'm compiling a 2,000 line program here, only takes few seconds. I am using a Quad Core 3.0Ghz processor.

The largest project I've produced to date is about 8,500 lines this compiles quickly as well, within 25 seconds.
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 29th Nov 2012 23:48
The Problem with can't end in a function or gosub is that my may loop IS in a gosub or function:

gosub loadmedia
gosub main

main:

return
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 29th Nov 2012 23:53 Edited at: 29th Nov 2012 23:58
I wouldn't ever program something in that way. I tend to design my loops using the following rough pseudo-code.

Type system_type
mode as integer
EndType

Global system as system_type

Pre-GameStuff()

Do

Select system.mode

Case 0 //Menu mode

ShowButtons()
If CheckExit() = 1 then End
If PlayGame() = 1 then system.mode = 1

EndCase

Case 1 //Game Mode

//The game code here

EndCase

Case 2 //Post-game cleanup

//End Game, clear graphics, update score tablem, set system.mode = 0 for menu return

EndCase

EndSelect

Sync()
Loop

This method allows me to add as many or as few "game modes" as I want to add to the program, each stage controlled simpy by updating the value system.mode
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 29th Nov 2012 23:57
Quote: "The Problem with can't end in a function or gosub is that my may loop IS in a gosub or function:"

Modifying Daniel's code:


Just remember that in this snippet, EndProg() is always 1. It's probably easier to use a global flag.

easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 29th Nov 2012 23:58
Whoops, sorry about that post, I pressed TAB to indent and it selected Post Message, then I pressed space

Carrying on (psuedo code):

gosub loadmedia
gosub main

main:
do
if selected startgame
gosub closemainmedia
gosub game
endif
if selected quit
END
endif
loop
return

closemainmedia:
DeleteSprites
DeleteTexts
return

I hope you can see from that how I program
The problem is after you finished playing the game and go back to the menu, when you press quit, it end, but instead of ending, it goes back to the game, and because it's deleted all the sprites from the game, It comes up with an error (like Sprite 10011 doesn't exists at line 179 in play.agc)

If I put the menu loop in the main code, then how am I supposed to get back to the menu after I call the game, I could just get the game the exit the loop and return, But since the menu deleted all it's sprites when it called the game, it will come up with an error!
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Nov 2012 00:00
When I said 'sorry about that post', the reason it isn't (or wasn't) there is because I'm a new user and It needs to be authorised by a Mod, by I can now post without a Mod so the second one came up first!
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Nov 2012 00:01
Whoops again, I'm getting really confused?
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Nov 2012 00:04 Edited at: 30th Nov 2012 00:09
Don't worry about your posts, most people get confused about the post approval system when just joining the forums.

Edit: - Scratch my idea. I've been programming in C++ for too long, AppGameKit might not like the idea of multiple returns in a subroutine.

Edit 2: Ok, it seems to work . This works in v1076 (I haven't tried in AppGameKit 108).



easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Nov 2012 00:07
The main problem is that after i've called a different sub, when I exit the menu loop, It doesn't go back to the main code and end, It goes back to the game loop and causes an error (because I've deleted the sprites).
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 30th Nov 2012 00:07 Edited at: 30th Nov 2012 00:12
@hodgy

It was just a way of triggering the END command without being within the function itself.

@MissJoJo

My structure breaks the main.agc file into a kind of rough psuedo code, each function is called 1 by 1 and each function has the chance to quit the game if you need it too.

By globalling your assets they are instantly accessible from all parts of your program so you won't get any sprite errors.

It's all about assigning your sprites to globals and types for easier reference, and running your program in stages. This allows you to easily swap out parts, and even better when you program your next game it's easy to port over functions. Sometimes it gets to the point where I've produced so many programs using my library of functions I can't remember how I made the functions work in the first place lol.

Modified version

Type media_type

img_loading as integer
img_menu as integer
mus_music as integer
aud_sound as integer

EndType

Type Sprite_Type

player as integer
pnemy as integer
RandomBox as integer
BlokeNamedJoe as integer
A_Foot_Stool as integer

EndType

Global media as media_type
Global spr as sprite_type
Global Endflag as Integer

loadmedia()

Do

Select system.mode

Case 0

Menu()

EndCase

Case 1

Game()

EndCase

Case 2

PostGame()

EndCase

EndSelect

If

Sync()
Loop
return

Function loadmedia()

spr.player = CreateSprite( LoadImage( "player.png" ) )
spr.enemy = CreateSprite( LoadImage( "enemy.png" ) )

EndFunction
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 30th Nov 2012 00:16 Edited at: 30th Nov 2012 00:18
I often create functions like.

CreateButtons()

CreatePlayerObjects()

CreateEnemyes()

And

DeleteButtons()
DeletePlayerObjects()
DeleteEnemies()

This means I never run into a problem were a sprite doesn't exist. Because I know before that sprite is needed I'm just a CreateSomething() away from it.

It's all about program flow at the end of the day, and there's no reason you should ever be in a position where your program is calling assets that don't exist, and by globaling them under static names you don't need to worry about specific identity numbers of objects.
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Nov 2012 00:18
I'll try this and see if I can get it to work
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Nov 2012 00:25
The only problem is that the program that I am currently working on is 4500 lines of code in 20 files.
I have 182 gosub calls and I'll have to go through every one of them, I'll have a long day today
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Nov 2012 00:33
Make sure you back up your code before making the changes. I've made major structural changes to code without making a back up and when it failed, I had to start all over. Don't make my mistake.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 30th Nov 2012 00:37
Daniel - If what?



Frankly, I find all of this confusing. It's a whole lot cleaner and easier in the Pascal implementation, where the main loop is actually hidden. Want to get out? Call the Shutdown method. How hard is that???

Surely, the main loop should be conditional:

while not TheEnd
do
...
loop

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Nov 2012 00:38 Edited at: 30th Nov 2012 01:00
Actually, I already made that mistake once (and only once), with an FPS I made in Dark Basic, I reprogrammed it to make it more modular, but forgot to back it up and I wrecked the whole project.

There are 10 types of people, those who understand binary and those who don't
gbison
13
Years of Service
User Offline
Joined: 15th Dec 2010
Location: USA
Posted: 30th Nov 2012 01:21
Quote: "I often create functions like.

CreateButtons()

CreatePlayerObjects()

CreateEnemyes()

And

DeleteButtons()
DeletePlayerObjects()
DeleteEnemies()"


I have to side with Daniel here. I write code in a much similar fashion even catching myself writing a function for even the most mundane of tasks. Using the state machine style code in the main loop is a very clean mechanism for accessing various areas of your code/program. A simple flip of a switch all in a simple managment location.

"The greatest trick the devil ever pulled, was to convince the world he didn't exist."
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 30th Nov 2012 02:19 Edited at: 30th Nov 2012 02:24
@ Daniel TGC
THANKYOU SO MUCH FOR THIS!!!! (the code you posted)
I would never have figured out to code it that way.
It works great (well, the parts I've managed to rewrite in the past half hour.) Fortunatly, It won't take as long as I thought it would, I can just use Ctrl-Shift-R To Replace in files, Then select Multi-line thingie, And get it to replace 'Gosub Menu' with:
playmode = scrmenu
exit
`gosub menu
(I created constants for each screen, scrmenu = 1)
It then goes back to the main loop, does the select on playmode, and gosubs menu
Works like a charm.
Of course I still have to go though every single screen, But this way I can kill 10 birds with one stone
Also, there are *only* 28 screens, even though I have 182 gosubs, a lot of them aren't screens, they are just things like 'checkwin' and the like, which I don't have to replace. *Relief*

There are 10 types of people, those who understand binary and those who don't
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 30th Nov 2012 09:25 Edited at: 30th Nov 2012 09:28
@gbison

Yeah, I love functions I can't honestly remember the last time I used a subroutine. I love them so much so that I port a functions.agc file between my projects, it's like a whole set of custom AppGameKit commands ready to use. I honestly don't even remember how or why some of them work anymore, they've just been there for months and they do lol.

Even worse I maintain a Word Document with everything listed alphabetically, and again in categories along with the globals and types they require to work. It's a pain in the bum at first, but over the last six months I've saved myself so much time it's crazy. It's getting to the point where I can build many simple retro and platform style games within a few hours just using these functions.

@MissJoJo

You are most welcome. If you see me in real life just by me a half pint and we'll call it even

Good luck with your game.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 30th Nov 2012 09:49 Edited at: 30th Nov 2012 09:49
MissJoJo, to "fix" your original pseudo code, I think this will do:

gosub loadmedia
gosub main
END // This exit the app, after return from main

main:
do
if selected startgame
gosub closemainmedia
gosub game
endif
if selected quit
exit // This exits the do loop, and executes the return statement
endif
loop
return

closemainmedia:
DeleteSprites
DeleteTexts
return

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 30th Nov 2012 17:40
I'll try to get over my hatred of using GoSub, but when using MissJoJo's example, why gosub to the main loop at all??



I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
gbison
13
Years of Service
User Offline
Joined: 15th Dec 2010
Location: USA
Posted: 30th Nov 2012 17:49 Edited at: 30th Nov 2012 18:12
Quote: "Even worse I maintain a Word Document with everything listed alphabetically, and again in categories along with the globals and types they require to work. It's a pain in the bum at first, but over the last six months I've saved myself so much time it's crazy. It's getting to the point where I can build many simple retro and platform style games within a few hours just using these functions."


Not to derail this thread but I so know how you feel . We have become so keyed on certain things when we look at a language we immediately start pilfering the API for methods/functions that allow us to do what we want so we know right off what we are going to have to build. When we decided to adopt the AppGameKit language going into the mobile market we had a plethora of functions from previous languages we immediately went to work converting, our own little mini API if you will.

We have already constructed a production engine for our mobile shooter platform design that will skin up about 4 shooter games by Spring/Summer on the Android/iPhone. We have a match 3 casual release coming out on the major portals this month (BFG, iWIN, GameHouse, I-Play) albeit not created with AppGameKit or DBP but the same function set was used. We are considering a possible match 3 title with AppGameKit but like to use tile-maps for that. Any hope for some tile-map functionality within AppGameKit in the future?

"The greatest trick the devil ever pulled, was to convince the world he didn't exist."
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th Nov 2012 18:23
We are planning to work on the IDE/compiler soon, so hang in there!

Quote: "Any hope for some tile-map functionality within AppGameKit in the future?"


Can you email me what kind of tile map functionality you have in mind? I can't promise anything in the near future but it'll be good to have in my mind what people need AppGameKit to do to make things easier.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Nov 2012 18:59
When you work on the compiler, please don't forget to add the 'Clean' or 'Rebuild' option (I do believe you have accepted this mod request from the google list).

Cheers,
Ancient Lady
AGK Community Tester
gbison
13
Years of Service
User Offline
Joined: 15th Dec 2010
Location: USA
Posted: 30th Nov 2012 19:44
Quote: "We are planning to work on the IDE/compiler soon, so hang in there!"


If you ask me, this is the single most important thing for AppGameKit right now.

@Paul
Yes sir, I can be explicit as well as give ideas for the methods and class that encapsulate it.

Quote: "When you work on the compiler, please don't forget to add the 'Clean' or 'Rebuild' option (I do believe you have accepted this mod request from the google list).
"

+1

"The greatest trick the devil ever pulled, was to convince the world he didn't exist."
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 30th Nov 2012 19:52
@Paul how about AppGameKit supporting the SPRITER animation format out of the box?

AGK is now becoming a solid 2D toolkit, so it makes sense that it supports the best 2d animation tool
Alien Menace
AGK Developer
19
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 1st Dec 2012 05:03
I can't recall the last time I used gosub. I strictly use functions.

I agree with native Spriter support.

I'd still really like to see FOREACH commands added. This is such a sweet ways to keep track of enemies/bullets/etc. works great in GLBasic. With all it's flaws, I would still prefer to use GLB to write an arcade game over AppGameKit any day because the of these commands alone. Far superior to the tedium required to get the same results in AGK. Wish TGC would take a serious look at this.

Apps published: 3
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Dec 2012 08:46
I'm all for native Spriter support. Even though I now have a working animation system it would take a larger burden of support to finish and release my system officially.


this.mess = abs(sin(times#))
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 1st Dec 2012 09:11
Baxslash, since Spriter provide a C++ toolkit, I think this would be easy to integrate with AppGameKit & the sprite system, internally.

For those who do not want to buy Spriter (there is a free version too), maybe TGC can sell your system as an alternative.

I already use Spriter with another toolkit and it's GREAT. Would really love to have the same options in AppGameKit one day.
Davee
13
Years of Service
User Offline
Joined: 6th Sep 2011
Location: North West of England
Posted: 1st Dec 2012 12:03 Edited at: 1st Dec 2012 12:11
Quote: "I can't recall the last time I used gosub. I strictly use functions.
"
Just to add my tuppence, having used (Microsoft) Visual Basic 6 for 12 years in the past, I NEVER EVER used the GOSUB or GOTO command. It was considered bad programming practice, even 15 years ago.

The rules for using the GOSUB in VB6 are :

* The destination of a GoSub statement must be a line label or line number that resides within the same Sub or Function procedure as the statement that issues the GoSub (i.e., you cannot "GoSub" to a line in a Sub or Function other than the one you are currently in). In effect, using GoSub lets you have "subs within a sub" (with the exception that you cannot pass parameters to a "GoSubbed" routine).

* If a line label is used, the name of that line label must follow the same rules as that for naming a variable. The line label must begin in the first column of the line and must be followed by a colon":".

* If a line number is used, it must begin in the first column of the line.

* Once the destination of the GoSub is reached, a Return statement will return control to the statement after the one that issued the GoSub.

As the first point says a GOSUB should only be used within a function, if at all.

Functions is the way to go, and as mentioned previously definitely multiple code files.

If you need to call a number of functions at certain points then put them in a function (with a meaningful name) and call that function.

IMHO

Of all the things I've lost, it's my... my... oh darn it.

Login to post a reply

Server time is: 2024-11-24 03:52:53
Your offset time is: 2024-11-24 03:52:53