Thanks, @Springrbua 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
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 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
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 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 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
Sorry about that guys 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
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.