Hello Everyone
I have started a project to upgrade the Pro Evolution Soccer 6
match engine and Artificial Intelligence systems
I use reverse engineering techniques and a number of modules in Java, Python and C++ to control the players inside the match engine and to retrieve information from the PES6 memory space to allow my AI to make informed decisions.
Through the use of mathematical models (which I will be making available to some programmers who pm me) I have finally been able to de-obfuscate the position vectors of the ball and the players from the games memory. This is the basis of computing information about the match.
Here the new AI playing as the red team. A new programmable camera is also tested in these videos.
My testing environment.
To inspect the AI models , notably the PageRank graph progression I have programmed a visualization tool (on the right hand side) that lets me graph what the AI system sees.
View attachment 184576
Why is new AI important though?
Well the Master league and in general playing offline in general is boring , no ?
The Konami AI is weak and predictable. The game we love is fun but it could be so much better if we had real AI.
We as a community have spent 16 years focusing on the aesthetics of the game and I hate to say it but these (very shallow) changes to PES6... like changing the kits players wear or the players shoes (

) are mostly a waste of time .... when we have such bad AI to play against , no?
We do other things too of course, like swapping the sound files to change the commentators voices ,
but is the commentary system itself not totally broken, no? Is it not an object of mockery ? Why has nobody coded a better one ?
This AI framework will let programmers code new commentary systems too. The match evaluator can be used for that now.
We just need to turn off the old commentary in pes6 menu. Then have the AI code play sound files instead!
And for an illustration of our technological advances as a community for 16 years... our best software is Kitserver , right? And its so useful...
This software relies on setting a new texture for a mesh. You hook directx and you do
m_pIDirect3DDevice8->SetTexture(0, NEW_KIT)_TEXTURE);
HRESULT result = m_pIDirect3DDevice8->DrawIndexedPrimitive( Type, minIndex, NumVertices, startIndex, primCount);
Thats it!
View attachment 184558
Apart from changing textures with Kitserver and the little bit of hacking around with the Cheat Engine (TM) to break the ball physics and such.
What have we done?
So Enda. Why haven't we developed anything cooler?
Well in my opinion , its because Reddwarf retired!
It is too difficult for anyone else.
There has been nobody else to fill in for my old friend Reddwarf.
Otherwise someone would have done it, no?
Thats easy to say right?
So let me explain why its difficult.
(1) PES6 interfaces with the joypad and the keyboard at driver level.
Tools like Auto hot key, the Java robot library, even C# event libraries (which are used for modding in many other games) do not work for PES6.
PES6 simply ignores everything like this. It has hampered peoples attempts to control the players using code.
(2) The second problem is that Konami obfuscates the position vectors of the players and the ball in RAM. Its a big mess in there!
Even if programmers manage to reverse engineer the memory addresses, they will still have no idea how to use the numbers they get.
The pitch in PES6 is not represented as a continuous surface. It actually has four different segments patched together in there.
The numbers approach a limit in the center of the pitch and they do not grow/shrink linearly as the ball moves around the pitch.
In one area of the pitch the difference can be tiny and in other parts the differential is much larger.
So when (if a programmer ever managed to) track the ball , it just jumps around.
So a programmer can not work out where the ball is.
If you don't know where the ball is or the players, how can you make something to commentate ? How can you make an AI?
The first module. A metadata component named the "Match Evaluator" retrieves this data and builds additional metadata (namely the network analysis of each teams passing network to allow the AI to decide which players to mark and follow). There are variables computed such as
The key player in each team
The weak player in each team
For each player in the team
it calculates who connects them to the team (who passes most to them)
It calculates who they connect to the team (who they pass too)
It ranks all the players in importance
It works out which player currently "owns" the ball.
Who player 1 is controlling.
It records every passes direction (to see which players passing forwards, backwards ie progressing the ball)
The length of each pass
Hundreds of variables are calculated and made available in the Match Evaluator
The AI makes some decisions then based on the variables available to it and instructs the virtual joypad module to move the players accordingly
View attachment 184555
The virtual joypad module I programmed allows driver level events to be programmatically sent to the match engine.
This allows me to control the players using Java code. Player 2, 3, 4, 5, 6 and 7 can be individually controlled and programmed using code. These slots are set to virtual joypad ports in settings.exe
View attachment 184556
I would like each team in PES6 to play with their own unique style. This is an enormous goal and for this reality to happen the most intelligent solution will be to make this framework available to everyone who has an academic email (and to some programmers who pm me) and hope that they create their own AIs. Maybe we could have matches between us programmers and do a competition among ourselves to see whos code is best for fun to stimulate creativity.
I will congregate the AI implementations then into a patch (with style modifications made for each team) and make this available for regular players to install and script the styles as they wish.
The first version of the project is finished. It lets us play 1v1 against a simple rule based AI in a 1v1 match. The AI in the two videos above has just six rules to follow and as you can it is capable of defending , passing to other players, shooting and it scored a goal:
View attachment 184557
Now I would like you to imagine an AI with thousands of rules and sub systems for things like calculating the perfect long pass? The perfect shot?
With different rules for different players , like a specific crossing function implemented just for Beckham?
If you know Java, You can modify these rules in real time too (without restarting the match!)
So it's a lot of fun to program with.
What this framework provides
It provides three modules.
A match evaluator module.
This lets programmers who are not familiar with reverse engineering to access a lot of information hidden inside of pes6 memory using just their normal Java codes.
The match evaluator module converts the obfuscated figures found in memory into clean percentage space (X 0.0% - 100.0%, Y 0.0% - 100.0%) values before giving them to the programmer. Which they can work with easily.
If you know where the ball and the players are, you can compute meta data such as.
- The player who owns the ball (I provide this already)
- Perform network analysis of each teams passing network (Provided)
- Assign importance ranks to each player in each team (Provided)
- Much more I am sure they can think of themselves
- The animation ID of each player which can be used to know who is shooting, tackling, running etc
View attachment 184569
The data structure we represent each team as is a complete graph with 11 vertices. Our structure is decorated with metric properties
using PageRank, the vector space representation of the match and detected temporal events by the Match Evaluator.
View attachment 184564
The Match Evaluator (along with analysing the game in progress outlined above) also has a historical data source it can query
This dataset I created was computed using a set of match event feeds that were made available by Opta and Manchester City to the data science community online.
http://playground.opta.net/?game_id=131897&feed_type=F7
176 matches in total , where every pass was recorded in xml
I was able to transform each feeds xml into a row in the dataset so that it has the same shape as the PES6 Match Evaluator data
POSITION,P0_IN_NUM,P1_IN_NUM,P2_IN_NUM,P3_IN_NUM,P4_IN_NUM,P5_IN_NUM,P6_IN_NUM,P7_IN_NUM,P8_IN_NUM,P9_IN_NUM,P10_IN_NUM,P0_OUT_NUM,P1_OUT_NUM,P2_OUT_NUM,P3_OUT_NUM,P4_OUT_NUM,
P5_OUT_NUM,P6_OUT_NUM,P7_OUT_NUM,P8_OUT_NUM,P9_OUT_NUM,P10_OUT_NUM,P0_OUT_LENGTH,P1_OUT_LENGTH,P2_OUT_LENGTH,P3_OUT_LENGTH,P4_OUT_LENGTH,P5_OUT_LENGTH,P6_OUT_LENGTH,P7_OUT_LENGTH,
P8_OUT_LENGTH,P9_OUT_LENGTH,P10_OUT_LENGTH,P0_OUT_ANGLE,P1_OUT_ANGLE,P2_OUT_ANGLE,P3_OUT_ANGLE,P4_OUT_ANGLE,P5_OUT_ANGLE,P6_OUT_ANGLE,P7_OUT_ANGLE,P8_OUT_ANGLE,P9_OUT_ANGLE,
P10_OUT_ANGLE,AVERAGE_X_POSITION,AVERAGE_Y_POSITION,TOTAL_NUMBER_OF_PASSES_RECEIVED,P0_PAGERANK_IMPORTANCE,P1_PAGERANK_IMPORTANCE,P2_PAGERANK_IMPORTANCE,P3_PAGERANK_IMPORTANCE
,P4_PAGERANK_IMPORTANCE,P5_PAGERANK_IMPORTANCE,P6_PAGERANK_IMPORTANCE,P7_PAGERANK_IMPORTANCE,P8_PAGERANK_IMPORTANCE,P9_PAGERANK_IMPORTANCE,P10_PAGERANK_IMPORTANCE,PAGERANK_RANK,RESULT
You can view the script here
The historical dataset the Match Evaluator uses (scroll across to see the pagerank)
We will use this to get the AIs to make decisions based on real life matches when they and the match are in the closest state to an entry or entries in the dataset (nearest neighbors algorithm perhaps)
The second part is a virtual joypad utility written in Python.
It has a socket connection to the match evaluator module.
So don't worry, you dont need to know both Python and Java!
This part lets the programmers control the players inside pes6 also, using their normal Java codes.
View attachment 184575
View attachment 184567
I include a utility for setting up each virtual joypad
The third part is a C++ .DLL that allows the programmers to interface with pes6s directx calls. It has api for creating rectangles, text and such on pes6s screen and for setting new textures for any mesh currently drawn (allowing them to update the texture of the pitch surface for example - if they want to add mud dynamically during a match based on the heat map of the players positions or do something with water puddles - they can just draw these puddles on the pitch).
The programmers can also disable the drawing of any mesh (such as turning off the stadium to improve performance) while conducting their tests.
The culmination of these modules can help programmers make improvements to pes6 , like new commentary systems by using the match evaluator information to play commentary sound clips and also fan chants that play when certain players are substituted, tackle etc,
I am looking for collaborators who like programming and are fun people to chat with. preferably using voice chat in english on whatsapp. pm me.
Regards
Enda