Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to make my Java game moddable. I was thinking about Lua but I don't like this idea too much. Basically I just want to make API for my game that'll contains some methods that will be available for people making mod. After I make the mod I want to somehow compile it into a jar file. The most tricky part is to load the file (mod) as a mod. I've never done anything like that, but I've created some mods for game Minecraft using Minecraft Forge API so I know that it's possible.
I want to make my Java game moddable.
IMO, the best way to do this is to make the complete source-code of your program available freely to anyone who wants it.
But assuming that you mean "mods" to your game that don't involve people hacking on the core code, there are standard ways of implementing "plugin" functionality in Java. Basically, you structure your application so that the areas where you want the behaviour to be "mod-able" have:
a well designed interface that "mod" coders can implement,
a plugin loader that finds and loads custom code (mods) from somewhere, and
some kind of registry mechanism that allows your application to find the code.
In addition, making the code open source makes it a lot easier for mod coders to code and debug their mods. If they can see the core code, they can figure out how they need to write their code to interact with it.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am trying to create a graphical user interface (GUI) using Swing in Java.
The part I am kind of stuck is, I am planning to display some values from my Python program to the interface I am developing in Swing. I have looked up in forums and came across the Jython thing, but not quite sure on how to proceed with this, anyone information in this issue would be helpful to me.
Some extra information, if it may help, I have a set of sensors reading some values using a Raspberry Pi, and the sensors are operated using a Python script running in RPi. Now my goal is to develop a GUI using Java so that I can display those values from the Python script to the swing interface.
Thanks in advance.
I think your easiest path forward would be to store the values that are collected by the Raspberry Pi in an intermediary storage. This can be as simple as a text file, or if you want something more verbose, you can store it in a RDBMS or NoSQL DB. Then it becomes easier for the java application to look up the values without having to interface with Python.
If you want to directly interface with Python, you could look into GraalVM which has limited ability to directly execute Python code.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have written a fully functional chat program in C. The server starts up and allows multiple clients to connect and talk to each other, all via command line. However I would like to try adding a GUI to this program, but all of the C/C++ GUI packages seem to have a steep learning curve just to get started. Is there any way to write a GUI using Swing and connect it to the C code underneath?
For example, I would like to type some text into a box, click "send" and have it call the C function which deals with sending text. Is this possible? And if so, is it very difficult?
I can provide code if needed. I am also open to suggestions on which C++ GUI package might be most appropriate for this kind of program.
Yes, its possible. You would have to use JNI. You should really consider the learning curve of doing JNI vs learning whatever GUI framework you want to use you C/C++.
As someone who has done this on multiple professional projects though, I really would warn against it. It can produce very hard to find bugs.
Tcl/Tk Used to be the scripting language of choice if you wanted to provide a bunch of C/C++ methods with a (not too complicated) GUI. Python also provides GUI element via PyQT and PyKDE. I think it's much easier to use a scripting language like this to bind to C then trying to do Swing<=>C/C++ bridging.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a question for you concerning Java. I am basically a Java user and did most of my work with it. However, in the machine learning classes I took in college, we used mostly python with the scikit-learn and numpy packages.
Now I want to do a project where I crawl data from the web, store it in SQL databases, and then do machine learning on this data. Maybe some of you have experience with those things and share some of it? I mean, of course it is possible to do these things with java, but maybe you have had some particular experiences on why I should use something else or what to consider?
I am happy for all your thoughts :-)
Have a great weekend!
It turns out that programming language and database implementation are secondary problems. Think first about the machine learning you want to do. Review the existing packages (in any language) and pick one according to how well it fits the needs of the business problem you are trying to solve. Then work with whatever language is most convenient for that package. You will probably find that no single language is suitable for all parts of the problem; you will end up gluing together Java, Python, R, shell scripts, etc, to make a complete solution, and there's nothing wrong with that. Consider that your job is problem solving instead of programming in a specific language and go from there.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How am I, as a developer, supposed to find out what exactly some library code is supposed to do according to the API?
To be more specific, I'm trying to learn the Android API. It seems to me that the javadocs are not always clear, but when you start reading the SDK source code of classes like Activity, Fragment, View, you get a much better impression of what is actually going on.
But doesn't that invalidate the idea of having an API (= interface), where the actual implementation (source code) can change while the API remains the same? And if you look at the source code, aren't you more likely to take some behavior for granted which wasn't intended to be part of the API?
I'm also relatively new to the concept of Inversion Of Control, where you, for example, have to subclass and override lots of methods like onCreate or onDraw. It seems to me that necessarily there are lots of hidden things going on in the background without having to write any code about it, because the SDK code contains the actual main thread loop. For example, the app creates a window, displays an action bar, it paints a white background, reacts to certain events from the very beginning. But I didn't write any code for this behavior. I just left out code. It's all taken over by the SDK.
I have the impression that this paradigm makes the learning curve steeper because you would actually have to look up somewhere what happens when you write nothing or when you leave out specific lines of code. But in the docs I can only look up what happens after some method gets called (probably by me, probably by the SDK) but not when it's called and what happens if I don't call it or don't override it. So is there some recommended way to look up those things that are supposed to happen implicitly all the time?
For learning the Android SDK, I would start with their developer website. There are tons of tutorials, sample code, and explanations of the SDK to browse through.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm in the early midst of making a game with Java, and would eventually like to turn it into an android application.
All the developer technical stuff aside, will the code itself remain the same, or will I have to rework the better part of it?
Thanks in advance for the feedback
Yes,you can do like that where your rendering part need to be changed if you want to use it in android. So the better option is use some framework to port your code to work in Android system as well. LibGdx is such a kind of framework where you can develop and test your application in stand alone mode and without changing your code, you can run it in Android as well. Please refer LibGDX site for more information
Android code is java, so yes!
You'll have to change some stuff. For instance, if you're using swing to show stuff on the screen, you'll have to change it to use the android API; but the core of the code should remain the same.
I remember doing my very first videogame in java. Porting it to android only required me to modify little.