maikmerten / chainreaction Goto Github PK
View Code? Open in Web Editor NEWExperimental Java game based on "Nuclear Reaction" by Robert Akerberg
License: GNU Lesser General Public License v3.0
Experimental Java game based on "Nuclear Reaction" by Robert Akerberg
License: GNU Lesser General Public License v3.0
When tinkering around and having some bigger chain reactions some cells barf out with the following exception. Afterwards there are cells without atoms but with a player color still assigned.
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 4
at de.maikmerten.chainreaction.swing.UICell.putAtomInternal(UICell.java:126)
at de.maikmerten.chainreaction.swing.UICell.addAdtom(UICell.java:67)
at de.maikmerten.chainreaction.swing.UICell.moveTo(UICell.java:77)
at de.maikmerten.chainreaction.swing.UIField.onAtomsMoved(UIField.java:90)
at de.maikmerten.chainreaction.swing.SwingFieldListener$2.run(SwingFieldListener.java:46)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 4, Size: 4
at java.util.ArrayList.rangeCheck(ArrayList.java:604)
at java.util.ArrayList.get(ArrayList.java:382)
at de.maikmerten.chainreaction.swing.UICell.removeAtom(UICell.java:71)
at de.maikmerten.chainreaction.swing.UICell.moveTo(UICell.java:76)
at de.maikmerten.chainreaction.swing.UIField.onAtomsMoved(UIField.java:90)
at de.maikmerten.chainreaction.swing.SwingFieldListener$2.run(SwingFieldListener.java:46)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:371)
at java.util.ArrayList.get(ArrayList.java:384)
at de.maikmerten.chainreaction.swing.UICell.removeAtom(UICell.java:71)
at de.maikmerten.chainreaction.swing.UICell.moveTo(UICell.java:76)
at de.maikmerten.chainreaction.swing.UIField.onAtomsMoved(UIField.java:90)
at de.maikmerten.chainreaction.swing.SwingFieldListener$2.run(SwingFieldListener.java:46)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
at de.maikmerten.chainreaction.swing.UICell.putAtomInternal(UICell.java:126)
at de.maikmerten.chainreaction.swing.UICell.addAdtom(UICell.java:67)
at de.maikmerten.chainreaction.swing.UICell.moveTo(UICell.java:77)
at de.maikmerten.chainreaction.swing.UIField.onAtomsMoved(UIField.java:90)
at de.maikmerten.chainreaction.swing.SwingFieldListener$2.run(SwingFieldListener.java:46)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:371)
at java.util.ArrayList.get(ArrayList.java:384)
at de.maikmerten.chainreaction.swing.UICell.removeAtom(UICell.java:71)
at de.maikmerten.chainreaction.swing.UICell.moveTo(UICell.java:76)
at de.maikmerten.chainreaction.swing.UIField.onAtomsMoved(UIField.java:90)
at de.maikmerten.chainreaction.swing.SwingFieldListener$2.run(SwingFieldListener.java:46)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
We sure need a logo for the splash screen and a small version for the other windows
I added retrofont support for the status text in dee95e8, but there are still rendering issues (see image). I added in UIStatus:97ff
an ImageIO.write()
that writes to /tmp/status<round>.png
, so that you can see the result:
Please remove that block after fixing this bug.
Accompanying the animations.
API for drawing C64 font on graphics2d, like this:
/**
* @return 8x8 pixel Image
*/
public static Image getC64Char(char theChar);
/**
* @return a FAST_SCALE scaled image for given font size (kind of multiplicator for 8x8 size image)
*/
public static Image getC64Char(char theChar, int fontSize);
Currently all code is contained in subpackages of de.maikmerten. Given that this project is now under the stewardship of several persons we perhaps should choose a package name that reflects this. Thoughts?
Player should be able to choose a name (beside "Human")
I would like to add this game (and the C64 version) to osgameclones.com but I'm needing references to the original game. I can't find any references on MobyGames or Wikipedia, could you possibly point me in the right direction? I can only find the original game to download, plus a couple of YouTube videos.
Once I had a constellation leading to the following stack trace:
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: You cannot create an atom for no player
at de.freewarepoint.cr.swing.UIPlayer.createAtom(UIPlayer.java:54)
at de.freewarepoint.cr.swing.UICell.putAtomInternal(UICell.java:123)
at de.freewarepoint.cr.swing.UICell.addAtom(UICell.java:64)
at de.freewarepoint.cr.swing.UICell.moveTo(UICell.java:74)
at de.freewarepoint.cr.swing.UIField.onAtomsMoved(UIField.java:95)
at de.freewarepoint.cr.swing.SwingFieldListener$2.run(SwingFieldListener.java:46)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at de.freewarepoint.cr.swing.UICell.draw(UICell.java:88)
at de.freewarepoint.cr.swing.UIField.paint(UIField.java:160)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:295)
at javax.swing.RepaintManager.paint(RepaintManager.java:1206)
at javax.swing.JComponent._paintImmediately(JComponent.java:5169)
at javax.swing.JComponent.paintImmediately(JComponent.java:4980)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:770)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:728)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:677)
at javax.swing.RepaintManager.access$700(RepaintManager.java:59)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1621)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at de.freewarepoint.cr.swing.UICell.draw(UICell.java:88)
at de.freewarepoint.cr.swing.UIField.paint(UIField.java:160)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:295)
at javax.swing.RepaintManager.paint(RepaintManager.java:1206)
at javax.swing.JComponent._paintImmediately(JComponent.java:5169)
at javax.swing.JComponent.paintImmediately(JComponent.java:4980)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:770)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:728)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:677)
at javax.swing.RepaintManager.access$700(RepaintManager.java:59)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1621)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:371)
at java.util.ArrayList.get(ArrayList.java:384)
at de.freewarepoint.cr.swing.UICell.removeAtom(UICell.java:68)
at de.freewarepoint.cr.swing.UICell.moveTo(UICell.java:73)
at de.freewarepoint.cr.swing.UIField.onAtomsMoved(UIField.java:95)
at de.freewarepoint.cr.swing.SwingFieldListener$2.run(SwingFieldListener.java:46)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
The retro font is very cool and by the way very retro. Perhaps it become a dedicated project. I could imagine that there might be many project with a need for such a retro font. And the library could grow (e.g., wobbling, color changing, fading (retro) text).
... and sound effects.
In order to check, which AI is best, the game should have a tournament mode, where it starts the game in headless mode and plays e.g. a hundret games between each pairing of AIs available and builds then a ranking from the results
The Game should be divided in some artifacts in order to separate GUI, backend, API, and AI. This will help to implement other clients/AIs.
'byte player' and similar constructs seem to be artifacts from the C64. They should be replaced with OO concepts as needed
Add a splash screen
Menu in C64 style
The background should fade to the next owner color:
Shouldn't we have a static Homepage, with a short description, link to the github project, some screenshot and a "binary" (jar) download? It should have a black background. As soon as we have a logo, we should add it to the page.
What do you mean?
In SwingFieldListener there is a 'delay' attribute. It could be configured to be set to different predefined values in order to have fast game play or comprehensible chain reactions (e.g., no time, very fast, fast, normal, slow, really slow, unbelievably slow)
C64-ish main (game) window with nice images for the current player aside the game field. Status "bar" and Settings "bar" should be in a separate menu
A function to undo one move (or more) would be nice.
Select a AI in menu loaded from the AIs/ folder (see #3 )
Cell-bg (as it has an owner) and ball animation (enter, leave, idle) should be toggable.
When an AI is used which was loaded from the config directory, this exception is thrown:
Exception in thread "AWT-EventQueue-0" java.lang.AbstractMethodError: de.maikmerten.chainreaction.ai.DummyAI.setGame(Lde/maikmerten/chainreaction/Game;)V
at de.maikmerten.chainreaction.swing.UIGame.startNewGame(UIGame.java:60)
at de.maikmerten.chainreaction.swing.UIGame.<init>(UIGame.java:36)
at de.maikmerten.chainreaction.swing.UIGame$3.run(UIGame.java:127)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:711)
at java.awt.EventQueue.access$000(EventQueue.java:104)
at java.awt.EventQueue$3.run(EventQueue.java:672)
at java.awt.EventQueue$3.run(EventQueue.java:670)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:681)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
To reproduce this:
Exception in thread "Thread-138" java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@69e4d7d rejected from java.util.concurrent.ThreadPoolExecutor@2f14cf0[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 63]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2013)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:816)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1337)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:110)
at java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:639)
at de.freewarepoint.cr.swing.SwingFieldListener.executeDelayed(SwingFieldListener.java:85)
at de.freewarepoint.cr.swing.SwingFieldListener.onAtomAdded(SwingFieldListener.java:37)
at de.freewarepoint.cr.Field.fireOnAtomAdded(Field.java:234)
at de.freewarepoint.cr.Field.putAtom(Field.java:109)
at de.freewarepoint.cr.Game.selectMove(Game.java:61)
at de.freewarepoint.cr.ai.StandardAI.doMove(StandardAI.java:106)
at de.freewarepoint.cr.ai.AIThread.run(AIThread.java:27)
The bubbles fly beyond the boundaries of the targeted fields. They should also decelerate, the explosion itself happening in near-zero time.
How should we test the game? Is there a github or other free continuous integration server solution available, we could use? Should we add unit tests and integrate them in the maven build cycle?
Ideas?
Their should be a mode for letting compete AI vs. AI
Currently, MoveListener#onMoveSelected()
does not say whether a move has been done or not. This leads to interesting code in the exampleAI (trying up to thousand times to place a move on a random field).
... so that no more moves can be done
There should be a nice explosion animation for the cells
Every AI should give a score to every cell, and the game does the move of the cell with the highest score (this is a change of the AI API).
Then in 'AI testing' mode the game interrupts after the AI has calculated cell scores, shows them in the uifield, preselects the field it will choose and waits for the user to click anywhere or press enter or something similar (like a breakpoint). This way a AI developer can test his AI in various situations (and against other AIs) and track its decisions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.