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 / maybe a DataBlock Statement / Command for AGK?

Author
Message
IronGiant
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 27th Feb 2012
Location: the great state of madness
Posted: 27th Sep 2014 19:14 Edited at: 27th Sep 2014 19:43
Ok, was on John Stablers post about sound commands and I suggested Read Restore and Data statements would be nice to have also in AGK.

And while thinkin about it I came up with what I think would be a good command to have and that would be a DataBlock type command.

As in you would have DataBlock Mydata=[50 60 70 90] as the way of starting the array like data block. the name of the Array being Mydata in this example.

The data after the Block name in between the brackets would be stored in memory by the AppGameKit compiler and the declaring of data would span many editor / main code file lines. The compiler would ignore all spaces in the data block.





This way you could add many lines of data on different editor lines and use numbers instead of having to set up a String array and convert its data into integer numbers. And you would access its array data just like any other array as in print(Mydata[2]) and Print(MyData[7])

which would be the number 34 and the number 46.


And for map data? would be like this...



It's Bird! , It's Plane!, No its a rocket powered Squirrel holding some acorns and a smile!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Sep 2014 19:30
I think array declarations would cover you for these scenarios?

dim MyData [ 4 ] as integer = [ 50,60,70,90]

IronGiant
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 27th Feb 2012
Location: the great state of madness
Posted: 28th Sep 2014 20:35 Edited at: 28th Sep 2014 20:51
Sorry Bat but AppGameKit does not allow more that one line of data to assign data with , as far as I know. And if it does, I'm sure its more painful than a simple block of data code would be.

The Compiler in AppGameKit would just ignore any extra blank spaces and use one space as data separators. very simple concept.

This is the only language I have that does not allow typed in mass data storage. just because this is 2014 doesnt mean Read , Data and Restore are not still being used, its just not used in AppGameKit because we cant, cant even assign a memory block any mass amounts of data without using a loop and an external file containing the data unless its in string format.

Look at any basic code with data statements in it, you'll find most use more than one line.

So yes, I think a block of data command or statement, or the ability to put more data to an array than just one line would be most useful.

Right now I'm stuck using Purebasic to put data statements in its code, then saving that as a file to load back in with AppGameKit, I should not have to do this.

And if the block statement put the data in memory for you without using a for/next loop , would save memory and time!

Thats how Action, an old language made for Atari 8 bit computers did it. and I see no reason AppGameKit cant be made to do the same.

It's Bird! , It's Plane!, No its a rocket powered Squirrel holding some acorns and a smile!
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 28th Sep 2014 23:24
Why are you doing that in code and not with an editor? Or read it from an external file?

IronGiant
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 27th Feb 2012
Location: the great state of madness
Posted: 28th Sep 2014 23:39 Edited at: 28th Sep 2014 23:46
So I'm to assume that AppGameKit programmers are the only ones that have never used Read , Data and Restore Statements in other languages? I find that hard to believe, being they are used alot in Purebasic and Blitzbasic and just about any other language I have used, hell even Assembly languages have data like statements to store large blocks in numbers/data. Lets say I want to store a 768 byte set of Palette numbers within my code, in AppGameKit, there is no easy way to do this, or coordinates for sprite starting locations, or any number or examples, want to see some examples? just go to Purebasic or Blitzbasic's sites, they are all over the place.

This isnt that hard of a subject to understand, I would think you people would be all for this as it is a standard feature of mostly all languages, except AppGameKit! I like AppGameKit, and Pauls doing a great job of updating it right now, I just thought this would be a nice feature to have. And Sure I have my palette in a file , that I made using Purebasic, I had too as I said, AppGameKit wont let me do this in an easy manner.

Hell if it was like this ...


and the AppGameKit compiler could allow multiple lines of data without bitchin and giving errors then I'd be a happy camper.

And this way is way better than even Read and Restore because the data is already put in the array for you.

It's Bird! , It's Plane!, No its a rocket powered Squirrel holding some acorns and a smile!
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 29th Sep 2014 00:13
I have not hard coded numbers like that in like 20 years, I have no need for it.

IronGiant
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 27th Feb 2012
Location: the great state of madness
Posted: 29th Sep 2014 02:23 Edited at: 29th Sep 2014 03:07
Well you have to get the numbers into a file somehow, either with a map editor, a sprite editor, a Mesh editor , text editor and so on. So for me, when I need a large group of numbers of my own design, to use in an AppGameKit project, in lets say a sprite editor for AppGameKit , so I can design shapes while out and about on my Sony 800 phone I have to put all these numbers into data statements in Purebasic, read them out , and then save them to a file , lets say the files named palette.dat

Then put that file in the AppGameKit project folder of my choosing, then load it, hope like hell I got all the number correct, then if not, click Purebasic's editor, hunt down the offending number, correct my error, re-save and so on. these numbers dont magically appear in a file and write themselves, they come from somewhere, be nice if that somewhere was inside the AppGameKit editor and would not even be that hard to implement. just a variation of the

dim map as integer=[0 1 2 3 4 5 6 7 8] .. but it could also seek the next numbers on the next editor line , just a matter of the compiler to loop till it hits the next comma or number on the next editor or source code line, then put those following numbers in the array starting at the end of the first group and so on..

just as I stated, thought it would be a nice built in feature, and trust me,. just because you dont hard code numbers into your programs, does not mean others do not.

As I also stated, look up code from all over the net and I'm sure you'll find loads of Data statements or Data blocks,

And if the new statement/command was a Data block as in my examples above, then the AppGameKit compiler would probably also put these numbers in ram for you, just like a regular
Dim Map As Integer=[0,1,4,5,78] does .

No need for even looping, you'd just print(map[2]) and get the number 4 as a result.

Either one would be good to have. either Read and Data statement lines or just a plain old fashion Data block spanning many lines.

Look I'm not hard to get along with, I'll take anyway there is to store large amounts of numbers inside my source code that isnt a string conversion method. whenever Paul gets the time. hell I'll even give him till tomorrow, I'm that generous , kidding...

But still be nice to have eventually, done ranting now, back to coding and drinkin a beer.

Peace out...

It's Bird! , It's Plane!, No its a rocket powered Squirrel holding some acorns and a smile!
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 29th Sep 2014 12:08
For simple levels, I just make:

level$(1)="2jj j 2 2j j 2 222 2 2"
level$(2)="2 j j 2 222 2 2 "

and so on.

Then I scan the strings, and place sprites like 2=bush, j=stone and so on.

I use case select to select the different level sets.

I used this technique in "Turtle Fun" that is on android and iOS stores now.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
IronGiant
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 27th Feb 2012
Location: the great state of madness
Posted: 29th Sep 2014 19:44 Edited at: 29th Sep 2014 20:05
Thanks Impetus for trying to help, but I already knew how to convert String val's and use them as storage.

My attempt here was to try and get the added feature of codeblocks or data statements added to AppGameKit so we would not have to use strings and instead could code the way people have done since computer programming began and for me it began back in the 1980's. And that being the most normal way of actually adding data to your source code. But apparently I'm the only person here that wants this feature.

After all is not a computer just one big data shuffler? and inline data just makes sense to me.

Sure I can work around it and use strings ( we even used strings on old Atari 8 bits to move sprites by moving the pointer to the string memory over top of the sprite data memory location and let Atari Basic handle the data move just by shifting the string data in basic, still assembly language was faster)

or make data files from one of my other languages using their data read statements and then saving them to a file to read back by AppGameKit and stored in either an Array or MemBlock to use in AGK.

Just thought it would be cool as hell to be able to , lets say include data for a level so we could test it within our source code without having to jump thru hoops to do it or include any data for that matter that does not come from a data editor but must be typed in.

But alas I dont see this happening unless other people here also request this feature, ...data blocks or data and read statements.

So if any of you want this feature added to AppGameKit, better speak up, cause they (TGC) are not gonna listen to just me. But if enough of us request it, I'm sure Paul and Lee will see the need.

Oh and on a side note, I did Amiga programming also, still have mine hooked up with Amos in the disk drive, Amos has data statements also.

So did the Atari ST, Atari 800, PC and Mac, and all the languages I used, from Stos , Amos , Action, Atari basic , GFA Basic , Mac 65 assembly, all had some form of mass data storage inline.

But I digress. guess I'll have to use Purebasic for all my data entry then save the file for use with AGK.

peace out and last post I hope to make on the subject.

It's Bird! , It's Plane!, No its a rocket powered Squirrel holding some acorns and a smile!
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 29th Sep 2014 21:20
Please add this in the new feature request thread, as it's a highly valid request. I used to program in AMOS also, and know the power of the data command,

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Sep 2014 00:43
Quote: "So I'm to assume that AppGameKit programmers are the only ones that have never used Read , Data and Restore Statements in other languages? "


They've probably come across them. Most people here came from DarkBASIC, and that had data statements. The underlying C++ methods are probably available at TGC towers to put them in AGK.

My personal preference (and that's all it is ) is to put this kind of data in an external file for one reason. If it needs to be changed, you change it in the file and run the program again to test it. If you have a bug in the data, you can reissue the file. If it's hard-coded in the program, then you have to recompile the program to fix it.

My background is professional programming, where you don't hardcode anything in your programs. I guess it's down to personal experience. I remember using data statements on my Dragon 32 in the 1980's, where they were pretty much essential to get anything working! We used to make sprites (when sprites were 8x8 graphics) using data statements. It was literally a case of drawing the sprites on graph paper and converting them to 0/1 data statements.

IronGiant
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 27th Feb 2012
Location: the great state of madness
Posted: 30th Sep 2014 19:04 Edited at: 30th Sep 2014 19:30
thanks Impetus for that vote for Data statements , much appreciated.

And yea Batvink, been there done that... Used to work out Sprites for my Atari 8 bit on graph paper then convert that to data statements. How I made my sprites for Midas Maze on an Atari 400, 48k. Actually I used the Action language so was in data blocks, almost the samething, except no looping, its put the data in the array automatically. just like Dim Map[4]=[1,56,78,90] does.

Now back then ,on the Atari ST I wrote a small Sprite Editor to develop software sprites and save them to a file to be loaded by my program, even wrote a blitter for the ST in Assembly language because the software blitter the early Atari ST's had in its OS was slow. That just shows though that there is a place for both, the data statements and data in a file.

Would have loved to program a Dragon, might get me an emulator today and try it , wink wink..

And as I said, the data has to get into the file somehow, be nice if I could just use data statements in AppGameKit then write the data to a file. the data statements basically acting as a default back up of my file data. But I can work around it, I just want AppGameKit to be all it can be. I use it more now than any other language.

And I do have to say, I had no idea AppGameKit did not have data statements built in when I purchased it, not that having no data statements or blocks would have stopped me from buying AppGameKit, its still great, with or without built in data.

Would still rather have data blocks, that puts all the data in an array for you, no looping. Just like we now assign a line of data to an array, just be more lines than one.

Just think adding it would make it that much better a language.

Still have to give Paul much credit for his work to date, been great to now have a new IDE and code folding, yippie!

So I can wait for built in data, hell I've waited 32 years for AGK.

It's Bird! , It's Plane!, No its a rocket powered Squirrel holding some acorns and a smile!

Login to post a reply

Server time is: 2024-11-25 10:37:45
Your offset time is: 2024-11-25 10:37:45