The Marionette Cards -- WIP multiplayer/singleplayer card game

Thanks, @Springrbua :smiley: I’m haven’t been making much progress with the game for the past couple of days because I’m trying to get the hang of JavaFX. Tip for programmers: when you’re learning a new API/library, try not to jump into things and make sure you get the small things settled before moving on to bigger things. Don’t just glance at a tutorial and say you can do it :stuck_out_tongue: I used to do that, but it definitely doesn’t work.

Yea i guess you should first create another project where you just mess arround with the JavaFX basics. Create a window, a dialog, buttons, try to react on button clicks …
I can imagine, that your buildings can be simple ImageButtons, so the JavaFX-Basics might be enough for a big part of your game…

It would look a little unsightly and unprofessional, though :stuck_out_tongue: Also, I pretty much learned the basics of JavaFX. It’s actually time to convert the currently-text-based game to a legitimate game with graphics. That will take quite some time and there are already 17+ classes. For the first couple of development phases, I won’t bother about the aesthetical aspects of the game except for images and text and all stuff that profoundly affects the gameplay itself. After that, I’ll prepare custom stylesheets and improve the appearance of the game. Can’t wait :smiley:

Alright, I guess I’m more ready than I ever was to get started on the maps and cards algorithm (yes, there’s going to be an algorithm that adds stuff to the map (paths, shops, etc.) without me having to manually re-design the map) but at the same time, I don’t think I can finish all that soon because I have C++ training and stuff, so…yeah. I just thought all of you needed a quick update on the current progress. This is the first game I’ve ever really made (excluding a couple of other small and simple games I made while learning Java) and I can’t say I’ve got really high hopes for The Marionette Cards. I’m obviously not thinking about selling the game, because I’m new to the whole game programming thing. At the very least, my wish is for this game to become fairly popular and I also want this game to retain its popularity unlike many other games which ended up being huge failures.

Yep, I got the cards working. Now it’s the simple matter of making everything look nicer. I’ve even attached another screenshot to the main post :smiley: That screenie just shows how the cards work. The left side is the deck and the right side will be used for the map. Don’t walk away with the idea that the screenie shows exactly what the game’s gonna look like. The game is going to look almost completely different once I fix the cards once and for all (the cards look terrible now, and you can’t do anything with them yet) and once I develop a stylesheet for the whole program.

I’ve created a couple of classes to make it easier for me to add cards, change their properties, align the cards to be positioned three in a row and et cetera. All that is working, so that’s really good news. Don’t bother about the text on the cards, it doesn’t mean anything. And remember, the cards are gonna look a whole lot better once I’m through with them.

I can’t see the new Screenshot, there are only 2 showing the Text-Area (one with Login-Window and one without).

Sorry, my bad :stuck_out_tongue: I’m putting it up now.

EDIT: Yep, it’s up on the main post now.

In case no one saw my previous post on this thread, there’s another screenshot of a very early version of the cards part of the game, so if you’re interested you can go check that out.

I’ve been working on the map lately, and boy, it’s hard. The map is supposed to adjust itself when a shop is added so I don’t have to manually create the map, and it’s definitely not as hard as procedural terrain generation in 2/3D games but since there’s a little bit of pathfinding involved, it can be hard.

Eureka! I finished the algorithm, and it works seamlessly, except that after a while memory usage becomes a problem. Once I’ve sorted out the memory problem (does System.gc() help? A lot of people hate that method :P), I can implement the algorithm and bazinga! I can get to work for legit.

EDIT: I’ve put up a GIF showing how the algorithm works. It doesn’t start from the beginning of the program, but it gives you a rough idea of what’s going on behind the scenes. Basically, a random node (circle) is picked and the program checks if the north, south, east or west rectangle spaces are available. If any one of them is available, that one is chosen to be the position of the next path. I might not have explained it right, but that’s pretty much how it works.

Well, then, now that I’ve finished and implemented the random map generation algorithm I came up with myself (sorry for the lack of modesty; it’s my first time creating an algorithm of that much complexity), I’m working on the cards now. I got the card classes working a week ago or so, but I need to place them correctly on the map and the player deck. And the storage cards might be a bit of a problem, because I need to figure out how exactly I’m supposed to display the stored cards.

I’ve encountered a massive flaw. There are way too many levels of interaction between the card and the main classes, which causes huge problems when modifying the cards. You see, adding objects to panes in JavaFX doesn’t do a lazy copy but clones the object, because it’s basically adding to a List. Which means if I modify the original object, it doesn’t change the object in the list. The things is, there are too many panes (the card is a pane itself, because you need a pane to group text and shapes together), so my code will become incredibly verbose and impossible to work with. Any suggestions?

EDIT: PLAN FAILED. The cards thing is messed up: everything has gone wrong. I didn’t foresee this problem; it’s entirely my mistake. Thankfully, I have a back-up plan that’s not nearly as interesting, unfortunately. I’ve let you all down. The cards seemed to be working initially, before I realised that the way I wove JavaFX and my own little API together was incorrect. The problem is one for which I know the reason, but I’m still unable to fix it without having to re-design the whole program. Let me do a little bit of explaining. Also, @ags1, listen up, since you’re going to be using JavaFX for Vangard too.

In JavaFX, there are different panes. These panes are where you add your GUI components, such as buttons, rectangles, circles, etc. This is the way you actually do it:

pane.getChildren().add(/whatever component you want to add/);

The getChildren() method actually returns a List, thus the add method. By now you should have spotted the inconvenience, but for the sake of those who haven’t, I’ll do a little more explaining.

When you add an object to a List, the List actually clones the object and stores that clone. So when you try and modify the original object, that clone in the List isn’t modified. Now, you might be thinking: ā€œHey, you can just get that List, remove the clone and put in the updated clone, right?ā€ I actually considered that, but there are way too many lists to do it conveniently while keeping the code clean and easy for me and future modders to work with. It mightn’t seem like much of an issue, but trust me, when I build on the game later on, it’ll become hella inconvenient and I’ll go crazy running around fixing the modifications to the cards. Remember, the card itself is a pane, because that’s the only way I can group multiple GUI components together and organise them easily on the main pane.

I really don’t feel like reverting to plan B, which is a completely command-based game, as explained in the main post. It was originally my intention to release the game just like that, but hey, there’s no demand for those kind of games anymore. A shame really: those games can be fun, for me, at least. I’m not going to completely re-design the card system, because that would take months and within those months I could be doing things a lot more productive. This is a major setback: I really believed in the concept and the algorithm. I can’t deny that I learnt loads: I can now use JavaFX! And I’ve learnt never to rely too much on container classes. I’ve mentioned before that this is just a toy project of mine, and I always knew that there was a chance of it failing. Never mind: it doesn’t do to dwell on this failure.

I’m really, really sorry, though. I can’t promise that my next project won’t fail, but I promise you I won’t give up on starting new projects and taking them as far as I can.

Look into loose coupling and see if you can introduce your card concept without any changes to your core game logic. The javafx is just for rendering, so whether you use javafx or a different rendering technology should not cause widespread changes to your model.

I looked into loose coupling, and it can’t help; I’ve tried everything. JavaFX might be for rendering, but the only way to render is to add whatever you want to render to a list. In fact, some layouts don’t allow you to modify their children lists after you add anything to them. You really have to add to a list to render; there’s no other way to render something in JavaFX.

You really need to separate game logic and the visual representation. While a card might be a pane on the GUI, it is just an Object with whatever properties you need.
So i don’t think you really need to change the card (pane), but the cards (Object) properties.
Also: If the Object is cloned, when adding it to the list, can’t you simply assign the object in the list to your object?
Example:

pane.getChildren.add(myObject);
int idx = Collections.binarySearch(pane.getChildren(), myObject);
if (idx >= 0)
    myObject = pane.getChildren().get(idx);

Thank you, thank you, for introducing me to that function! I’ll implement that now and do my best to get things working. Thanks, @Springrbua!

EDIT: I see you made use of Java’s lazy copy…that wouldn’t actually work in C++, but alright, it works.

EDIT: The binarySearch method doesn’t work with an ObservableList, but I just made my own method which does the same thing. Easy…I dunno why I thought the list thing was such a huge problem :smiley:

Sorry about that guys :frowning: I guess I was a little tired and I almost completely gave up. It won’t happen with this project again, I promise!

Well, giving up seems to be a more or less normal thing in game programming. I started a few projects, but finished none of them. After some time i always faced some unpredictable problems with my design. If you are facing those problems you have to think about a new design (which might cause other unpredictable problems) and therefore rewrite a lot of code. A few times those problems made me stop the project and start thinking about a new one.
With my current project i am not facing real problems till now, but i just don’t feel like going on… I really liked the idea and it was a game i wanted to play, but at the moment it is not a game i want to play and so i am not that motivated to go on…

I guess we keep getting new and better ideas. We game developers should really learn to be patient :smiley:

I’ve been learning OpenGL and I see new possibilities. The game still isn’t working out well: there aren’t bugs, but card games aren’t meant to be made in JavaFX and, well, it really isn’t working out. There are tiny bugs which can’t be fixed without re-designing a certain part of the entire system. Going around and trying to make things playable isn’t working. I’ve been trying to add cards on the map itself, but it’s not aligning everything properly and I’ve tried everything. (EDIT: It works now, but in a different way. The shops are coloured circles on the map, and so are the houses. Normal red circles are just there to make the map easier to read.)

I thought about changing the colours of certain circles on the map, so that blue circles can represent shops and green circles can represent banks. It works (EDIT: Yes, it does), but then there wouldn’t be a point in calling this ā€œThe Marionette Cardsā€ if the only cards in the game are the inventory and user cards (EDIT: Actually, when you click on the circles, a window pops up, showing the different items available at the shop). Nothing works completely right, actually (EDIT: well, now it does). I’ve been running around trying to fix the stuff but it’s getting really boring and frustrating :clue: (EDIT: not anymore. I love networking!)

I’ll play around with the same concept and try and come up with a different idea. I might revive this again, but I’ll try and find a better way to use the concept. I’m diving into 3D. Look forward to another thread of mine, I’ll post an update as soon as I can!

EDIT: Nope, I’m still working on this project. I really do want to finish this.

Well, if you think, that JavaFX isn’t the right thing to use here, why don’t you use that chance to learn LibGDX? It is definitly worth taking a look at and even if you still can’t fix the problems with this game, you can still you the things you learned.