« first day (44 days earlier)      last day (3528 days later) » 
10:00 - 19:0019:00 - 00:00

7:03 PM
@bazola it probably hangs because this.play is locking when reading from the Scanner
@bazola that is exactly what "swallowing exceptions" mean :)
 
 
Step 2: Read tutorial. Step 1: Implement steps from tutorial.
 
Umm... step 2, then step 1?
 
I've seen a couple different ways to handle them, so I just left them blank :) but I put in the stack trace for now
 
@SimonAndréForsberg Yes ;)
 
7:08 PM
this is definitely more helpful now :)
--- exec-maven-plugin:1.2.1:exec (default-cli) @ cardshifter-fx ---
java.net.NoRouteToHostException: No route to host
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
when i put in a bad ip
 
Oh crap... Still forgot to test #13 ;)
 
7:11 PM
Don't worry, it works ;)
 
Besides, testing the Lua stuff is hard...
 
@SimonAndréForsberg It's not hard to test them, unit testing would be hard... But integration tests are there to ensure features work (like enchanting, then you need to use a specific trace that goes through enchanting)
 
7:14 PM
@skiwi true, it's not hard, it's just that it would require quite a lot of code
 
@SimonAndréForsberg You've got to do those either way, unit tests are nice and all, but you need to test an actual execution as well... preferably with as many elements as possible
 
We might need to find a solution for pulls when there are lots of commits in there
 
@skiwi absolutely, I have nothing against integrations tests in general (that's how I did my entire Hearthstone testing).
 
7:16 PM
 
@SimonAndréForsberg I am trying to do new Thread(this::play).start(); and it says "incompatible thrown types IOException, InterruptedException in method reference"
 
@skiwi for @Duga you mean?
 
@SimonAndréForsberg Yes
 
7:16 PM
@skiwi agreed :)
 
@bazola the method reference you are passing to new Thread may not throw any exceptions I think
 
@SimonAndréForsberg It expects a general Runnable, which indeed does not allow for exceptions
 
7:17 PM
@skiwi s/Duga/@bazola/
 
Does it never stop?!
 
interesting.. I guess I just need to handle those exceptions inside the method then?
 
7:20 PM
@bazola Yes, usually with Java 8 I rely on runtime exceptions
 
There is this idiom that a runtime exception indicates a programmer error, and a non-runtime exception indicates a logic error
 
If you input an IP adres that is malformed, then I call it simply a programmer error, as it should not have been malformed, it's the same as a IllegalArgumentException
 
7:22 PM
thats a good idiom I think
 
are you done now @Duga ?
 
Surprising the chat throttle didn't kick in
 
@SimonAndréForsberg I have this code inside of CameClientLauncherController, it successfully runs switchToMainGameWindow and it calls closeWithSuccess, but it does not actually close the launcher window:
	private void buttonClick(ActionEvent event) {
		//Get values from the TextFields
		String ipAddressValue = this.getCharactersFromTextField(ipAddressBox);
		int portValue = Integer.parseInt(this.getCharactersFromTextField(portBox));

		//Attempt to make a connection
		try {
			//Send a test to the server, to make sure that it is valid

			//if it is valid
			errorMessage.setText("Success!");
			this.switchToMainGameWindow(ipAddressValue, portValue);
			this.closeWithSuccess(event);

		} catch (Exception e) {
 
@bazola what does your switchToMainGameWindow method do?
 
:( Nothing happened when I tagged?
 
7:25 PM
	private void switchToMainGameWindow(String ipAddress, int port) {
		try {
			FXMLLoader loader = new FXMLLoader(getClass().getResource("ClientDocument.fxml"));

			Parent root = (Parent)loader.load();

			GameClientController controller = loader.<GameClientController>getController();
			controller.acceptIPAndPort(ipAddress, port);
			controller.connectToGame();

			Scene scene = new Scene(root);

			Stage gameStage = new Stage();

			gameStage.setScene(scene);
			//stage.centerOnScreen();
			gameStage.show();
these are my indent settings, are they still incorrect? it seems more messed up than before I changed it:
 
@bazola Does it show the new window?
 
@SimonAndréForsberg yeah it does, just doesn't close the old one
 
@bazola the catch block should be indented one step further
@bazola looks correct
 
Hmm the tag looks very bare :( Simply 0.1, we should consider a new scheme for 1.x :)
 
7:27 PM
@SimonAndréForsberg on my screen the indentation looks right
 
@bazola I would either add a simple System.out.println somewhere to check if that part of the code is run, or step through the code with a debugger
@bazola let it be then
 
[Cardshifter/Cardshifter] build #73 for commit 9197797e on branch 0.1 passed
 
@Duga I don't think there's a 0.1 branch there, @Duga
 
i fixed it actually by switching them around, now it closes the window. Must be that calling the new Stage messed everything up with the old stage:
			errorMessage.setText("Success!");
			this.closeWithSuccess(event);
			this.switchToMainGameWindow(ipAddressValue, portValue);
 
That's what I suspected, that the switchToMainGameWindow blocks somewhere, I just don't know where.
 
7:30 PM
WTF, it worked in one try?!
 
@skiwi @bazola I personally more and more feel that the ECS approach is the way to go, I have a nice little 'framework' for it and the "Phrancis-game" is nearly finished. It is possible to use varying levels of abstraction when doing this (I tend to perhaps use a little bit more than needed), but I feel that it is very powerful and flexible. I do wonder though: Will we end up using it or not?
 
@SimonAndréForsberg I don't know yet... I have not seen enough of it, some kind of design document would be nice ;)
 
What would you like me to write in the design document?
How it all fits together?
 
7:33 PM
Yes, it would be nice to have the design in the design document
 
good point ^^
 
[Cardshifter/Cardshifter] build #74 for commit 9197797e on branch develop passed
[Cardshifter/Cardshifter] skiwi2 deleted branch release-0.1
 
This wasn't all that bad :)
 
@SimonAndréForsberg well I am definitely open to ECS. I do not know how I would change the client/server model to work and pass all the information back and forth between the client and the server, so if you have that solved in ECS then it definitely has a huge advantage versus our other code base
as long as you think the rest of us can understand it :)
 
Well, even if you can't understand it I am sure that you can learn to understand it :)
 
7:41 PM
thats really all i meant :)
 
I have a plan for how to make it work with the GUI and client/server, I just need... time :)
 
i feel like my skill set will be more valuable once we are playing the game and trying to balance the gameplay
 
That ^^ is a very important part
 
@SimonAndréForsberg Can you once again explain me the essence of a ECS, in general?
 
7:53 PM
ECS
---
Entity Component System.

Entities has component stored on them.
Components are mostly data.
Systems, in this variant, listens for events and perform stuff on entities and their components.
@skiwi is that a good start? ^^
 
> When a build status update occurs on a tag, then it incorrectly references a branch:
[Cardshifter/Cardshifter] build #73 for commit 9197797e on branch 0.1 passed

While it should say: ... on tag 0.1 passed
 
@SimonAndréForsberg It's a start yes
Then describe what our systems, entities and components are
 
Entity
--------
What is an entity?

An Entity is any object that can have components attached to it.
An Entity gets processed by Listeners (Systems)

Example entities:
Cards are entities. Also players.
In some games it could be useful even for zones to be an entity.

The game can also have some 'global' things stored in an entity,
such as the information about who's turn it currently is.

An Entity is a **final class**. Entities should not be extended.
 
one thing that helped me understand it was that you use the Components as Keys to access the data, so an Entity may have Component1 and Component2, and the system looks through and says, If an Entity has Component1 and Component2, then I will perform these operations on those Components. Otherwise the system will ignore those components (unless they match what the system is looking for)
 
Component
---------
What is a component?

A component is data. Information stored about entities.

Zones are components. A Card is a component (a player is also an entity, but cannot move between zones like a card does)

Another component example is PlayerComponent, that are stored on player-entities.
There is also a 'CreatureType' component that can be stored on creatures that indicates a specific creature typ (Mechanical Bot, Beast, Alien, etc...)

ActionComponent for storing information about available actions that a player have.
Systems/Listeners
-----------------
When game is first started, they can do some 'setup work', such as making a player draw a specific amount of cards.
Often systems only add a listener when game is started, so that it is alerted when something happens, such as a card is drawn, a resource value is changed.

Example systems:
AttackYGOSystem, AttackHearthstoneSystem (Switch between them by only changing one line of code!)
LimitedPlaysPerTurn - Can be used to limit a player to only do a specific number of actions per turn.
 
8:00 PM
Now I am interested in how moddability can come into play
 
I'm working on writing that part :)
 
@SimonAndréForsberg what exactly sends the message to the console "Waiting for opponent" and how does the NetworkConsoleController know how to output that
 
@bazola It is actually the server that sends that message
It is the WaitMessage
(which is handled a bit ugly at the moment, yes...)
 
Now I've got to see what is next up for me... I'll be busy though
I'm happy release 0.1 is done
 
@skiwi where is the download link?
 
8:07 PM
 
very awesome on 0.1 :)
 
> Travis is still running on Java 8u5, we should force it to update to the most recent version, github.com/skiwi2/JavaLuaInteropTest has the code for that task somewhere.
 
Time to take yet another look at the history ;)
 
@skiwi Here's a description about the moddability:
How to make a mod?
------------------
Creating a mod requires almost no programming experience at all. Because there is a number of possible systems available already,
making a mod becomes almost a matter of *configuration*

If you feel that some component/system is missing, then it is not too hard to hook into the ECS API and make your own component/system.
Components and systems can also hook into Lua (although it is easier to make them in Java directly), you can have a Component that stores a LuaTable for example, and a system that calls a LuaFunction.
public class DrawCardTakeDamageSystem implements ECSSystem {

	private final int damage;
	private final ResourceRetreiver resource;

	public DrawCardTakeDamageSystem(ECSResource resource, int damage) {
		this.damage = damage;
		this.resource = ResourceRetreiver.forResource(resource);
	}

	@Override
	public void startGame(ECSGame game) {
		game.getEvents().registerHandlerAfter(DrawCardEvent.class, this::damage);
	}

	private void damage(DrawCardEvent event) {
		resource.resFor(event.getOwner()).change(-damage);
 
Our commit statistics are updated as well btw, I think they work on master only?
 
8:13 PM
@skiwi yes, that is correct
 
^ I'm still a bit confused on how to implement the modding
I see the Java side working
Can we have our mod-connector create an anonymous ECSSystem instance?
 
@skiwi Do you mean for the Lua part?
 
> started building client game GUI
 
@SimonAndréForsberg Yes
But I could see some things working
 
@skiwi Don't worry, I have a plan!
What exactly are you not sure of? ("modding" is a quite big topic)
 
8:16 PM
drawCardTakeDamageSystem = host:luatools:createSystem(startGameFunction)
If such things can work
 
@skiwi I absolutely think that can work
 
[Cardshifter/Cardshifter] build #75 for commit 0c19ae75 on branch javafx passed
 
Our network graph got completely updated?
Oh, WTF, you can scroll through it?!
 
yeah, it tends to switch the rows and colors of the branches some times
 
(or drag)
 
8:19 PM
@skiwi lol, congratulations :) (guess why I love it so much)
 
If only I could see the branch names somewhere on the start
 
[URL](http://www.cardshifter.com) - [Q&A](http://www2.zomis.net/tcg-creation/) - [Github](https://github.com/Cardshifter/Cardshifter) - [Network](https://github.com/Cardshifter/Cardshifter/network)
that's how much I love it ^^
 
haha
 
and now I don't have to re-write that damn thing next time it's changing!
 
TIme to call it a night day
 
8:28 PM
Night @skiwi
 
what does List<?> mean
 
@bazola that it can be any kind of list
 
i see
private void outputList(final List<?> actions) { what are the different types of actions that can come from this?
 
@bazola Alt + F7 is your friends (or Ctrl + Alt + H in Eclipse)
 
what is the name for what that does
this is an interesting error message:
Exception in thread "Thread-6" java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-6
 
8:44 PM
@bazola "Find usages"
 
cool, ty
 
@bazola That is a very common message when dealing with JavaFX and multiple threads. The solution is here:
19
A: JavaFx 2.x - Swing : Not on FX application thread

RobinSee the 'JavaFX in Swing' tutorial. You are performing JavaFX operations which should run on the JavaFX thread on the Swing thread (Event Dispatch Thread). Luckily they learnt from their previous mistakes and now throw exceptions when you perform operations on the wrong thread. That is the excep...

(Although the "in Swing" part is totally irrelevant to the subject)
 
that is interesting as well.. all I did was change a label though, so am I going to have to surround all calls to the JavaFX with that code?
 
@bazola Actually, you can use a lambda so that it is only one line. Platform.runLater(() -> someLabel.setText(someValue));
You need to surround the calls when you're not on the JavaFX thread
if you want to do multiple things you can use this syntax:
Platform.runLater(() -> {
    someLabel.setText(someValue);
    someOtherLabel.setText(someValue);
    something.setSomething(someValue);
});
 
cool :)
it would be useful to be able to ask the server for a single player game so that i wouldnt have to run two clients for basic testing
 
8:59 PM
[Zomis/Cardshifter] Zomis pushed commit 727fe6fe to ecs
> Added toString methods for Entity and Zone
[Zomis/Cardshifter] Zomis pushed commit f3aeb919 to ecs
> Added functionality for removing an entity from the game entirely
 
@bazola hmm... why haven't I thought of that?
 
[Zomis/Cardshifter] Zomis pushed commit 39da2381 to ecs
> ComponentRetriever for when there is only one such component in the game
[Zomis/Cardshifter] Zomis pushed commit 707d7d5a to ecs
> Corrected GameOverIfNoHealth system
[Zomis/Cardshifter] Zomis pushed commit 010c66be to ecs
> ResourceValueChange Event includes information about which resource
[Zomis/Cardshifter] Zomis pushed commit 0997b822 to ecs
> Fixed ActionTest
[Zomis/Cardshifter] Zomis pushed commit 15e6b71b to ecs
> Added Entity owner to DrawCardEvent
 
well I didn't think about it until the 40th time I had to type in the IP address... :)
2
 
guess why I made the NetworkConsoleController always connect to localhost ;)
 
[Zomis/Cardshifter] build #17 for commit 15e6b71b on branch ecs errored
 
9:02 PM
Hmm... I bet there's a class I forgot to add
 
it sucks that testing and real case scenarios are so different as to require different code for best efficiency
 
[Zomis/Cardshifter] Zomis pushed commit 8b16cf85 to ecs
> Added very useful systems
 
@bazola How do you mean?
 
well in the real world you would not want to hard code the IP for connecting, so I built a UI to input that information, which may be useful when we are testing real games against each other, but is actually a hindrance when trying to test by myself to get a GUI client working
 
true, true
 
9:08 PM
[Zomis/Cardshifter] build #18 for commit 8b16cf85 on branch ecs passed
 
9:24 PM
@skiwi About ECS... imagine how much cleaner this method would be if everything was an entity and the entities had a ActionComponent
 
9:40 PM
> first try at rendering choices from server (not working)
[Cardshifter/Cardshifter] build #76 for commit e66c3ae7 on branch javafx passed
> Server now initializes one AI that wants to play, for easier testing
 
@bazola Feel free to pull my changes if you want an automatic AI on the server
git pull origin client-server
 
10:04 PM
[Zomis/Cardshifter] Zomis pushed commit eaef7b04 to ecs
> Added an (unfinished) implementation of the 'Phrancis-game'
[Zomis/Cardshifter] Zomis pushed commit 5f90be9a to ecs
> Renamed System to ECSSystem because of collision with java.lang.System
[Zomis/Cardshifter] Zomis pushed commit 93ae67e1 to ecs
> Organized some components and systems into category instead of type
 
@Duga That was a horrible name chosen by me in the first place
@Duga That was well-needed
 
[Zomis/Cardshifter] build #19 for commit 93ae67e1 on branch ecs passed
 
cool will do
 
And don't forget to push once you have done so
 
now what should I call the commit that I do when I pull stuff down like this?
 
10:16 PM
> getting changes from client-server
 
gets stuck here:
Start loop
Enter your name:
Sending: {"command":"login","username":"Player37"}
iterator: com.cardshifter.server.outgoing.WelcomeMessage@63093aa6
OK
Sending: {"command":"startgame"}
iterator: com.cardshifter.server.outgoing.WaitMessage@26d3e7c0
Waiting for opponent...
 
[Cardshifter/Cardshifter] build #78 for commit d69611cd on branch javafx passed
 
Are you sure that you only started one client?
 
i think so, but maybe not.. it worked the second time
 
10:19 PM
it would also probably help if I restarted it :)
 
yes, restarting server can help :)
 
getting an address already in use error
seems like nothing is closing cleanly for me..
 
Address already in use indicates that you already have the server running
 
hmm
guess I will try a reboot, it is definitely running even though I have shut them all down
 
lol ^^
alright
 
10:40 PM
is there a command to shut the server down
 
@bazola There is soon :)
 
> Exit command to shut down the server (the hard way)
 
^^ Now there is, @bazola
 
cool lol
 
10:50 PM
I love git :)
simply write 'exit' in the console to shut it down
 
> getting client-server changes

exit command
 
i just think it is strange having to commit and push again after every pull, but I guess that is just how it works. But what should I be putting as the message when I do so? is there standard practice for that?
 
[Cardshifter/Cardshifter] build #80 for commit 4859b1e6 on branch javafx passed
 
gotta reboot again, be back in a bit
 
11:08 PM
@bazola Whenever I do so, I get an automatic commit message. It also seems that you do some kind of rebase instead of a merge, that is quite interesting...
 
> Comments including links in code are normally very useful. Probably especially for nCr, nCr perform, NNKK
> Refactoring GroupValues and FieldGroup to use composition over inheritance will make the usage of those classes clearer, and will help in improving the performance. GroupValues uses the non-primitive Integer for example, while a good old int would suffice.
 
11:31 PM
I am surprised that my JavaFX question still does not have an answer
[2014-09-15 18:31:19,895]  INFO ServerConsole [Console-Thread] (    ServerConsole.java: 29) - Console input: exit
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 16.446s
Finished at: Mon Sep 15 18:31:20 CDT 2014
Final Memory: 5M/108M
------------------------------------------------------------------------
exit works! hehe
 
I've been wanting to review it, but I haven't gotten around to it
If you look at my recent reputation change on CR, you will see that it is not as high as it used to be.
 
I just figured that we had enough Java gurus around for someone to want to tackle it :)
the reason why I needed an exit was that it seemed like I was killing the server by doing this:
			try {
				int actionIndex = 0;
				UseableActionMessage action = actions.get(actionIndex);
				if (action.isTargetRequired()) {
					this.send(new RequestTargetsMessage(gameId, action.getId(), action.getAction()));
				}
				else {
					this.send(new UseAbilityMessage(gameId, action.getId(), action.getAction(), action.getTargetId()));
				}
			}
but I think it might have been working, and just drawing all the cards until they ran out and then getting stuck
 
did you put that code in a loop or something?
 
its in a while statement yeah
but that was how you had it set up in the console controller
 
and you don't do anything in between that slows things down?
Yes, but I slow things down by reading from the console input
 
11:35 PM
what I did was remove the input from the methods, and comment this out:
			String inputLine = input.nextLine();
			if (inputLine.equals("exit")) {
				break;
			}
and I was trying to get the client to render the available actions on screen somehow, but I haven't been able to get that working
it seems like I will have to change the methods somewhat to get things to work properly
 
yeah, that will cause an infinite loop then which will send a huge amount of messages to your server
You shouldn't do everything the same that I do :)
 
well I have to use your methods as a starting point to try to understand how to communicate with the server :)
 
@bazola yes, that part is difficult. The NetworkConsoleController doesn't use the Card and Zone and Game classes at all, it's just input/output
@bazola yes, that indeed :)
Have you been able to handle any other messages the server sends?
Because it will send you information about zones, cards, players...
 
I was able to get it to successfully render Waiting for Opponent... with a FXML label, but it doesn't go away
I just have to restructure everything into a proper rendering loop, etc
 
As soon as you get another message you can make that one go away
 
11:39 PM
i have to make it do something like ask the server for a message, and then wait until the player sends input from the GUI. I think I can make that work with some more work
 
@bazola the server sends you the messages whether you ask for them or not
you just need to retreive them
 
right now I am doing this inside play():
		try {
			Message message = messages.take();
			if (message instanceof WaitMessage) {
				System.out.println(((WaitMessage) message).getMessage());

				Platform.runLater(() -> serverMessage.setText(((WaitMessage)message).getMessage()));

				NewGameMessage game = (NewGameMessage) messages.take();
				this.playLoop(game);
			}
			else {
				this.playLoop((NewGameMessage) message);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
 
that looks like a good start
playLoop method is the important one though
 
yeah
what exactly happens when you send playLoop game?
 
@bazola check the method, what does it say?
(In other words: I don't know, remind me of the code)
 
11:46 PM
it gets a gameId, and then it does this with it?
				if (action.isTargetRequired()) {
					this.send(new RequestTargetsMessage(gameId, action.getId(), action.getAction()));
				}
				else {
					this.send(new UseAbilityMessage(gameId, action.getId(), action.getAction(), action.getTargetId()));
				}
along with Scanner input, which is the part I have removed
 
Yes, right...
the thing is that as this is multi-threaded, the listen method plays a big part here
The playLoop only asks the console for input about what to do next
I don't think you need the while-loop in the playLoop method. A GUI doesn't need that kind of loop.
The input should come from the GUI, not from a loop
And then in the listen method, you'll have to filter out interesting messages and handle them (i.e. make the GUI show something)
 
I was thinking that about the while loop, but I was very unsure about listen
 
The while loop in listen holds the key
Currently, its most useful feature is this line: System.out.println("iterator: " + mess);
i.e. it prints all the messages it receives from the server to System.out
i.e. user experience = horrible
 
my plan is to parse that text and render as much of a UI as possible
 
if you add some more mess instanceof checks in the while loop, for ZoneMessage, CardMessage and some others, and paint stuff in the GUI when your receive those messages, then you will probably have better progress.
Don't focus on parsing the text, Jackson takes care of that. All messages gets instantiated as a **Message class
 
11:53 PM
cool
 
In cardshifter-api/com.cardshifter.server.outgoing you can see the possible messages that the server can send to the clients
 
why is messages in Test Packages?
 
There is a com.cardshifter.server.messages both in cardhsifter-server/test and in cardshifter-api/main
 
I'm confused as to why. Anyway, Message is just a string? I guess there are two messages, one for the Type and one for some other value?
 
10:00 - 19:0019:00 - 00:00

« first day (44 days earlier)      last day (3528 days later) »