Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coontroller Input Handling #109

Open
MatthewBregg opened this issue Mar 18, 2015 · 2 comments
Open

Coontroller Input Handling #109

MatthewBregg opened this issue Mar 18, 2015 · 2 comments

Comments

@MatthewBregg
Copy link
Collaborator

Wait. We need to talk about all the queues and the infinite loop problem and stuff. Right now, the online version works in the dungeon, but my screen won't refresh if someone else sends commands to my map. I have to press a key for the screen to refresh. I can either make it so that when one person moves, everybody IO_Bundles sent to them (not a good idea) or I can ask the Controller to ask for a new IO_Bundle every 500 milliseconds if no key command interrupt was received. I think the second would be better. I also added a lot of print statements to master to make it easier to find out what is causing the bug. But I think the whole queue thing is a bad idea and that you don't actually need to store key commands at all - just run the first command that you receive and if the user is too quick and overwhelmed the controller with too many commands just ignore those.
@MatthewBregg
Collaborator

MatthewBregg commented 27 seconds ago
As for the above, yeah, that could be set simply by reducing the sleep.

I think the queues are a better solution than not having the queues, and it's literally more or less the solution from the book.
Dropping commands should be a last resort.

@MatthewBregg
Copy link
Collaborator Author

Problem might be in map:
Test via callign send command like 10 times.

Alternatively:
Add cooldown to input.

Memory issue?

@MatthewBregg
Copy link
Collaborator Author

Exception in Internet.sendStuffToMap(avatar, DO_ABSOLUTELY_NOTHING,...) named: java.io.EOFException
java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2598)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1318)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at src.Internet.sendStuffToMap(Internet.java:100)
at src.io.controller.GameController.sendCommandToMapWithText(GameController.java:199)
at src.io.controller.GameController.updateViewsAndMap(GameController.java:273)
at src.io.controller.GameController.takeTurnandPrintTurn(GameController.java:281)
at src.io.controller.Controller.takeTurnandPrintTurn(Controller.java:110)
at src.io.controller.Controller.process(Controller.java:94)
at src.io.controller.GameController.process(GameController.java:299)
Using internet to sendCommandToMapWithText
at src.io.controller.Controller.sleepLoop(Controller.java:76)
at src.io.controller.GameController.(GameController.java:159)
at src.RunGame$2.run(RunGame.java:220)
at java.lang.Thread.run(Thread.java:745)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant