but under many players, that might put a strain on the code - and the server. So seeking experienced devs here to make a suggestion.
Put a strain on the server? No, no, no way. Ever. Think about modern AAA games that are sending hundreds of events across in realtime, loads of player positions, full player inventories, bullet movements, even analytics like window size, all in realtime. Transferring a tiny ID, or a small inventory, is the least of your issues if you are dealing with servers or performance.
I understand you cannot store a 3x3 and check.
Uhh, yes you can. Let me explain below...
1. you have to correct parts in a multiple recipe
2. if they are in the correct location of the 3x3 grid
1. Just that all the ingredients are somewhere in there? This will search all recipes and find a valid one.
var enteredRecipe [1,1,1][1,2,1][1,1,1]
for (recipe in allRecipes) {
var recipeIsUsable = true;
for (ingredient in recipe.ingredients){
//3x3 loop checking each ingredient, vs enteredRecipe. If any ingredients are not found, set recipeIsUsable to false
if (recipeIsUsable == true) return recipe; //Found a valid recipe.
}
}
2) Well same as above, but where I have my comment that you loop through the 3x3 array, you simply access the element, not loop through it.
*Signing out*