Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (736)
Games in Android Showcase (224)
games submitted by our members
Games in WIP (813)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  The Marionette Cards -- WIP multiplayer/singleplayer card game  (Read 13941 times)
0 Members and 1 Guest are viewing this topic.
Offline ShadedVertex
« Reply #30 - Posted 2015-10-25 07:09:35 »

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<Node>. 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.
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #31 - Posted 2015-10-25 22:55:52 »

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.

Offline ShadedVertex
« Reply #32 - Posted 2015-10-26 02:22:13 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Springrbua
« Reply #33 - Posted 2015-10-26 07:09:50 »

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:
1  
2  
3  
4  
pane.getChildren.add(myObject);
int idx = Collections.binarySearch(pane.getChildren(), myObject);
if (idx >= 0)
    myObject = pane.getChildren().get(idx);
Offline ShadedVertex
« Reply #34 - Posted 2015-10-26 08:54:07 »

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 Cheesy
Offline ShadedVertex
« Reply #35 - Posted 2015-10-27 02:00:47 »

Sorry about that guys Sad I guess I was a little tired and I almost completely gave up. It won't happen with this project again, I promise!
Offline Springrbua
« Reply #36 - Posted 2015-10-27 07:03:11 »

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...
Offline ShadedVertex
« Reply #37 - Posted 2015-10-27 08:23:43 »

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

Offline ShadedVertex
« Reply #38 - Posted 2015-10-28 01:16:27 »

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 Clueless (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.
Offline Springrbua
« Reply #39 - Posted 2015-10-28 08:39:50 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ShadedVertex
« Reply #40 - Posted 2015-10-28 14:08:19 »

I'm actually learning LWJGL at the moment and I think it's great Cheesy
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #41 - Posted 2015-10-28 16:45:10 »

Correct me if I'm wrong but the only thing you can't do in JavaFX that you can do in LibGDX or LWGL is use shaders. If you are not using shaders the only reason to prefer LibGDX or LWGL is for significantly better performance. So the specific problems this project faces are not reasons to change from JavaFX.

Offline ShadedVertex
« Reply #42 - Posted 2015-10-29 01:45:31 »

Yeah, you're right, and that actually makes all the difference in the world. JavaFX is meant for modern GUI applications while LWJGL and LibGDX are built for game development. Sure, you can make simple games in JavaFX with really simple graphics, but it's not at all suited for game development on this scale. If you only want to use JavaFX for the game GUI, then that's fine. But the core graphics of the game should not be created and rendered using JavaFX. Believe me, it seemed like a good idea to me at first, but it's more inconvenient than you think. LWJGL offers more control over every element of the game, even the GUI, and it's not all about pop-up windows and alert boxes and stuff.
Offline Springrbua
« Reply #43 - Posted 2015-10-29 07:21:34 »

@ags1 you are right, i just mentioned LibGDX, as ShadedVertex encountered some problems with JavaFX. As i don't know JavaFX (yet), i couldn't tell if the problem was only related to his design or related to JavaFX.
@ShadedVertex JavaFX might not be made for complex games, but i guess it stil could be used for them. The JavaFX part would only be the visual part. And as long as you can render Textures you can do more or less everything you need with JavaFX. The drawbacks might be, as ags1 said, the performance and the shaders, which you can't use. But the rest should be posible with JavaFX (and i guess even with Swing Cheesy).
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #44 - Posted 2015-10-29 11:05:30 »

Just to be clear, I am referring to the 2D and 3D graphics APIs offered by JavaFX, not to the JavaFX GUI widgets.

http://docs.oracle.com/javafx/2/canvas/jfxpub-canvas.htm

https://docs.oracle.com/javase/8/javafx/graphics-tutorial/javafx-3d-graphics.htm

With the exception of shader-based effects you can make pretty much any visual representation you like with the above. The APIs are not low-level, so you do not have access to low-level optimizations, but aside from that JavaFX provides functionally complete rendering APIs.

Offline ShadedVertex
« Reply #45 - Posted 2015-10-29 13:12:39 »

Ah, I see what you mean. Yeah, you can think of it that way. But it does limit you to a certain extent, I guess. I'll try my best to get the game working, but right now I'm focusing on learning LWJGL. I want to take my knowledge a step further and this game is a little huge (not as huge as Vangard, definitely, but it will take quite some time). I might consider releasing the text-based version of the game (which is equally as fun as the card version, believe me).
Offline ShadedVertex
« Reply #46 - Posted 2015-10-30 08:37:49 »

Yippee! I added buying/selling and eating features. They all work fairly well Cheesy
Offline ShadedVertex
« Reply #47 - Posted 2015-10-31 09:59:36 »

I've cleaned up buying and selling. I've finished up the shops. I'm mostly done with the user card. There are no jobs, though, but adding jobs is definitely top on my priority/to-do list. Multiplayer support has been added, but right now it's buggy as heck, because I haven't done debugging at all. It might work, it might not. In other words, we're almost ready for a little tech-demo!
Offline ShadedVertex
« Reply #48 - Posted 2015-11-03 04:04:35 »

I've added a chat box and I've improved multiplayer. Time to actually test multiplayer Cheesy
Offline ShadedVertex
« Reply #49 - Posted 2015-11-07 05:32:54 »

Multiplayer works, but I'm trying to squash the networking bugs. I'm also working on housing and the creation of shops by players.

EDIT: Players can create their own shops now! Cheesy

EDIT: As well as their own houses! Cheesy Cheesy

UPDATE UPDATE UPDATE BREAKING NEWS: This project isn't dead, don't worry!
Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
cybrmynd (138 views)
2017-08-02 12:28:51

cybrmynd (159 views)
2017-08-02 12:19:43

cybrmynd (153 views)
2017-08-02 12:18:09

Sralse (169 views)
2017-07-25 17:13:48

Archive (646 views)
2017-04-27 17:45:51

buddyBro (766 views)
2017-04-05 03:38:00

CopyableCougar4 (1300 views)
2017-03-24 15:39:42

theagentd (1264 views)
2017-03-24 15:32:08

Rule (1237 views)
2017-03-19 12:43:22

Rule (1312 views)
2017-03-19 12:42:17
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!