|
Hey guys, ages ago I tried making a really involved game but due to my lack of experience/knowledge I could never work out how to manage memory correctly (trying to track millions of integers and strings, it turns out that quickly turns into gigs of ram when you don't save it to the hard disk and load when needed :P). At the time I just abandoned it because the only way I knew how to store data was in text files. I decided to give another crack at it after I've worked on some simpler crap and I've realised I could just use a database like any business would. I found JDBC and it looks ideal, but I'm a little confused by how it works. If I use MySQL or Java DB, will it just work normally when I distribute the JAR to windows/linux/mac computers or will I need to include something? And is one better than the other, or are they both the same. I hope this isn't too dumb of a question, I'm still pretty new when it comes to Java/Programming in general.
|
# ¿ Mar 7, 2014 13:30 |
|
|
# ¿ Apr 27, 2024 13:05 |
|
Zaphod42 posted:Are you really sure that the game absolutely requires installing a database on client machines? That's probably going to have some drawbacks, although I guess I'm not sure of how minor you can make a DB install. Still, seems like overkill. Could you do it server side? Why millions of integers and strings? I did not realize that I had to install a database if I wanted to use it. A game I like, Aurora, was programmed in VB.net and uses an Access database for everything so I figured it would be easy just to do something similar with Java. I just assumed MySQL or Java DB would be a single database file that you could use JDBC to interface with. There would likely be no issue with me just using text files ala Dwarf Fortress. It was just an idea I had last night that seemed very elegant that anyone could edit if they liked.
|
# ¿ Mar 8, 2014 01:49 |
|
H2 might be the way to go if I want to keep going down the path of a database. It looks like you can embed the database into the application itself through a 1.5mb jar file so the end user doesn't need to install anything. But I did some reading up on Java and file loading, and an 8kb BufferedInputStream is surprisingly fast. 500ms to read a 100mb file. So I might write down what I want to do and make up a pro/con list.
|
# ¿ Mar 9, 2014 12:34 |
|
I'm not reinventing the wheel with XML, sorry.
|
# ¿ Mar 9, 2014 21:17 |
|
In Intellij, is there a way to put a 'build artifact' button up around where the run button is? I'm making a project and due to how I'm making my folder structure it is just going to be easier to run a Jar than faff about changing strings.
|
# ¿ Jul 15, 2014 09:33 |
|
I've just spent the past 4 hours trying to work out why something wasn't working properly in Java and holy poo poo is it aggravating when you did everything right but the png you had was corrupted. I was using javafx.scene.canvas.GraphicsContext and I couldn't work out why the DrawImage function was cropping pixels out of a spritesheet when it could show the whole spritesheet without any issue. I did practically everything I could think of to make it work, but it wasn't until I tried to open the PNG in a pixel editor to make sure I had the dimensions right did I see the thing was corrupted as all hell. It was really strange, before I opened it in the editor it looked fine on the JavaFX canvas, but once I did it stopped loading correctly. I downloaded a new copy of the PNG and everything worked perfectly. Programming can suck sometimes.
|
# ¿ Dec 6, 2014 10:26 |
|
I was reading up on Java 9 and I was wondering what Modular Source Code means? I don't really understand this new feature that I should be getting excited with, but I guess like with Lambdas I probably will once I know what it is.
|
# ¿ Dec 7, 2014 07:15 |
|
I've got a hypothetical that I don't know how to test but do want an answer for. If there is an object method that has a synchronization lock on it, and there are threads in queue with different priority levels (say first in line is a priority level 5, second in line is priority 3 and third is priority 10) how does Java work out who goes first? If it a first in first out or will it let the highest priority thread in front? I ideally want the top priority thread to get in first as I don't want to let it wait if the queue is long. But information I find can't tell me one way or the other.
|
# ¿ Feb 17, 2015 08:33 |
|
Jabor posted:The answer is neither. If multiple threads are waiting on the same concurrency object, it's unspecified which thread will acquire it when it becomes available. You can also make a particular concurrency object "fair", which makes it a strict FIFO order, at the cost of some throughput. Well, maybe I can ask the thread for a 'best practice'. I've got two methods, one is use by threads as a callback function in regards to sockets. A second method is a polling method by the main thread that collects all the data that the other threads are depositing at set intervals (every 100ms). code:
|
# ¿ Feb 17, 2015 12:44 |
|
Jabor posted:Is it important that the main thread gets the lock immediately when it asks instead of waiting for a couple of other threads to take their turn first? If so, why? I'm probably pre-optimising to be honest. I'm working on some examples from a MUD programming book and I'm anxious that I don't gently caress the sockets up because I'm not doing it's version of sockets (it was written back in 2003 and is a little out of date).
|
# ¿ Feb 17, 2015 13:22 |
|
|
# ¿ Apr 27, 2024 13:05 |
|
For Uni, I need to learn Swing. I don't do much GUI work at the best of times, and I've been using FX when I have. Does anyone have like a small tutorial other than the Oracle one? I'm basically looking for something that shows you how to make a couple of projects ranging from lambda function listeners to something a little more advance. The lectures on it are a bit of a mess.
|
# ¿ May 11, 2015 01:47 |