Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 5
1  Game Development / Newbie & Debugging Questions / Re: Items Rendering Behind Map Layers? on: 2013-10-12 11:23:50
Figured it out! Was forgetting to place the RenderComponent within the renderComponent field within the GameObject subclass, as opposed to just letting it be added to the components list like all of the other components, which caused the out of sync and background issue. Not too sure why text still renders super huge and as part of the game world instead of an overlay if used with that SpriteBatch, but I've circumvented that separate issue just by using a different SpriteBatch object entirely. Thanks for trying to help out regardless!
2  Game Development / Newbie & Debugging Questions / Re: Items Rendering Behind Map Layers? on: 2013-10-12 05:10:27
Oh wait, I just realized you're creating a side scroller type game, not a top down, which introduces a different set of problems. The objects come out of the background when you jump? Very strange, did you set up your camera with any sort of zoom?
No zoom; the objects render in the background when they're supposed to be between the player and the map (not behind the map), which is visible given the order of the render calls. If the player jumps, the objects move faster on the Y axis than the environment, though it should just be the same, giving it a strange parallax effect. Interestingly, if I create a BitmapFont and try to render some text on the screen, it looks like it's rendered relative to the world and not the screen:

1  
font.draw(batch, "HP: " + player.stats.health, 10, 10);


That call draws that string in the world, so I can walk and see it as if it were written on the background. This is placed within a batch.begin() and batch.end() and the batch is acquired from the renderer. This and the other issue may be related.
3  Game Development / Newbie & Debugging Questions / Re: Items Rendering Behind Map Layers? on: 2013-10-12 04:51:38
Hmm... no that all looks fine. Can I see level.renderEntities?

It's a very simple method:

1  
2  
3  
4  
5  
6  
7  
public void renderEntities(float delta)
{
   for (Entity e : entities)
   {
      e.render();
   }
}


This render method is polymorphic but for the sake of this desired outcome it looks like this (per ItemDrop, which is a subclass of type Entity):

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public void render()
{
   if (renderComponent == null)
   {
      return;
   }
   else
   {
      renderComponent.update(0);
   }
}


RenderComponent is used here separate from being stored in each Entity's list of other components because typically we will want the update logic decoupled from the render routine. Here's the update() method for each ItemDrop's RenderComponent:

1  
2  
3  
4  
5  
6  
7  
public void update(float delta)
{
   SpriteBatch batch = renderer.getSpriteBatch();
   batch.begin();
   batch.draw(entity.getSprite(), entity.position.x, entity.position.y, entity.width, entity.height);
   batch.end();
}
4  Game Development / Newbie & Debugging Questions / Re: Items Rendering Behind Map Layers? on: 2013-10-12 04:43:23
I wonder if it has something to do with your setting the camera coordinates and then rendering everything with that camera? Can I see the camera class please?
Hi opiop65,

Could be! I simply used an OrthographicCamera for that bit, and the relevant code is in the Screen constructor as such:

1  
2  
3  
4  
5  
...
camera = new OrthographicCamera();
camera.setToOrtho(false, 30, 20);
camera.update();
...


For what it's worth, I'm also using an OrthogonalTiledMapRenderer that renders the level's TiledMap with a scale factor of 1/16f:

1  
renderer = new OrthogonalTiledMapRenderer(level.map, 1/16f);
5  Game Development / Newbie & Debugging Questions / Items Rendering Behind Map Layers? on: 2013-10-12 03:00:07
Hey all! I've encountered an odd issue whereby the items I have spawned in the game world seem to be rendering behind the game map itself, despite their render calls taking place after the OrthogonalTiledMapRenderer I'm using. I took the SuperKoalio example as a foundation for the platforming code but changed it to fit more of an Entity-Component model, then added a List of what I've named ItemDrops that have physics and are supposed to render just a layer behind the player. However, they end up rendering behind any of the map layers as well, and when I jump, they seem to rise up and down a little bit, as if there is some sort of parallax effect involved; I don't know if the OrthogonalTiledMapRenderer does anything like that. They're using the same SpriteBatch as the player and the renderer. The higher-level flow is like the following, within my render method:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
Gdx.gl.glClearColor(0.7f, 0.7f, 1.0f, 1);
Gdx.gl.glClear(GL10.COLOR_BUFFER_BIT);

// updates their position, applies gravity, etc.
level.updateEntities(delta);
player.update(delta);

// let the camera follow the player
camera.position.x = player.position.x;
camera.position.y = player.position.y;
camera.update();

// set the tile map renderer view based on what the camera sees and render the map
renderer.setView(camera);
renderer.render();
level.renderEntities();
player.render();


Render calls to the player and the entities are basically just acquiring the SpriteBatch from the same renderer as shown here and calling the needed batch.begin() and .end() calls, drawing the needed frames, and that's it. The ItemDrop objects mentioned previously are updated and rendered in level.updateEntities(delta) and level.renderEntities(), successfully; the List resides within the Level object. Help is greatly appreciated! Willing to supply any code needed, but there's quite a bit at this point; don't want to bog down the post too much! Hoping the issue is something simple I don't know about SpriteBatches or OrthogonalTiledMapRenderers! ;]

Colton
6  Game Development / Game Mechanics / Re: Tile design problems on: 2013-10-04 01:07:31
What you're using is an array, not a matrix, and that wouldn't work either because every tile has the same instance of the same sprite, which holds the rgb values for the texture. So every time I modify the sprite, it modifies all the the tiles.
2D arrays are often thought of as matrices, because they represent the same concept of a column-and-rows modeling of data. Speaking in abstract terms like lcass was doing, the argument is merely one of semantics.
7  Game Development / Game Mechanics / Re: Diving into Scripting.... on: 2013-10-03 00:31:51
davedes,

Yes, I do plan on hand-writing the JSON, and I also really love the look of YAML (I program in Python often for my actual programming job). Do you have a preferred YAML parser? Also, thanks again for your help in figuring out a viable data-based alternative to scripting; this is what I've truly wanted from the get go rather than having any scripting, but it didn't seem viable until put in perspective.

Also, yes, I would love to keep the format as uniform as possible amongst the different scripts throughout my engine, as I intend to use this as a means of user-generated content in any domain I can find good reason for.
8  Game Development / Game Mechanics / Re: Diving into Scripting.... on: 2013-10-02 23:21:45
@davedes,

I went ahead and modified my entire list of abilities from before with this new model; does this look like it's following yours well enough? Thank you very much for all your time and help!

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
"abilities" : {
        "pickpocket" : {
            "name" : "Pickpocket",
            "desc" : "Deftly acquire that which belongs to someone else's pockets!",
            "type" : "generic",
            "cooldown" : 3,
            "OnUse" : [
                {
                    "Steal" : {
                        "chance" : [25, 45],
                        "steals" : "randomItem"
                    }
                }
            ]
        },
        "sneak" : {
            "name" : "Sneak",
            "desc" : "Render those around you oblivious of your subtle presence...",
            "type" : "generic",
            "mana" : 5,
            "cooldown" : 5,
            "duration" : 30,
            "OnUse" : [
                {
                    "Effect" : {
                        "statIncrease" : {
                            "stat" : "sneak",
                            "amount" : ["25%", "30%", "35%"]
                        },
                        "target" : "self",
                        "duration" : "parent",
                    }
                }
            ]
        },
        "deftStrike" : {
            "name" : "Deft Strike",
            "desc" : "Utilize your dexterity and cunning to cleverly and critically strike your opponent!",
            "type" : "melee",
            "mana" : 10,
            "cooldown" : 5,
            "OnUse" : [
                {
                    "MeleeAttack" : {
                        "animation" : "fastSingleAttack",
                        "vfx" : [],
                        "bonusDamage" : ["20%", "25%", "30%"]
                    }
                }
            ]
        },
        "flee" : {
            "name" : "Flee",
            "desc" : "Gain an increase in running speed to dodge tricky situations!",
            "type" : "generic",
            "mana" : 15,
            "cooldown" : 25,
            "duration" : 15,
            "OnUse" : [
                {
                    "Effect" : {
                        "StatIncrease" : {
                            "stat" : "speed",
                            "amount" : ["30%", "35%", "40%"]
                        }
                    }
                }
            ]
        },
        "mug" : {
            "name" : "Mug",
            "desc" : "Strike your enemy with the chance to steal something of theirs!",
            "type" : "generic",
            "mana" : 10,
            "duration" : 60,
            "cooldown" : 15,
            "OnAttack" : [
                {
                    "Steal" : {
                        "steals" : "random_item",
                        "chance" : ["40%", "45%", "50%"]
                    }
                }
            ]
        },
        "daggerMastery" : {
            "name" : "Dagger Mastery",
            "desc" : "Improve your overall success with daggers!",
            "type" : "passive",
            "OnUnlock" : [
                {
                    "SkillIncrease" : {
                        "skill" : "daggers",
                        "amount" : [5, 10, 15]
                    }
                }
            ]
        },
        "quickStrike" : {
            "name" : "Quick Strike",
            "desc" : "Nimbly strike your opponent twice in rapid succession!",
            "type" : "melee",
            "mana" : 20,
            "cooldown" : 10,
            "OnUse" : [
                {
                    "MeleeAttack" : {
                        "animation" : "fastDoubleAttack",
                        "vfx" : ["blurPlayer"],
                        "hits" : {
                            "frames" : [2, 4]
                        }
                    }
                }
            ]
        },
        "leap" : {
            "name" : "Leap",
            "desc" : "Add extra juice to your jump to escape, aid dungeon crawling, or show off!",
            "type" : "generic",
            "mana" : 10,
            "cooldown" : 5,
            "duration" : 15,
            "OnUse" : [
                {
                    "Effect" : {
                        "statIncrease" : "jumpHeight",
                        "amount" : [3, 4, 5],
                    }
                }
            ]
        }
    }
9  Game Development / Game Mechanics / Re: Diving into Scripting.... on: 2013-10-02 21:23:56
davedes, that was a great example and fits the model I was trying to capture in my mind fantastically. Thank you very much! I will eagerly pursue fleshing it out.

Roquen, I will take a look at your article as well; from the first few paragraphs, it looks interesting! Thank you!

Colton
10  Game Development / Game Mechanics / Re: Diving into Scripting.... on: 2013-10-01 21:28:12
Hi Danny,

Thanks for the reply. That's not a bad idea, but it introduces the need to create a class still for every single ability I want to make, defeating my goal of being able to completely define these things as data files. The end goal is something a lot more akin to having a generic Ability class that can take in a list of Events that comprise it, which maybe could be tied with a list of Fields that are dynamic and basically object wrappers around names and values. I'm having a hard time actually writing out a concrete implementation base for this at the moment; any thoughts on how this could be accomplished? Thanks!

Colton
11  Game Development / Game Mechanics / Re: Diving into Scripting.... on: 2013-10-01 18:41:52
Thanks for the reply, Jeremy! I would love to have a strictly data-driven interface for loading classes, abilities, and so forth, which would make development in that part of the game like butter, but I just have a hard time mainly with the abilities. Here is a sample of the latest design of my class JSON file:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
{
    "className" : "Bandit",
    "classId" : "bandit",
    "classDescription" : "A sly picker of pockets, gifted with the feet of a cat.",
    "classIcon" : "bandit.png",
    "effectiveWeapons" : ["daggers", "shortswords", "bows"],
    "ineffectiveWeapons" : ["axes", "maces", "hammers"],
    "effectiveArmor" : ["light"],
    "ineffectiveArmor" : ["heavy"],
    "abilities" : [
        {
            "name" : "Pickpocket",
            "id" : "pickpocket",
            "description" : "Deftly acquire that which belongs to someone else's pockets!",
            "type" : "move",
            "manaCost" : 0,
            "healthCost" : 0,
            "cooldown" : 3,
            "successChance" : [50, 55, 60]
        },
        {
            "name" : "Sneak",
            "id" : "sneak",
            "description" : "Render those around you oblivious of your subtle presence...",
            "type" : "move",
            "manaCost" : 0,
            "healthCost" : 0,
            "cooldown" : 5,
            "successChance" : 100
        },
        {
            "name" : "Deft Strike",
            "id" : "deftStrike",
            "description" : "Utilize your dexterity and cunning to cleverly and critically strike your opponent!",
            "type" : "move",
            "manaCost" : 10,
            "healthCost" : 0,
            "cooldown" : 5
            "successChance" : 100
        },
        {
            "name" : "Flee",
            "id" : "flee",
            "description" : "Gain an increase in running speed to dodge tricky situations!",
            "type" : "move",
            "manaCost" : 15,
            "healthCost" : 0,
            "cooldown" : 25,
            "successChance" : 100
        },
        {
            "name" : "Steal",
            "id" : "steal",
            "description" : "Strike your enemy with the chance to steal something of theirs!",
            "type" : "move",
            "manaCost" : 10,
            "healthCost" : 0,
            "cooldown" : 15,
            "successChance" : [50, 55, 60]
        },
        {
            "name" : "Dagger Mastery",
            "id" : "daggerMastery",
            "description" : "Improve your overall success with daggers!",
            "type" : "passive",
            "manaCost" : 0,
            "healthCost" : 0,
            "cooldown" : 0,
            "successChance" : 100
        },
        {
            "name" : "Quick Strike",
            "id" : "quickStrike",
            "description" : "Nimbly strike your opponent twice in rapid succession!",
            "type" : "move",
            "manaCost" : 20,
            "healthCost" : 0,
            "cooldown" : 10,
            "successChance" : 100
        },
        {
            "name" : "Leap",
            "id" : "leap",
            "description" : "Add extra juice to your jump to escape, aid dungeon crawling, or show off!",
            "type" : "move",
            "manaCost" : 10,
            "healthCost" : 0,
            "cooldown" : 5,
            "successChance" : 100
        }
    ],
}


It contains most of the foreseeably necessary data, but in something like Pickpocket, for example (were I to want to keep the abilities and the class collected together rather than splitting up the moves into separate files), I find it difficult to describe the flow of how the ability should proceed. I would want it to go something like:

1  
2  
3  
if player.distanceToTarget(3):
   player.playAnimation("touch")
   player.stealItem("opponent", successChance)


It's simplified in this example but still a reasonable estimate of what an ability may require. Were I to want a strictly data-driven approach (which again, I would love), how could this be accomplished utilizing such, ideally incorporating into the JSON file shown above? Thanks for your time!
12  Game Development / Game Mechanics / Re: Diving into Scripting.... on: 2013-10-01 03:52:51
Thanks for the reply, davedes!

So, I love the idea of being able to use something like a GUI or whatnot to create any game asset really and have that exported as a script; I've run this through my head a few times, but JSON (or any pure-data file format) just is limited by the lack of logic, I feel. I love JSON as a tool for writing things that are simple, like items (though even items with functionality, like spawning things or turning you into a different creature, can get funky), and I use it all the time in my day-to-day non-game programming because of its utility and ubiquitousness, but things like class abilities that perform something that interacts with the game world and NPC scripting and whatnot feel impossible with it. My ideal goal would be to have all of this contained within one nice little pretty script file that, though not necessarily short for some cases, would at least be self-contained, dynamically loaded, and editable by others, not just me, so my engine doesn't have to be recompiled every time I'd like to add some new functionality or the community wants to create their own complete spin-off using my engine. Does this seem like a plausible goal to you? Not only are these ~100 classes desirable, but also community-driven ones down the road, and not just classes but many things would be great, like user scripted random world and level generation, weapon generation, etc (all things I've worked on already and am incorporating into the game engine), though we can save that for another time; for now, just focused on classes and abilities! Thank you very much for your time; sorry for the verbosity!

Colton
13  Game Development / Game Mechanics / Diving into Scripting.... on: 2013-10-01 01:35:52
Hey guys! Long time no chat.

I'm building up my game engine and beginning to design my scripting system. This is more a theory question than anything else, as this will be the first major scripting system I've ever written (using Lua with libgdx, for the curious). I basically am going to (tentatively, pending suggestions) have a system that operates as follows for character class behavior:

1. Classes are defined in individual .lua files loaded at runtime (i.e., bandit.lua, warrior.lua, necromancer.lua, etc.). These define things like what weapons are compatible, the class description, what abilities it learns, etc.
2. Abilities are defined in their own individual .lua files also loaded at runtime and referenced from the aforementioned class files (i.e., steal.lua will define what actually takes place when a character utilizing a thief class steals, and so forth).

I look at that model and think hm, it seems like it would be a good idea to blend the two together and instead just have one .lua file for each class that encompasses the abilities as well. Though clean, there's also the part of me that wouldn't know how to encapsulate those moves properly, as the end goal is to have Lua call something like new Class() with the class script file and new Ability() with each ability so that the classes are generic enough to fully encapsulate themselves and their behavior, and having the class file also contain the logic for each ability would presumably make this difficult unless I incorporate some meta-based object-oriented programming to hold the information for each ability... this comes with the trade-off of readability and simplicity for someone like my partner to be helping with the scripting, who is more design-based than code-based. Also, having the moves separate allows other classes to reuse those same moves.

Typically, I wouldn't necessarily approach scripting for something like this were my game to have on the order of 10-15 classes, but there are going to be (and don't laugh) roughly 100 classes at this point, all of which my partner and I have outlined already. Being able to script these rather than hardcode them just makes sense, especially because each class will also have 5-10 abilities that are unique to it (though some may have shared moves as mentioned before, lending utility to the scripting approach).

There are other areas of the engine I intend to script (entity generation, behaviors, questing, weapon and spell effects), but I figured this would be a good place to begin in terms of learning how to do things. I would love hearing suggestions as to how to fine-tune or change this approach to be more optimized or cleaner, and if anyone has insight on how to factor or reapproach the aforementioned issue with separate script types, that would be great as well. Scripting is looking like a very exciting frontier for a dynamic engine, but there are many things to consider, it would seem. Thanks in advance!

Colton
14  Games Center / Cube World Projects / Re: 3D Turnbased Rougelike (LWJGL) on: 2013-04-21 04:05:44
As I'm a big fan of PGC, I second this and will award you with some appreciation for graciously sharing!
15  Games Center / Showcase / Re: Card Tactics (Remake of FF9 game Tetra Master) on: 2013-04-19 02:08:58
Looks neat! I always enjoyed playing this in FF9 and Triple Triad in FF8.  :]
16  Games Center / WIP games, tools & toy projects / Re: My First Java Game (Heavy WIP) on: 2013-04-14 11:10:07
I understand that feeling of accomplishment. :] I do all of my world/level generation via .png files as well for the sake of being able to visually glance at things and see them in action. That, and it's incredibly easy to make levels with a tool like GIMP if you go the hand-drawn route, assuming you adhere to a palette your engine can parse. For my own project, as I'm using libgdx and they have built-in support for Tiled maps, I plan on encoding my output to the Tiled file format (.TMX), not to mention for the fact that I can easily see my maps through the Tiled application without having to run my game engine. Thought I'd mention in case you have thoughts of trying yourself or going down that route; it's not mandatory by any means but feels like something that would be a neat way to utilize more of the framework, and Tiled beats a map renderer I'd be able to make in a reasonable frame of time.
17  Game Development / Newbie & Debugging Questions / Re: How to use character images? on: 2013-04-14 10:57:33
The image you're referring to is called a "sprite sheet" and is used fairly ubiquitously in terms of 2D game animation. libgdx does offer the TextureAtlas option, and in a situation where you wanted to dissect an existing sprite sheet that hasn't been "packed", you would more than likely have to piece it apart image by image using a tool like GIMP to repack the image and turn it into a TextureAtlas. This is how you would go about using it the "libgdx" way, at least as far as my present experience has shown. Otherwise, you could just go about dissecting the sprite sheet at runtime based on the dimensions of each image (i.e., make a Texture that is 24 x 16 for one image and another Texture that's 26 x 16 for another, etc.). Assuming all of the images have the same height and width is fine if you design your sprite sheet this way, and indeed, you see a lot of sprite sheets that have consistent dimensions, but the sprite sheet shown here has some sprites that are differently sized. This has in-game repercussions as well in terms of collision detection, but this is fairly easy if you use box-based collision detection that depends on the size of the sprite to begin with. Dissecting the sheet into separate images and creating the TextureAtlas would probably be easier and the route I would take, if just a little bit tedious, but it's up to you.
18  Game Development / Performance Tuning / Re: Limited Palettes on: 2013-04-11 21:34:50
It might be interesting to view the Another World 15th anniversary edition Making of video (which is French, but with subtitles), which talks about the subject of using a limited color palette (16 colors) to still create something that breathes atmosphere. That game in particular was a huge success in that department.

part 1: http://www.youtube.com/watch?v=hWBV08FTXFw
part 2: http://www.youtube.com/watch?v=PPDN-tE7vQ0

Awesome, that sounds very interesting! I'll give it a watch. :] Thanks!
19  Game Development / Performance Tuning / Re: Limited Palettes on: 2013-04-07 02:13:33
HeroesGraveDev is correct, he said "unless you use a different format".
You can tell in what format an image will be stored in graphics memory, when you load it with glTexImage2D for example (google it and you'll find all the color formats listed).

OpenGL fixed pipeline does have support for palettes and color indices (never used it though, and I dunno how do it with shaders either), but it's rarely used, because nowadays it's not worth the hassle. I doubt LibGDX uses it, it probably just tells OpenGL to store all pixels in graphics memory as 32bit, to keep things simple. You'd have to code directly with OpenGL to use its palette capabilities.

Just work in 32bit color depth, that way:
- you have all the colors you want
- you lose no performance, and almost nothing in terms of memory
- you have alpha
- you don't have to worry about anything, it'll work (tm)

Limit your palette on the artistic side, when you create your images/sprites, NOT on the technical side, which just brings more troubles than benefits.

I see. That makes sense, especially considering the fact that I would like to be able to incorporate colored box2dlights, shaders, Post-Processing, and whatnot, but it was nice to at least think about it and figure out why it wouldn't work. Thanks!
20  Game Development / Performance Tuning / Re: Limited Palettes on: 2013-04-07 01:43:14
Indexed colours only reduce file size. Once the file is loaded, every single pixel will have a 32-bit int for it's colour, unless you use a different format. Unfortunately that also decreases your available choices before you even make a palette.

But yes, as said, the difference is not worth it.

I was under the impression that was not the case, otherwise it would just make sense to use 32-bit color to begin with. My understanding is the pixels are rendered based on offsets rather than storing their own color data. Here's an excerpt from the Wikipedia article:

"Indexed color saves a lot of memory, storage space, and transmission time: using truecolor, each pixel needs 24 bits, or 3 bytes. A typical 640×480 VGA resolution truecolor uncompressed image needs 640×480×3 = 921,600 bytes (900 KiB). Limiting the image colors to 256, every pixel needs only 8 bits, or 1 byte each, so the example image now needs only 640×480×1 = 307,200 bytes (300 KiB), plus 256×3 = 768 additional bytes to store the palette map in itself (assuming RGB), approx. one third of the original size. Smaller palettes (4-bit 16 colors, 2-bit 4 colors) can pack the pixels even more (to 1/6 or 1/12), obviously at cost of color accuracy."

Article for reference: http://en.wikipedia.org/wiki/Indexed_color

Unless I'm misunderstanding what it says?
21  Game Development / Performance Tuning / Re: Limited Palettes on: 2013-04-07 01:30:54
http://www.opengl.org/wiki/Image_Format

Just found this by using google. Maybe it will help.

Appreciate it. Didn't really have what I was looking for, though. I was thinking more along the lines of indexed colors, which I read more about through just the Wikipedia article and was able to learn a bit more about it. I may do some research into it with OpenGL, but arnaud's information suggests it may not be worth the time.

Yeah, except from the memory savings, you won't gain much (if any) performance, as today's cards and architectures are tuned for 32-bit colors.
And the memory savings will be negligible if you use pixel art. A 32x32 sprite costs nothing, even at 32-bit color depth:

32pixels x 32pixels x 1byte = 1kb for 8-bit (256 colors)
VS
32pixels x 32pixels x 4bytes = 4kb for 32-bit (true colors + alpha).

So I'd say you'll always be safe with pixel art and OpenGL.
Correctly using sprite sheets will have a lot more impact.

I see, I see. At least I know where to focus my efforts! ;] Thanks!
22  Game Development / Performance Tuning / Re: Limited Palettes on: 2013-04-07 01:04:09
I see what you mean. I know the Color class in libgdx can set its integer representations to 16, 24, and 32-bit, but I don't see any 8-bit options. I'm just trying to think if it would be worth settings something like that up by hand for any sort of gain. I can't imagine the gain would be extreme, but it would be nice to be able to take advantage of a 256-color palette in that regard. :]
23  Game Development / Performance Tuning / Limited Palettes on: 2013-04-07 00:40:45
Hey all! Haven't posted in a little bit.

Basically, I've made the switch to libgdx and I enjoy it quite a bit. I also recently read up on my pixel art theory and the like and have grown fascinated with the idea of using limited color palettes. In particular, this resource has made me realize what I've been looking for for quite some time:

http://www.pixeljoint.com/forum/forum_posts.asp?TID=12795

My question is--in addition to the fact that you maintain visual consistency throughout your piece and lend a (perhaps subjectively) nice element of aesthetic pleasure to your pixel art--is there a performance gain to be had with using a limited color palette? The above work shows the use of 16 colors, which is frankly quite amazing and works pretty well, but I'm thinking more along the lines of pursuing 256 colors after doing some posterizing tests and such with GIMP on some game art I've picked off Google. I'm still learning a lot about graphics but want to know if having a limited palette could lend a boost in performance through libgdx, or least OpenGL, more specifically. I apologize for my naivete! Thank you in advance for your help and suggestions.

Colton
24  Game Development / Game Mechanics / Re: Why is there no circle class? What do you use? on: 2012-08-16 08:06:13
is it? Cool. It makes sense to me. I was rethinking this after writing a brute force collision algorithm (every item against each other) and feeling like there had to be a better way. So I tried to forget about programming and envision the situation in the "real world". What happens when two items collide? There is no searching for neighbors and testing of boundaries. The collision occurs in the space itself. So why not replicate/model "space" (only one thing can occupy a space and the thing itself is in that space).

It seems to me a clear case can be made that scaling up is linear--the test remains the same no matter how many objects there are. The only thing that increases in cpu cycles is that each object takes a bit more effort to move and track. But again, scaling is linear, yes? The task of moving item A is the same no matter how many other items are in the model.

My guess is if the method is not used, it is because it is kind of anti-intuitive. Who wants to go to all the extra trouble managing the "space" model, especially with shapes that are kind of large and complex?
I agree, it makes more sense than having a brute-force method that checks each entity against every other entity in the game space.  Wink That, and it's somewhat elegant. It seems all the best algorithms and ways of doing things are fairly simple compared to what most people would think of. Recursion, for example, tends to be so beautiful and simple compared to the ways in which you would have to implement the same algorithms using alternative methods.

Colton
25  Game Development / Game Mechanics / Re: Why is there no circle class? What do you use? on: 2012-08-16 07:02:55
Quote
But other then that... what do you guys use for collisions besides rectangles? or do you use the Geom package at all?
One can use the equations for a rectangle, or square, or circle directly, without involving the Geom package. When doing a circular check, I like using Point2D objects and the distance() method. Other folks here probably have more efficient ways of calculating distance between two locations, but the distance() method is pretty good, too. When using rectangular or shape bounds, I have to admit I am kind of lazy and like to use the contains() method that is in many Graphics2D shapes.

You could also use a mapping method, no math involved whatsoever! But I am the only person I know playing around with that. I have an app where I place links to the object occupying a space into the 2D array slot that corresponds to that space. The rule is that only one object can occupy the given space, so the space on the screen that corresponds to that array point has to be pretty small. (The array becomes perhaps as big as the display, or a quarter size if you work with units of 4 pixels.) A single object can thus occupy a couple dozen array spaces. It makes moving the objects more cumbersome, but collision checking (which can grow geometrically) becomes trivial as a result. It is a tradeoff that might work well in special cases (e.g., lots and lots of small objects possibly colliding).
That actually sounds a lot familiar to something that Cas described to me, whereby entities are kept track of in a grid-like system. Seems like that's the latest trend these days! Cheesy
26  Game Development / Game Mechanics / Re: Why is there no circle class? What do you use? on: 2012-08-16 06:05:49
well an ellipse is an ellipse because its got two foci points and therefore it doesn't have a radius. Whereas a circle only has one focus point and it does have radius where any distance from the focus point to any point in the circumference of the circle would be constant.
Now a square is a square because its width and height are equivalent.
You can't just say a rectangle is technically a square and an ellipse is technically a circle. They're all different else they wouldn't have different names and mathematical explanations of what they represent.

But other then that... what do you guys use for collisions besides rectangles? or do you use the Geom package at all?
Nobody's saying that squares and rectangles are the same and that ellipses and circles are the same. A circle falls under the category of ellipse, just as a square falls under the category of rectangle. They're both special instances of each category, much like how ellipses and rectangles fall under the category of shape. You could go even more generic with rectangles and say they stem from parallelograms but differ in that their angles all must be right. A line from Wikipedia to clarify the definition of a circle as related to an ellipse is the following:

"A circle may also be defined as a special ellipse in which the two foci are coincident and the eccentricity is 0."

That's basically a rehashing of what I said previously.

Now, if you want to know how to do collisions with circles.... well, just use the distance formula. It's easier than dealing with ellipses, thanks to the fact that there's only one focus, essentially.

Colton
27  Game Development / Game Mechanics / Re: Why is there no circle class? What do you use? on: 2012-08-16 03:43:36
Nope, you're right. That's why there's also no Square class. Because there's no need.
Well then, I would say that solves that dilemma! Cheesy
28  Game Development / Game Mechanics / Re: Why is there no circle class? What do you use? on: 2012-08-16 03:21:36

Doesn't the ellipse class technically use an underlying Rectangle? it says so on the API. It's still not a perfect circle.

Grin

Also circles are so simple I generally wouldn't use the geom versions anyway. Same goes for rects.

So you don't use classes from the geom package for collisions? What do you use?
Correct me if I'm wrong, but a circle is a type of ellipse that just happens to be symmetrical from its center to any point lying on its edge. Also, a square is just a rectangle that has all equal sides. Therefore, it shouldn't matter, should it?
29  Game Development / Newbie & Debugging Questions / Re: While loop help on: 2012-08-14 17:12:43
I leaned how to code java with notepad first then I jumped up to notepad++ I was suck a boss. I actually had this guy in my data structures class that was wondering why all his stuff sometimes had to have static in everything and face palmed. He ended up getting a higher grade.  Angry

I am not saying static does not matter as it does obviously. Its just that there are many places where use can use it without causing any issues. If I am coding something that will be used by others and needs re-usability, I will do everything properly. For me it seems that when you want really good clean documentation, code, and readability, then you start dropping all the short cuts and hackyness.

Indeed. I'd like to think there's a time and a place to use static methods and when not to use them, even if you can get away with either more or less of the time. Currently, my engine has a few static methods, but 99% of the whole thing is non-static. A couple examples I have are a few pixel map to image functions, as well as functions between two of my procedural generators that allow them to work together without needing to instantiate both of them. Aside from that, we ain't havin none of that static Cheesy

By the way, I do love Notepad++.... that's what I was coding in for a long while before I jumped on the NetBeans bandwagon.
30  Game Development / Newbie & Debugging Questions / Re: While loop help on: 2012-08-14 17:04:01
Eclipse didn't tell you to make everything static.  You tried calling non-static methods from a static context, and the compiler complained.  So the "obvious" fix was just to make everything static, rather than create a non-static context, i.e. instantiate an object.

Every time I see yet another person say "Eclipse made me do X" or "I put this in and Eclipse wouldn't take it", I become more convinced that newbies simply shouldn't ever be taught with IDEs.  It's not the IDE's fault, but it certainly isn't helping anyone learn.

I agree. Having built a significant amount of my game's ancestral engine code with GCC and the command prompt, I can say that taught me a lot about spotting bugs and figuring out the right thing to do without an IDE's guidance. Now I just abuse the crap out of using NetBeans Cheesy

Colton
Pages: [1] 2 3 ... 5
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (12 views)
2014-04-15 18:08:23

BurntPizza (10 views)
2014-04-15 03:46:01

UprightPath (24 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (107 views)
2014-04-08 23:06:04

tom_mai78101 (207 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!