Main Menu

New to Amos Pro, looking to start *simple* programming in A.P

Started by LordNipple, 01 Apr, 2015, 11:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LordNipple

Hello all.
I am an Amiga enthusiast and have been since I got my first 500. I now own several Amigas and want to start programming in Amos Pro. Now, I have tried to learn programming in the past, much to the dismay of my friend and teacher who co-made Renegades Deluxe with me, as he tried so many times to explain the simplistics of basic programming to me only to be met with a blank expression. I did the graphics etc on our games and never really 'got' programming. Unfortunately my friend refuses to program any more on the Amiga, which is a real shame but for some reason I simply cannot stop working in DPaint and cannot turn my back on this system so I decided to get a copy of Amos Pro and look to start dabbling in the murky world of programming.

I mean, I don't understand ANY of it, I think I understand basic program structure but one thing I could not wrap my brain around was arrays and how to use them.

I wouldn't be looking to create anything complex at all until I found my feet (if ever) and would concentrate on a text adventure (with use of arrays) for my first game.
It's something I have always wanted to do so I thought I would say hello. :)

Hungry Horace

hello!

I started out with a text adventure back on the ZX Spectrum in my youth. There are complex and "proper" ways of approaching it, but even doing it the "wrong" way is always a good learning experience!
Quote from: KillerGorillabecause winuae is made of code and your amiga is made of stuff


Lonewolf10

Arrays are not that hard to understand. If you have any specific questions or need examples to help you understand how they work better, just ask and we will help you :)

(Sidenote: I also started programming in the early 90s on a Spectrum when I was a teenager)

Sidewinder

Welcome m'lord.  Arrays confused me also in my early AMOS programming days.  Ultimately I did come to understand and even love them.

An array is simply a way to store many related variables in one single place.  For instance, say I have a game with 4 players and each one has an energy level 0-100.  I can create an array to store all their energy levels together for easy access:

Dim ENERGY(4)

At the start of the game I then set all 4 player's energy to 100, we start counting with 0:

ENERGY(0)=100
ENERGY(1)=100
ENERGY(2)=100
ENERGY(3)=100

Now, during the game I can add or subtract energy using normal arithmetic, I just use the array name and the player number:

Rem This subtracts 15 energy points from player 0
ENERGY(0) = ENERGY(0) - 15
Print ENERGY(0)

So that's pretty much it.

You can also create arrays that act like grids.  These are called 2 dimensional arrays and can be useful for tracking pieces on a board game like chess or battleship.  You create one of these arrays by using Dim with more than one number in the parentheses:

Rem A 2D array
Dim CHESSBOARD(8,8)

Then you can access the value (that might indicate which pieces is at a given point on the board) like so:

Rem Find the piece located at row 4, column 7.
PIECE = CHESSBOARD(4,7)

Remember to always start counting row and columns at 0.

You can have as many dimensions in an array as you want, so a 3D array would be like a cube:

Dim CUBE(10,10,10)

Higher dimensions can also be used, but can be difficult to visualize.  Anyway, I hope this helps a little.  If not, let me know and I'll try to explain it differently.

And again, welcome!

- Sidewinder

Xertese

@Sidewinder
You have created 5 Dimensioned arrays for a four array job wasting valuable memory.
Very sloppy coding.

rednova

Dear 'Amigo' :
Welcome to the world of amos programming.
You are bound to create new amos games if you try to learn programming in amos pro.
I would start by acquiring the excellent books already printed for coding in amos. (check ebay).
The titles are: Mastering amiga amos, Amos in action, and amiga game maker's manual.
The books are really good, and explain how to easily learn to code.The game maker's manual include
how to write a text only adventure.
Also, if possible, get the amos PD cd.  It has a zillion examples of great code made in amos.
I hope this can get you started.
Love !!!
-mobilis in mobile-

SamuraiCrow

Quote from: Xertese on 10 Apr, 2015, 09:40 PM
@Sidewinder
You have created 5 Dimensioned arrays for a four array job wasting valuable memory.
Very sloppy coding.

If AmosPro supported structures without using the Bank functions, he could have whittled it down to one array of structures.  It's very clumsy and fiddly to do so in AmosPro though.

xboxisfinished

Just a curios question. Is it impossible to implement structure feature in AMOS?

SamuraiCrow

It would take some doing.  Right now the priority is on bug fixes rather than new features but once the bugs are fixed, it would be a good idea to add that.

xboxisfinished

Quote from: SamuraiCrow on 10 May, 2015, 08:52 PM
It would take some doing.  Right now the priority is on bug fixes rather than new features but once the bugs are fixed, it would be a good idea to add that.

If that is the case can I request two more features? Can I request the feature of internet support so people can write internet applications or online games? Can I also request the feature of rumble for the PSX/PS2 controller? I am sure these two features I am asking are library extensions but would be super cool to do that. Making AMOS truly the best programming language for games.

SamuraiCrow

Extensions don't require prior knowledge of Amos.library but they do require knowledge of the subject matter.

Using the FD builder on BSDsocket.library should give primitive internet support but the issue of how to form packets arises there.

I know that PlayStation controllers can be used with Amigas but I know nothing of the programming APIs.

xboxisfinished

Quote from: SamuraiCrow on 11 May, 2015, 03:14 AM
Extensions don't require prior knowledge of Amos.library but they do require knowledge of the subject matter.

Using the FD builder on BSDsocket.library should give primitive internet support but the issue of how to form packets arises there.

I know that PlayStation controllers can be used with Amigas but I know nothing of the programming APIs.

What do you mean the issue of how to form packets? Is it something difficult? If someone wishes to write their own API how does one go about doing it? Is it impossible to right an AMOS API for the controller?

SamuraiCrow

I'm saying that I don't know how to do it.  It is possible though.  Internet support will require multitasking enabled.

Hungry Horace

how is rumble support activated on a PSX/2 pad adaptor?  I have several but none have this feature.

I assume there is a specific library for the adaptor, and it should just require a library call to activate?
Quote from: KillerGorillabecause winuae is made of code and your amiga is made of stuff


xboxisfinished

Quote from: Hungry Horace on 11 May, 2015, 03:33 PM
how is rumble support activated on a PSX/2 pad adaptor?  I have several but none have this feature.

I assume there is a specific library for the adaptor, and it should just require a library call to activate?

There is non but there is no programming feature that support it so therefore there is no hardware that support it. Sorta like you need job experience to get hired but you need to get a job to get the experience kinda of thing. So unless someone build the hardware and the driver API for it at the same time I guess it will never happen.