Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (565)
Games in Android Showcase (151)
games submitted by our members
Games in WIP (606)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: 1 ... 5 6 [7] 8 9 10
 on: 2015-03-30 13:12:57 
Started by Gibbo3771 - Last post by Gibbo3771
I am a little stumped on the best approach for this, I want to clean up my code a bit and move my entity components to an external file that is loaded in at runtime.

However I am a little unsure how to go about this, as I have never done any extensive I/O coding, I usually just write the code once and when I am happy with it, dump the entire thing to disk using Protobuf or Json and then read it in later.

I would like it to be somewhat readable though, so that if I want to make small changes (like balancing) down the road, I don't have to re-write it and redump it.

I am using the Ashley Entity Framework which is fairly lightweight, along with LibGDX and Box2D. I have it setup so that entities bodies and fixtures are not created until they are added to the Ashley engine, so there is no serializing of actual Box2D bodies; which is nice.

Serializing sprites is bad though, correct? So my option there would be to store the file path and instead grab it from the AssetManager after the entity has been loaded from disk.

Any ideas? Suggestions?, for the record, playable characters (of which there are currently 5) have between 15 and 20 different component combinations that make them unique.

The main idea here is to remove a lot of horrible code into a nice file that is readable and can be altered.

 on: 2015-03-30 13:04:25 
Started by skys0ldier - Last post by Varkas
but what is a "padded room" ?

A confinement for people who are likely to harm their environment or themselves in fits of insanity or other abnormal states.

See also:

Nowadays such people are usually treated with sedatives and other psychoactive drugs to prevent such fits.

 on: 2015-03-30 12:55:11 
Started by Varkas - Last post by Varkas
A central, highly available DB to keep track of all items and their owners is a solution, but I have no menas to establish such an infrastructure. That's why I added the "offline scenario" to the title - I want to make trades possible even if there is no internet connection availble at the moment of the trade.

 on: 2015-03-30 12:50:15 
Started by Varkas - Last post by skys0ldier
what if you just save the amount of items the user has in a db?
Or save a "trading key" in an "item-file", which you also have on your server..
once traded, this key would be made unusable..

just an idea

 on: 2015-03-30 12:48:22 
Started by kevglass - Last post by matt_p
Some months ago I did another step in the right direction for my dream to become a "real" game developer (with SAP prior to that). Now I'm developing games (in Java) for a living, but the dream remains to earn money with my very own projects/games. One of which I will present to you soon - and I'm already full of anticipation for that day Smiley

 on: 2015-03-30 12:48:05 
Started by skys0ldier - Last post by Varkas
I think the point was that in C (and in C++) you have more control how your data will be stored in the heap.

But this doesn't mean that each and every C (or C++) program is better than Java, frankly, because in many cases this sort of control is not needed.

To optimize for performance, the key is to have data stored in the order that is the most frequent reading (or writing), particularly that the next accessed data is directly stored after the currently accessed data. Then it is cache friendly. Scattered data/scattered accesses are cache unfriendly, the more the smaller the data chunks and the more they are scattered.

In Java the only way to be sure of memory layout is to use Arrays as emulation of a heap, and provide a struct-like API into the (hidden) array data. This way you can have an OO-like API on top of an access-optimized structure, but it is not nice to code.

 on: 2015-03-30 12:45:51 
Started by skys0ldier - Last post by skys0ldier
In C, quadtrees are densely packed structures  using pointers to bits of itself, all stored in a contiguous block of memory. It's as efficient as it can possibly be.

are we talking of C or C++, too?

Im learning C++ in the moment.. so i cannot argumentate on this side.
But if i understood you correctly, you mean in c (++?) quadtrees would be
more efficient because of pinters, and a better memory information structure?

Then, i would say, every program would be "better" in c, because why this point
should only be a plus in quadtrees? Data Structures in General should be better in C then,
if implemented correctly..

But why, i don't understand.. if the data is spread over the ram or not, at the and
there are just pointers pointing to the correct position, or not?..

 on: 2015-03-30 12:38:46 
Started by kovacsa - Last post by kovacsa
It should make separated lists for every vertex.
Like these: [26,287 154,303 375,338 260,393] [22,114 115,185 274,28]
Above code gives only 1 list.

 on: 2015-03-30 12:32:03 
Started by Varkas - Last post by Varkas
There is a thing that I've been pondering a long time - how to prevent duping in the trading of virtual items. I mean, how to prevent that someone in the possession of a virtual item can multiply it, and sell the copies.

To make it worse, the scenario which I had in mind puts the item data into the users hands - he's got a file, representing the item, so basically he can make as many copies as he wants ... and the trading system must make sure he can only sell one of those copies, and the others will be rejected.

A while I thought it is impossible to prevent duping in sucha  scenario. But now I see those virtual currencies like Bitcoins, and there is no way to dupe coins as it seems. This gives hope that there are measures to prevent duping of other "items", even if the owner has access to the data.

Is it doable? If yes, then how?

 on: 2015-03-30 12:22:06 
Started by kovacsa - Last post by cylab
You have a typo in your else if branch:
else if(e1.p2.x == e.p1.x && e1.p2.y == e.p1.y && !adjLists.contains(e1.p1.x) && !adjLists.contains(e1.p1.y))

should probably be
else if(e1.p2.x == e.p1.x && e1.p2.y == e.p1.y && !adjLists.get(j).contains(e1.p1.x) && !adjLists.get(j).contains(e1.p1.y))

Overall it's easier to read and more performant to store adjLists.get(j) into a variable anyway:
        for(int i=0; i<vertexnum; i++){
            adjLists.add(new ArrayList<Integer>());

        for(int j=0; j<vertexnum; j++) {
            ArrayList<Integer> aList = adjLists.get(j);
            for (Point p : nodes) {
                for (Edge e : edges) {

                    for (Point p1 : nodes) {
                        for (Edge e1 : edges) {
                            if (e1.p1.x == e.p1.x && e1.p1.y == e.p1.y && !aList.contains(e1.p2.x) && !aList.contains(e1.p2.y)) {

                            } else if(e1.p2.x == e.p1.x && e1.p2.y == e.p1.y && !aList.contains(e1.p1.x) && !aList.contains(e1.p1.y)){


Pages: 1 ... 5 6 [7] 8 9 10
theagentd (13 views)
2015-03-27 23:08:20

wxwsk8er (54 views)
2015-03-20 15:39:46

Fairy Tailz (47 views)
2015-03-15 21:52:20

Olo (29 views)
2015-03-13 17:51:59

Olo (32 views)
2015-03-13 17:50:51

Olo (39 views)
2015-03-13 17:50:16

Olo (44 views)
2015-03-13 17:47:07

ClaasJG (57 views)
2015-03-10 11:36:42

ClaasJG (42 views)
2015-03-10 11:33:01

Pippogeek (50 views)
2015-03-05 14:36:23
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27 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‑
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!