Yielding to a nostalgic impulse, he decided to play around in one of the fan mods for Diablo II , and after a couple of hours was exhausted by the monotony of what was happening. And then an idea appeared in my head: why not write a bot that instead of me will go through a game that bothers you in just two hours. How can this be done in principle?


Vague answers to questions from DreamChild

First of all, I do it just for fun , to train my programmer's skills, and this is a kind of pen test in writing artificial intelligence, so do not discourage me.

Firstly , everything in Diablo are sprites that are packed in mpq, and not one unpacker was created by craftsmen, so these sprites can be extracted and taught to the AI ​​to recognize them already (we know what to look for). Text information is even simpler: we need to recognize a specific font (well, two fonts) of a specific size. However, it is not even necessary to recognize opponents: if, when you hover the mouse over an area, an inscription appears at the top of the screen, then this is the enemy that needs to be attacked. As a result, the bot should only distinguish between fonts and everything that flies in its direction (AI, dmayu, it is better to do sharpened for ranged combat).

Secondly , for each character there is a “build” - a certain leveling pattern. For simplicity, you can take one character and create for it a template according to which the AI ​​will scatter points of characteristics and skills.

Thirdly , a person selects a better gear only because he is too lazy to run to the merchants. AI can act on the algorithm filled in inventory, compared with his, went to the city, sold, bought a new portal scroll, returned to the location.

Fourthly , the tasks in such games are primitive, there are not so many of them, therefore the conditions for obtaining and executing them can all be manually entered. As for the map: most of the players deal only with those, which completely comb the locations in search of experience and better quality gear.

Fifth , to find out which bow is better is not so difficult: the one that has more damage (compare the stats of the character on the window). And for the other effects there is a hint: the stronger the subject, the more expensive it is. The only catch is with various resistances, but here you can force the AI ​​to consider what it takes more damage from and in accordance with this to strive to increase this or that resistance. But it is better to write an AI, which does not receive any damage at all, or reduces them to a minimum.

Sixth , what are the benefits of the SDK ? There is one in Torchlight and Titan Quest , but what benefits does it give?

  • And a bot would have less to write sites on php itself))) - 00yuri00
  • I think serious uncles are already busy solving a similar problem, and a bot for a diablo, I think, is still much easier to write. - Montreal
  • one
    Write a bot :) What is your system, Windows? If not a seven, then try sending keyboard and mouse messages to the client window of the program (emulate user input). Only here with the recognition of what is happening on the screen will be big problems. In short, you touched on an interesting topic, but a large and very complex one. - PaulD
  • Just Windows 7. I think there should be some more sophisticated approaches than doing text and image recognition. Although in diable everything is two-dimensional and sprite, so it should be a bit simpler than recognizing a simple picture. There must be another way ... - Montreal
  • one
    @Montreal, if something yes write, share the results. And then I, too, have been dreaming about my own "Jarvis" for years. - PaulD

1 answer 1

At 146% sure that the game is not worth the candle in terms of labor costs compared with the final result. Apparently, there is no Diablo-SDK in nature that would help in solving the problem (for a wide audience, I mean), and writing the logic of such a bot manually is tedious, dreary and unreliable. Theoretically, of course, you can try to teach this bot to recognize images on the screen and emulate mouse clicks and keystrokes. However, there are a lot of problems.

First, in this game a huge number of all opponents. Dozens of species, if not hundreds. Obviously, all of them will need to somehow recognize. You can, of course, try to kill everything that moves, but it’s damn inefficient if only because many of them have different spells that the bot wouldn’t be able to defend themselves against, and a number of them have protection or even immunity to one or another. magical influences, which is also important.

Secondly, you need to somehow teach him to "pump". For a bot, and even one that captures images, this is a very non-trivial task. However, the question of choosing one skill or another when a new level is reached can be left to the person.

Thirdly, you need to somehow teach him to somehow pick up equipment and objects that have fallen from opponents, and not just any (and they are there in bulk), but only the most valuable ones.

Fourthly, the bot should be able to perform tasks (even if there are some of them) and find their way on the map. Maps, as you know, in Diablo II are automatically generated

Fifthly, the bot must be able to use the best weapons, equipment and spells that are in its possession. Proper combination of all this junk type of armor, boots, helmets, amulets, rings, weapons, character's own characteristics, his skills in such a way that the characteristics of one thing are not annulled by the properties of another object - the task is not always obvious to humans.

In my opinion, there are more questions than answers. Therefore, if there is a desire to practice writing bots, then in your place I would choose some other game that provides a little more opportunities for such manipulations.

  • for a start, something simple, some kind of browser, or, actually, something online that exchanges packages with the server, I think it will be somewhat easier with similar games - DreamChild
  • Well, yes, it is easier in terms of sharing information. In principle, if you know the features of the client-faith architecture of any MMO, then you can write a bot for it, which grind in it. But I had answers to the above questions. - Montreal
  • one
    @DreamChild, let me disagree with you on the final result (the expected endorphin level of the author). @Montreal, and you are well done. You are intimidated, but you do not give in. - avp
  • @avp I guess it depends on individual preferences. Let's say that such an activity does not seem interesting to me, and, therefore, I don’t think that endorphin is such an exercise for me)) However, I fully admit that this task is more attractive for TS - DreamChild
  • one
    @Montreal, once, at the beginning of my programming classes, I stuck to my older colleague, but I would like to write some interesting toy of my own. Say, checkers or preference. He answered remarkably. You know, he says, game programming is the wackiest thing to do. In any case, you will be convinced that he himself is a fool. If the toy beats you - a fool, because I lost some piece of iron, but if it’s the other way around, it’s also a fool — I’m not able to write a good program. - avp