-7

Probably the qeustion sounds verry strange, so i will explain it...

I wan't to learn more about Java, and i tought it would be fun to make some kind of bot for this game (nl.forgeofempires.com )

The problem is that the game is a flash game.... So my toughts where that i would look for a specifik image and then click on that image.

I've googled already for that, but the only thing that i can see is that you need to take a screenshot from the screen, and then search al the pixels for the image.

But i want to let the bot run even minimized (so the website not visible). And that it can detect the image even than...

Hope to hear some idea's from you guys TWCrap

Mathlight
  • 6,436
  • 17
  • 62
  • 107
  • 2 things that will help you :- 1)Dont ask people to play the game to understand what is to be done. 2)Describe the bot features and what you have done to implement it – Nitin Chhajer Jul 25 '12 at 12:47
  • 1) i don't ask it, i provided a link before someone ask what the site is... 2) i'm just starting. I wan't to know what i need before i start building it in the great picture if you know what i mean... – Mathlight Jul 25 '12 at 12:50
  • 2
    @NitinChhajer He stated clearly what he wants. I think what he wants to do is a bad idea, but nonetheless, his question is ok (apart from the spelling errors ^^). He doesn't want a solution, but just some ideas on how to start something like this. – brimborium Jul 25 '12 at 13:08

2 Answers2

2
  1. If you want to "learn Java", you should try it with something more doable. Try implementing Conway's Game of Life for instance. You could start by showing the results in ASCII-Art or directly show it in a JFrame (for instance by extending JLabel to draw grids from a mask). You could then improve your application by adding the possibility to load/save populations, configure the world setup (maybe even the rules). Then try to support one of the common file formats to load in cool structures from one of the many online databases. :)
  2. Why would you create a bot for that game? I guess the business terms on that site state clearly that this is not allowed.
  3. If you really want to interact with a flash game, I guess you should try to load the flashgame within a Java application. Then you would have more control over it.

Summary: Don't! ;) Try to find another task to solve.

brimborium
  • 9,362
  • 9
  • 48
  • 76
1

It is not possible in the way you describe it.

  • When your application is miminized, you can't take a screenshot, right? ;)
  • Searching for pixels is not that easy and recommends to analyze a graphic and all it's possible variations.

So how can you solve your problem.

I would generally say: you can't. But there are some ways:

You could look for an API in that flashgame (I don't think it has one) or you can try to start that flash game inside of a java application and analyze it there. So you don't have to take a real screenshot and everything is fine. BUT, this needs some high skills. Maybe you can use this

Embedding Flash Player in a C++ or Java application?

Community
  • 1
  • 1
hellow
  • 12,430
  • 7
  • 56
  • 79
  • I tried (in c#) some ways to force an element to be drawn on a canvas of mine, for the purpose of seeing how it looks, even when minimized or obscured by another window. Never turned out too well. A few control support this, many do not. Also, you need to go medium-deep into the system, do not know if you have that deep an access from within Java. There should be a way, though.. still, like many ppl here said, not a beginner's way. – Andreas Reiff Aug 03 '12 at 13:30