Commit Graph

41 Commits

Author SHA1 Message Date
John McCardle 0da86d118a ignore vim and venv local files. 2021-12-30 15:17:40 -05:00
John McCardle 0c4bb4ee6b Merge branch 'gamemodel_imagepipeline' into gamemodel_basics 2021-12-28 19:50:01 -05:00
John McCardle 722730c076 remove extraneous commented code 2021-12-28 19:48:57 -05:00
John McCardle f02313da39 Mostly functional again after imagepipeline module refactor 2021-12-28 19:46:52 -05:00
John McCardle 1435752a30 [In Progress] refactoring and debugging imagepipeline
poorly defined: how to accurately track if an image is color or not? This is causing a bug in the @with_frame decorator in GameModel.

There's also an antipattern of "cvimage.image = cvimage.mod_function()", to perform in-place modifications to images. This is the place for an ImagePipeline object.
2021-12-27 20:30:40 -05:00
John McCardle fd1767cfe1 More functionality for CVImage class
TODO: standardize the chainable outputs from CVImage. Will we return a new CVImage or a numpy array? I'm leaning towards the second one, so CVImage's return values can be used as numpy/cv2 inputs, and the ImagePipeline class will handle multiple modification calls.
2021-12-26 21:11:14 -05:00
Martysh12 65315198a2 Merge branch 'main' into gamemodel_basics 2021-12-26 20:04:23 +02:00
Martysh12 ce51ea9a1c Merge branch 'main' into gamemodel_imagepipeline 2021-12-26 20:04:06 +02:00
Martysh12 218aa85549 Ignoring __pycache__ 2021-12-26 20:02:00 +02:00
John McCardle 09f1a586ab Including game assets from https://github.com/notbandali/asteroids 2021-12-26 12:59:25 -05:00
Martysh12 3f5c51603d Merge branch 'screenshot_merge' into gamemodel_imagepipeline 2021-12-26 19:56:30 +02:00
Martysh12 61f080ceac Merge branch 'screenshot_merge' into gamemodel_basics 2021-12-26 19:52:53 +02:00
Martysh12 6cb5c43692 Removed d3dshot
Removed d3dshot because newer Python versions do not support it/its dependencies.
2021-12-26 19:52:37 +02:00
John McCardle a01dbb4a58 CVImage class in imagepipeline module.
TODO: remove all image manipulation code from GameModel class. Moving all the OpenCV image manipulation actions to the CVImage class would make the GameModel procedures more legible.
TODO: abstract multi-step processes in GameModel class as an ImagePipeline. The purpose is to improve testability by making each manipulation action in CVImage to result in a series of images and data structures.
2021-12-25 22:30:30 -05:00
John McCardle e0f6a62709 Masking - don't consider score or lives display when analyzing frame 2021-12-24 13:02:52 -05:00
John McCardle 5499aa5e49 Started classifying on-screen objects with unified "analyse_frame" function
Rocks, lives, and missiles are identified by their rectangles from cv2.matchTemplate.
Clusters from SIFT are checked against these detected rectangles.
The remaining objects (like the rotated ship) are classified as "mysteries". These will be target for further analysis (like ship angle determination), or we can just shoot at them :)
2021-12-23 13:57:50 -05:00
John McCardle 372f250167 SIFT, orthogonal ship image detection (lives), colored debug output
Set up a SIFT method and massively upgraded the debug view to look at the image processing outputs in color.
TODO: the template matching used for unrotated ship icons and asteroids does not work on missiles.
2021-12-22 20:29:36 -05:00
John McCardle f497bdd61a Initial commit of SIFT search for ship sprites
The data returned by the gamemodel function is overly verbose and not interpreted well yet. I'd like to return a (pt, wh, label) tuple like the find_asteroids function does. This would make it compatible with the existing display_results function.
2021-12-21 02:19:12 -05:00
John McCardle d28344971e Refined asteroid finding. Implemented a result display function. 2021-12-21 01:29:15 -05:00
John McCardle ad4616c51e Merging screenshot_basics for gameio dependency 2021-12-21 01:02:26 -05:00
John McCardle 7d07718326 Inheriting cross-platform keyboard methods (non-abstract) 2021-12-21 00:58:59 -05:00
Martysh12 05c29e7e72 Implemented key_up and key_down methods
Implemented key_up and key_down methods in GameIO
2021-12-20 16:12:34 +02:00
John McCardle 48c7d9a890 Initial commit of GameModel class 2021-12-20 04:41:48 -05:00
John McCardle 113d93773e Removed self from super().__init__(self) in LinuxGameIO 2021-12-20 04:39:49 -05:00
Martysh12 82186e4a3a Removed self from super().__init__(self)
Removed self from super().__init__(self) in WindowsGameIO
2021-12-20 04:37:56 -05:00
Martysh12 cd91488a1b Ignoring __pycache__/ 2021-12-20 04:37:56 -05:00
Martysh12 d758442190 Create .gitignore with the Asteroids folder
Create .gitignore with the Asteroids folder, for the ease of contributing.
2021-12-20 04:37:56 -05:00
Martysh12 207761d498 Removed invalid documentation from LinuxGameIO 2021-12-20 04:35:10 -05:00
Martysh12 4ccf6dbdea Create .gitignore with the Asteroids folder
Create .gitignore with the Asteroids folder, for the ease of contributing.
2021-12-20 07:43:07 +02:00
Martysh12 d55ecef953 Fix naming oversight 2021-12-19 21:34:29 +02:00
Martysh12 d04a0b172c Add key_up and key_down methods in GameIO
Add key_up() and key_down() methods in GameIO. key_press() does the aforementioned two functions one after the other.
2021-12-19 21:33:57 +02:00
Martysh12 1a1e8efef8 Moved module to a different file
Moved module to a different file and created a main script.
2021-12-19 21:16:34 +02:00
John McCardle 30a45e6b47 Application screenshot used for window location 2021-12-19 14:11:55 -05:00
John McCardle 1720ee3bbc remove behavior from abstract base method 2021-12-19 14:11:20 -05:00
Martysh12 9eb29fc7cc Changed the naming a bit
Changed the naming a bit
2021-12-19 21:05:25 +02:00
Martysh12 6e5dd7eab4 Introduced Abstract Base Classes
Introduced Abstract Base Classes to ease the process of adding another platform.

Also some minor documentation.
2021-12-19 21:01:11 +02:00
Martysh12 bfcb0650e6 Changed os.name to platform.system()
Changed os.name to platform.system() because platform.system() is much more reliable, and is easy to check for different system.

Also added a check for linux.
2021-12-19 20:29:38 +02:00
Martysh12 b5c4bbcdd9 Added simple documentation and a shebang
Added simple documentation and a shebang and fixed a simple error at line 32.
2021-12-19 20:26:08 +02:00
Martysh12 555ecfa7a3 Added newlines and sorted imports
Added newlines and sorted imports according to PEP-8.
2021-12-19 20:18:07 +02:00
John McCardle 3f9af5012c Cross-platform basics on capturing the game screen to a PIL image. 2021-12-19 13:02:58 -05:00
Error_404 64ac273833
Create README.md 2021-12-19 22:03:44 +05:30