AOZ Football Manager

2nd May Update.

Well, here we are again with another episode of this zany blog. I’ve never kept a blog for instructional purposes, as I mostly write what goes in around this head of mine. But for want of a better thing to do, here we are.

Okay, so for the last week I have been absent from writing, but that does not mean I have not poured hours and hours into the game, and making things simpler in the program. People have pointed out ways to do things, but I have a problem with some of that. And why is it so?

Well, the fact is that I am an old style programmer. And I love the old retro style way of writing code. Perhaps, yes, when writing for micro-controllers with just 8k available, then that quite makes a lot of sense. But when the program is hosted on machines which have huge memories, then nit-picking is perhaps not the most obvious thing to do.

Of course, elegance in coding is always a pleasure. The way I see it, the difference is so negligible that I do not want to lose sleep about it…

So let’s go on with the show!

Let’s start by explaining a few of the many lines of code in this first image. Lines 12-18 start up by creating arrays (DIM) of team names, matches played, won, drawn, lost, goals scored and conceded, bla bla.

Lines 20 to 24 set up the teams via the Read Data function. A very easy thing to do. Far more manageable then simply attributing single string data to each squad.

We then come to the keeping, defending, midfield and attacking, fitness and morale attributes each section of each team has. These are random numbers, and since every team you choose starts at the very bottom of the league table, the values are capped at 5 … Minimum skill 3. Maximum 5. Fitness and Morale have 7+ and 6+ respectively.

10 prog1

Lines 31 to 39 are vital. These lines comprise the very heart of the fixtures. I thought hard about how to get these. In the end it was very easy. 16 teams, thus 15 matches in every season. So you get to play each other once. If we take the first line, it simply reads the data into dy$(i).

The data is a string in which each match is ‘spliced’ into a 4 character code… In the first code 0103, it simply means that team 01 will play team 03. (Birmingham – Bradford, in this case)… Although that would not be exactly true.

Why is that? Because I have thought a simple way to process things. Choose your team, swap it with the first squad, and make your chosen squad. You will note that every fixture day starts with team 01.10 prog1

So when the main menu choice to go to the match is chosen, the computer comes across selection 01 as the first squad… YOURS! So you make the adjustments to your squad, PLAY that match, and THEN the program goes through all the other matches.

I have not input home or away advantages since the teams play each other only once. I do not want the game to be bogged down time-wise.

Lines 41 to 43 populate 17 players with names. For the moment, their skill is not visible here, but will be so in the game as can be seen in the image below. Damn, that red looks ugly. Got to change that. Perhaps Green will go well.

08 teamviewer

Finally, lines 46 to 52 has solved a problem for me. There I was looking at the table and thinking..’Did the best team REALLY win the league?’ ..hmm… I needed confirmation. So those 6 simple lines provide a text report of the squads’ relative strengths. This would give me an indication of where I’m heading.

S00 totalityee the image on the left, and the final league table played using THAT classification. It is clear from that this representation that Cardiff City have the best squad.

Defence, midfield, attacking are all set at 5 by the computer (how lucky!). By comparison, York have 14 skill points and Millwall, Birmingham, Oxford United, Southend and Wigan all have just one more at fifteen.

 

07 Final

As can be seen from the final standings after the fifteen games had been played, Cardiff DID indeed win the league, and despite having the best team by far, DID drop points as well. By contrast, the lower ranked squads did finish at the bottom of the table, give or take a few positions. So the match results were meeting my expectations. So pleased that this turned out ok. It took me many many hours to finish this. It’s cool though. No electrons were harmed.

After we have explained this, going waaay out of whack in the process, we come to the part of the code which explains a simple selector I thought of, and quite like. Using just THREE KEYS, one can navigate around the game with nonchalance. < > and Return are the only keys you need use.

Line 4 refers to Gosub Huge Fonts. What is this? Very easy really, a set of subroutines with different sized fonts which I could call on easily. So, a large title, and then medium fonts with the country names. As can be seen, I still have to add a number of leagues, but also thinking about making it a single European-wide game, since invariably, all the names can be edited.

Lines 10 and 11 explain the simple move procedure I created. It just takes a bunch of variables, like Bob number, x, y locations, and how much the ORANGE box cursor needs to jump. I am a huge RUSH fan, so the routine is called prime_mover.

11 selecting league

And the image below, is what we get… load the background, slap a large title, create the nations names via a simple text, then use the prime_mover subroutine to navigate. So easy and consistent across the whole program.

01 leaguechooser

The same code is used for the level selector, as well as the team choice. Really little to explain here as it is a rehash. AAAIIII!!! There is actually an error in line 15, as I have reduced the players to 17 instead of 22… This will FORCE you to spread your players time on pitch to give them form, fitness, and morale.

12 selecting your level

The subsequent code is used in the following parts to choose the LEVEL, team to manage, two examples here, and eventually, the heart of the program, which is the Management Menu.

02 levelchooser03 squad104 squad05 management

After all the running here and there to set up the system, THIS is what it is all about. And it may seem such a small routine… well, it is actually. The game, as every game should be, is programmed in modules.

13 mainmenu

There’s no need to round repeating the same words and programming practices, load screen, bobs, texts, variables… yawn.

It’s just setting up and repeating it till the words line up… so time consuming though.

The next step is about creating the match. I don’t really want to show this part though. I have found a fine balance between ‘Expected Results’ and ‘Surprise Games’. I’m sorry , perhaps sometime I will show it, but for now, that’s all there is to it.

After that, a league table has to be created with huge attention to detail. Each team is sorted by Points, then goal difference, if that is equal, the highest amount scored.

My programming here is awful… and why is that? Simply because this program is a direct port from an other flavour of basic. And that basic did not have the simple SWAP command available in AOZ. I will get to fixing this soon.

14 league table

And this is the table… Needs smartening up .. A LOT… BUT, Southend United are on top, so I’ll take it.

15 actual table

That’s all for today. Too tired to think straight. I’ll continue working and we’ll see.


 

Supposed to be taking a break from programming, but I feel that I’m in the zone and this cannot be stopped.

Today I finalized a small part which I had wanted to do for a long time. I spent more than a decent amount of time on fonts, most importantly because I feel that this is an old-style, retro game, and that the fonts must absolutely respect the period. Will have a proper write up later on in the week.

picser

04 arrival

After the release of the Atom IDE for AOZ Studio, I have really been getting into the AMOS community once again. The old manual has helped me tremendously, and as I gained a bit more confidence, I decided to take the plunge.

Some time ago I embarked on a dream of mine. Inspired by the great Kevin Toms and his eternal Football Manager, I decided to try and replicate his game, simply because it was so good. There is no need to say that I did not manage to reach the finer points his game had. KT just created the perfect game…nice and easy on the lower levels, but increasing in difficulty, season by season, and level by level.

FOOTBAMA_POR

That was okay by me as I knew I could never reach that incredible height. I just wanted to create a game I would enjoy myself.

Of course, Kevin Toms went to recreate his own game for modern machines, and I was well and truly lost in his game once again.

I just continued on with my programming, as mentioned above, to keep going on with the game.

This game was started out on Blitz which is a very good platform indeed. Sadly, the Blitz Basic page has been closed and the forum disbanded, and everyone seems to have disappeared.

When I stumbled upon Francois Lionet talking about AMOS2, I nearly died of shock, and of course, happiness. The guy has been involved in some of my favourite programming tools, from Amos, to Klik n Play, The Games Factory (1 & 2), Click and Create, and of course Clickteam Fusion, in which I still program. Apart from Amos, none of the other programs use line coding, but one would be mistaken into thinking they aren’t powerful. They are simply excellent.

So I continued FL’s journey, but when the initial alpha versions were released, and were still strongly Amiga-inspired, I started wondering whether in this day and age, I still needed this.  am not going to mention the number of times that I tried AOZ using The VS editor and nothing worked. Absolutely nothing. Of course, it was still early days. With the release of the ATOM IDE, all of this changed, and the shift of power was there to see and feel.

This week I decided to see if I could transfer my game to AMOS. After all, I was quite good in AMOS when I was a youngster.

amosmanual

And now, I have decide to chronicle my journey into hoping to release the game re-written using AOZ. It’s not going to be easy, or quick, and I might have pauses between updates as my work keeps me very busy.

Cheers! Chris.

Day 1

The first step I needed to do was simple. And that was insert the images into the project folder. These, I put into the following folder –

C:\AOZ Studio Beta\My Applications\FootballManager\resources\filesystem\application

Capture

After that, I imported the WHOLE FootMan basic listing into AOZ. I can’t say what an absolute boo-boo this was. Having over a thousand lines of code, and having to edit all of it in one file was simply stupidity on my part.

So I started importing it bit by bit, and checking ‘sections’ , or ‘routines’ if you prefer, to make sure that it all worked.

If you are studying the code below, you will find that there is a huge similarity between AMOS and Blitz. In fact I progressed to Blitz with very few differences in syntax.

listing

Needless to say, there is a lot of checking and rewriting to be done. In this first day alone, I put in twelve hours of work on just importing routine by routine, checking, amending and testing. I finally stopped at 11pm, as I had been on and off since 6am that morning.

teamselect

There’s quite a bit I still need to find out. And some points I do not think are tackled correctly so far. I can load the ‘acme’ font, but I am still unsure how to get other fonts from google… or indeed, use my own fonts. No doubt this will clear up as more programmers get involved. Indeed Francois himself was kind enough to help me out himself with a problem I had. A very Blonde Moment indeed…

Getting to this point alone in one day is nothing short of a minor miracle. Hopefully day TWO will be similarly productive.

At this point I want to make it clear. I WILL create editors for the team names, but as the game suggests, this is all about making your way up from the very bottom of the league tables. As such, there are only going to be small team names in the initial version, although I do promise to keep updating as we go along. 

DAY 2

So, for the second day, I revisited my programming and tried to make better sense of it all, clean up a little of the code, while explaining what is going on. My main aim at this point is split into two thoughts. Either that of getting the game ready and playable, while constantly updating it, or else, set it down properly before having the playable version.

Sometimes I find myself tinkering with little things like fonts, colours, placement or ideas, BEFORE the main thing is done. Very wasteful. We’ll see how the flow goes.

In the meantime, here are some early programming screens and a brief explanation of what they do. Please note, a lot of work is to be done in programming efficiently, but this is the way that I am sure, works well. I will worry about ‘Beautifying’ the code, later.

Let us start with this initial image. Lines 6 and 7 define page limits, font and clear the screen. Lines 10 to 18 define the large number of variables required. This will be in the form of Teams, Players, Position in the squad, and how many matches have been played, won, drew, lost points, etc,

01 variables

This next image is quite clear, if perhaps a bit strange. Lines 22 to 29 are quite easy to comprehend. Every team is slotted into a variable, with its name, as well as the relative team strength visualized by numbers… goalkeeping, defence, midfield, and attacking strength.

Lines 33 to 40 are strange, at first glance, but they are really quite easy to understand. Each string contains all the fixtures in it… so dy$(1) is in reality Match Day 1,  in which teams 0103 are Blackburn and Carlisle, while the next set, 1210 are Southend United and Oxford United… and so on. I had to subscribe to a league system to get this information.

In the future, the names will also be available to load or edit. Of course, this will also be true when selecting another league to play in. For the moment. English League first.

A little trick I employed here is to SWAP the team one chooses to play with, with team ONE. So, if, say, I choose 12, Southend United, then team$(01) becomes Southend United, and team 12 becomes Blackburn Rovers. This is done so that the program gets straight to the main squad and knows when to start the main loop.

02 teams and fixtures

The next image is fairly straightforward. Three keepers, eight defenders, seven midfielders, and four strikers. Please note player number 15, Amos, a midfielder.

03 Playernames05 mainloop

The last image for today is actually our main loop.

This is quite easy to suss out. Prepare, show and execute the intro_title page, then select a league to play in (for now, only 1 league), then select a level, already done in its totality, select your squad to play with and finally, the mainloop which cycles through the season’s fixtures.

And THIS, is where I have arrived so far… again, early days, but moving along nicely.

04 arrival

Signing off. Live long and prosper.