Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Cool game! I think your work is under-appreciated to be honest.  There's just something fun about the games that you make, and I can't quit put my finger on it! 

P.s. I wanted to ask you: How would one go about creating a formation system in Unity for a football game (or soccer as our trans-Atlantic cousins call it). Do you create and place a list of empty game objects with the designated positions for the players in the formation and then have a trigger area in each of these positions to check and play with in code? What do you think?

(2 edits)

Thanks mate, I appreciate that! :))

I do most things in code, I rarely use the Unity editor. So in this case, the formations are arrays of structs, that have a coordinate in them, as well as the player role per entry, etc. Then on starting a match, I Instantiate() objects on those positions.

So I'm not sure if that's very helpful for you if you work in a different way! I come from a background where there wasn't a thing like an editor, so I still do most things in code lol, but that's maybe not the best idea for most people so not sure if that helps!

(+1)

Thanks for the reply. Instead of structs, I use empty GameObjects for each position in the formation. This way, I could do more with it like access its Transform component or attaching different components to it like Colliders, etc. Anyways, really cool work on your part.


I've read your blog that explains how you made your earlier football game. Very well explained! I learnt a lot from it for my game. Thank you! I just have a question regarding what you refer to as the 'formation position or rectangle' which decides whether the team is attacking or defending. Could you please just make a few more remarks here about how would one could code something like this for their game? I'm not understanding how do I apply this biased position for all the players in the field using this focus rectangle. I'm letting the difference between the player's default position and his ideal position given by the Hungarian algo control how the player should move. Kindly, elaborate a little on this subject.


Best,

(1 edit) (+1)

I'm happy it helped you! I do find it hard to understand what exactly you want me to explain more about, and also text is a crappy medium to explain things that should be explained visually :( I'll try..

The formation rectangle is more of a result, than an actual 'object'. For example, the striker might be at coords (1, 0) in the formation setup: the most forward position, and in the middle. But during a match, they're only there while their team is attacking, and the ball is close to the opponent goal. While defending, this player might end up at (-0.5, 0) - halfway it's own half (but still the most forward of their team).

So, the original formation might have players positioned from (-1, -1) to (1, 1), but during a game, this rectangle is compressed. For example at the start of a match, both teams are on their own halves, so the players of team 1 would be between (-1, -1) to (1, 0), which you could visually see as the formation rectangle being compressed in the 'depth' axis. then as the ball moves forward, this rectangle moves up.

Again, this is not an actual rectangle, but just a result of the player's positions moving up and down with the action, while still retaining the formation's 'form'.

I hope this helps.. (but it could also be that you already understand this, but have a problem with translating this to actual code/math?)

(+1)

Thank you for your reply and explanation! I think what was confusing me a little is that you use a normalized coordinate system from -1 to +1. Thanks a lot for taking the time to explain your hard work to other people and also for sharing your work.