Hamif Ronik

Greenhorn
+ Follow
since Dec 27, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hamif Ronik

Campbell Ritchie wrote:The actual requirements will depend on your game's requirements; if it is turn‑based like chess, the networking mightn't have a heavy workload. I suggest you try this part of the Java™ Tutorials. You can probably connect any two computers not more than 8,000 miles apart in a straight line.

Moving you to our Sockets forum.



Thanks for the link but I have looked at it before. I've already written most of the networking code but I just need a way to connect two different pcs. Then there is also the problem of figuring out which pc has the server thread the other pc needs to connect to. I also need to detect whether or not there is a server running on a pc already so that I don't launch it twice. If you could help me with that I would be very grateful.
5 days ago
I have written a client server system for a turn based game. I used local host to test it using two javafx windows. Now I need to make it work with two different pcs? How can I do that and what are the requirements? Do I need to connect both with an ether net cable or do they just need to be on same WiFi?
6 days ago

Rob Spoor wrote:Did you already check if such a game would be legal? The Pokemon copyrights are owned by Nintendo who have given licenses to a few development companies to produce games for them. If you create a Pokemon game you may (probably will) end up getting sued.

Of course you can work around this a bit by making a Pokemon-like game. You can't use any existing Pokemon, but catching monsters and having them battle and evolve isn't copyrighted - I've seen enough Pokemon clones already.



I'm making this for learning, Not for any sort of commercial purposes. In retrospect I should not have used existing pokemon images anyways. I will remove them later.

Knute Snortum wrote:

Also, there is one thing with javafx that is causing me problems- The inability to add my own UI classes to scenebuilder. I made several helper classes to group UI functionality. For example,there is a battleUIHolder class that holds hpbars aand text labels for showing pokemon info. In unity3d I would have made a prefab for this class and instaintiated it in the UI when necessary. In scenebuilder the concept of a prefab does not exist.


Scene Builder is an application to help you build an FXML file, so I'm guessing when you say, "add my own UI classes to scenebuilder" your saying you want to add GUI objects to a Scene that was created by an FXMLLoader?  If so, that's not true.  A Scene is a Scene, no matter how it was built or loaded.  You can add Nodes to a Scene to your heart's content.



Thank you, I tried to include them in the original post but I kept hitting the character limit. I am aware that I could add nodes freely in code. However, then I'd have to run the program to see how it looks. If I could import a UI class in scenebuilder than I could see it more easily.

Knute Snortum wrote:Since some people on this forum don't want to click on links, here is the class Trainer:
You said:

For example, the trainer class is responsible for enabling the pokemon swap menu and making sure that the player is forced to send  in a new pokemon after the current one dies.


I have a hard time understanding exactly what the problem is here -- maybe it's above my pay grade -- but I can point out a few other problems with the code.

Always start a class with an uppercase letter.  Trainer is fine but pcTrainer should be PcTrainer or PCTrainer.
Use a real package name.  Do you own the domain company.com?  If not, fine some other unique package name.
Create object variables with an interface rather than a concrete class, if possible. For instance, you have protected ArrayList<Pokemon> party = new ArrayList<>();  Use protected List<Pokemon> party = new ArrayList<>(); instead.
Don't use underscores in variable names. The idiom for setting an field with a parameter is this.name = name;
Use more comments. Even when writing prototype code, every method and class should have a comment.  This clears your mind as to what the method is doing and helps you remember why you wrote it.
Always use braces, even when you don't have too. Especially with if statements, even if there is only one statement in the "then" clause, use braces for clarity.



Valid points. I started working in C first so some of my naming convention carried over. Then I realized that I could make the IDE generate constructor code so I followed the style you mentioned in other classes. pcTrainer stands for player controlled trainer so the correct version looks even weirder (PCTrainer). This was more readable to me.

My question was more along the lines of how to reduce coupling between UI and the trainer class. But your points are still insightful since I'm mostly self taught and I forget about these things a lot.

1 month ago
Hello,I've recently started working on a javafx project inspired by the 2d pokemon games. Right now, the game is very much in a prototype stage but you can battle using pokemon(no catching or exploration yet). But this is my first time creating a project of this size and as a result the codebase is slowly turning into a spaghetti mess. I'm having a hard time separating UI from battle logic. For example, the trainer class is responsible for enabling the pokemon swap menu and making sure that the player is forced to send  in a new pokemon after the current one dies.  

Of course the code base is kind of huge so there are many classes. Here's the github link:Github

The links to the problematic classes:
Trainer abstract class
pcTrainer(playable trainer concrete class)
battle controller class

Any pointers on how to refactor this would be greatly appreciated.

Also, there is one thing with javafx that is causing me problems- The inability to add my own UI classes to scenebuilder. I made several helper classes to group UI functionality. For example,there is a battleUIHolder class that holds hpbars aand text labels for showing pokemon info. In unity3d I would have made a prefab for this class and instaintiated it in the UI when necessary. In scenebuilder the concept of a prefab does not exist.
1 month ago