I am just looking at the best possible way to setup datatypes for a football management game.
After some digging around forums and such I *think* this is the best way to do it, and link all the entities (leagues->clubs->players) in the correct order.
This gives me 2 leagues, 10 teams in each, each team has 20 players.
It means each player is linked to a club, is linked to a league.... (expandable in future for each league to a country, each country to a continent etc)
I can then create a "new game" type which kicks off all the rest ready to be initialised and assigned values:
Is there a better way to do this as I kind of think I am hard coding it by using BlitzArrays[], although I will know the max limits of all the arrays (leagues,clubs,players).
The other way I was thinking of doing it was by assigning each player a teamID, and each team a leagueID and doing it that way, but then I`d have to search through the whole database of players just to display the players that play for Swansea (search all players clubID field for a match)
I have to think about players transferring as well, which is why I had the "clubID field" idea, but I guess as each team has a max squad of 20 (in the above code) then if u buy or sell a player (both teams must have space) then u simply move the player and slot him into the new slot with the new club values...?
ie:
But - how would I then delete the original reference to the player, whilst not deleting the "space" so to speak...
I have tried making it =NULL and using Delete, but then I get "Object does not exist" errors....I don`t really want to delete it, I guess just wipe it clean ready for the next player....
I also notice that copying the player the way I have in the code above means that when I blank or delete the original (0,0,0) then it also affects the new one.
Do you have to manually copy every field or is there a workaround for copying the entire type like I have above and still being individual?
I`m beginning to ramble so I`ll wait for some reply if I`ve missed out any info.
Basically - is there another better way?
Cheers!
After some digging around forums and such I *think* this is the best way to do it, and link all the entities (leagues->clubs->players) in the correct order.
; Type setup Type game Field league.league[2] End Type Type league Field team.team[10] Field name$ End Type Type team Field player.player[20] Field name$ End Type Type player Field name$ End Type
This gives me 2 leagues, 10 teams in each, each team has 20 players.
It means each player is linked to a club, is linked to a league.... (expandable in future for each league to a country, each country to a continent etc)
I can then create a "new game" type which kicks off all the rest ready to be initialised and assigned values:
Global p.game=New game p\league[0]=New league p\league[0]\team[0]=New team p\league[0]\team[0]\player[0]=New player p\league[0]\team[0]\player[0]\name="Peter Shilton"
Is there a better way to do this as I kind of think I am hard coding it by using BlitzArrays[], although I will know the max limits of all the arrays (leagues,clubs,players).
The other way I was thinking of doing it was by assigning each player a teamID, and each team a leagueID and doing it that way, but then I`d have to search through the whole database of players just to display the players that play for Swansea (search all players clubID field for a match)
I have to think about players transferring as well, which is why I had the "clubID field" idea, but I guess as each team has a max squad of 20 (in the above code) then if u buy or sell a player (both teams must have space) then u simply move the player and slot him into the new slot with the new club values...?
ie:
p\league[0]\team[0]\player[0]=p\league[1]\team[12]\player[18]
But - how would I then delete the original reference to the player, whilst not deleting the "space" so to speak...
I have tried making it =NULL and using Delete, but then I get "Object does not exist" errors....I don`t really want to delete it, I guess just wipe it clean ready for the next player....
I also notice that copying the player the way I have in the code above means that when I blank or delete the original (0,0,0) then it also affects the new one.
Do you have to manually copy every field or is there a workaround for copying the entire type like I have above and still being individual?
I`m beginning to ramble so I`ll wait for some reply if I`ve missed out any info.
Basically - is there another better way?
Cheers!