Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (595)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
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 ... 6
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-06 00:52:21
I finally combined the block and item animations into the asset registry so I only have to call dispose() on one thing and everything will be taken care of! Grin

On a side note, I tried to design the first boss in my game. Since she'll be the first step in unlocking the first major part of the tech tree related to cloning, she'll be called Lady Redundant Woman.

I love that name.
2  Game Development / Networking & Multiplayer / Re: Client-Server Communication Design? on: 2015-07-03 18:33:12
With Kryonet, multiple clients = multiple threads. I would keep everything to one client. My networking hierarchy consists of a Packet interface with an actionServer and actionClient method. When the packet is received on the client, the client in the received method would invoke actionClient, and the same deal for the server. That way you can have multiple packets doing different things without having to do some kind of switch statement in the received method.
3  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-02 17:53:24
I just finished making my game completely moddable. Everything is in a Registry (assets, gui handlers, you name it). I doubt anyone would actually bother, but it also makes it clearer for me to understand my own code.
4  Game Development / Newbie & Debugging Questions / Re: A* Pathfinding Libgdx? on: 2015-07-01 19:01:16
Putting forth your code and asking us to try to complete most of it doesn't help you learn. Have you tried to implement it at all?

This article is really helpful. It has the source code and a very thorough breakdown of how everything works. Try using that article first and see if you can try to implement some more things yourself. I'm not asking you to solve it yourself, if you're really stuck then ask us and we'll deliver.
5  Game Development / Newbie & Debugging Questions / Re: switch between maps on: 2015-06-30 21:03:43
A door where you can enter a new map like Battleblock Theatre? Click here to see what I mean.

Yeah, you could change the map at the same screen, or you could have a class that holds a level, and you switch to a different screen with a different level. For example, a LevelSelectScreen where it's only a level where you can pick a level, and a GameScreen where you play the game, but both screens still have a level instance.

6  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting light wont change from white? on: 2015-06-29 16:34:01
That was a really good explanation KaiHH!

Quote
(In reality however it is not a linear function, but we will leave that aside for a moment.)

Correct. In OP's images, he's obviously using a linear function but in my image I'm not (the "middle" part of a light source is much clearer than the edges). The formula for mine is (WARNING doesn't make sense):
1  
2  
float threshold = 0.7f;
alpha >= threshold ? return ((alpha - threshold) * (1f / (1 - threshold)) + (1f - threshold) : return ((alpha - (1 - threshold)) * (1 / 1 - (alpha - (1 - threshold))) * (1f - threshold))


I should probably redo my formula...

EDIT: formula re-done! Help from my friend was used.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
// this is the threshold where it becomes more dark faster
float threshold = 0.7f;
float thresholdInverse = 1f - threshold;
     
// simple linear formula
float linear = alpha * threshold;
     
// square alpha
float square = ((float) Math.pow(alpha, 2));
// essentially the same as adding itself multiplied by thresholdInverse
square *= (1 + thresholdInverse);
// subtract a bit so it doesn't become totally pitch black too early on
square -= (thresholdInverse / 2);
     
if (alpha >= threshold) {
   return square;
} else {
   return linear;
}
7  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting light wont change from white? on: 2015-06-27 18:13:49
The math for...?
8  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting light wont change from white? on: 2015-06-27 17:15:59
Avoid setting your reused colour to a static one... You should just make your own and set it to red, rather than manipulating the static (final) colour instance.

If you want the tiles to be tinted, you'll either have to tint the image via sprite batch's setColor method, and draw the sprite, rather than drawing something on top of the sprite.

The coloured outer bits are intentional in my pseudocode as you can see in this image:


I'm glad to see you got the lerp with the light colour and shadow working though!
9  Games Center / WIP games, tools & toy projects / Re: Survive and Thrive: A Minimalistic Survival Game on: 2015-06-27 16:29:30
I played the game for a bit, it definitely has the text-based adventure feel.
Quote
In my eyes, I see Survive and Thrive as a learning tool
Yes. This on its own isn't exactly the most complex game compared to a FPS, etc., but it definitely teaches you the basics of programming in general. The amount of detail in the game found from just reading the description really makes me feel you put a lot of effort into this.

Some things I noticed were that with every action you do, it became hard to see where the "action" began. That is, there wasn't really any space between the main screen (list of actions) or between battle movements (damn cookie monster Pointing). A simple line with some hyphens would work.

Other than that, don't get discouraged. Like you said, it's a game to help you learn the basics of Java programming.

And please... use a different image hosting site... Tinyurl is riddled with ads; if you use imgur's direct linking and with the [ img] tags you'll be able to embed images right into the post.

Good luck on your programming adventure!
10  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting light wont change from white? on: 2015-06-27 16:16:32
One thing I noticed was that your pixmap for the tilePixel was filled transparently. It should be filled with an opaque colour (white). Another thing I noticed was that you're treating "brightness" and the colour alpha as the exact same thing, but in reality brightness is the inversion of alpha (1.0f - alpha = brightness).

Either you have a new brightness array that keeps track of brightness independently from the colour alpha, or invert alpha when you're about to render.

In your latest post you make a Color object (you should really just have some reused object that's not created so often) that is black and then attempt to lerp it... with black?

I'll try to go step by step what the order should be.

1  
2  
3  
4  
5  
6  
7  
8  
set a brightness variable to the ambient (if it's day, set it to 1) brightness
using a stored colour variable that'
s not re-created constantly, set it to the ambient colour. ignore alpha for now
loop through the lights
   get the distance away from a light, calculate what the brightness WOULD be
   if the calculated brightness is more than the current brightness, replace it
   lerp your stored colour variable with the light's colour, with a factor of the distance
set the stored colour variable'
s alpha to the inverse of the brightness (1.0f - brightness)
render the square over the tile


That should work, at least I hope it does. It might be best for you to redo the inner for loop rather than try to fix it. It will be less confusing that way.
11  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting light wont change from white? on: 2015-06-26 20:16:49
I'm not saying to not touch alpha. I'm suggesting that you move brightness away from the colour object's alpha and use your own system (I used bytes which gets me 127 levels of precision which is good enough; in this case I don't use the negative side of a byte).
12  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting light wont change from white? on: 2015-06-26 19:14:50
I think it's with your colour mixer method. It doesn't seem like interpolation. If you want linear interpolation you can use the libgdx Color.lerp method.

From what I can tell from your posting history, you're overlaying each tile with a "shadow" to imitate lighting, which is totally fine (I do it). This is how my colour mixing goes:

I don't use the alpha part of colour (RGB888). Sunlight is black. All tiles are by default "sunlight".
A block will check its adjacent neighbours (above, below, left, right) and mix its neighbours with its current colour. The mixing is a 50% linear interpolation from the source to the destination colour (it works in the other direction as well because it's 50%). I use this: colorOfNeighbour.lerp(currentBlockColour, 0.5f).

Brightness is in its own category and is handled differently. It is NOT the alpha of the block colour.

Try using black for sunlight and lerping it rather than your multiplicative blending.
13  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-26 16:07:20
I finished the inventory code so that multiple people can modify an inventory's contents at the same time. Just to prove to myself I actually did something right I implemented a chessboard! Chessboard move validation not included although my friend is working on that. I also wanted to see if my animation index thing worked so all of the pieces on the image below are actually the same item (white is an item, black is an item) and the amount of items in a stack actually determine the texture used!


Click image for full resolution.
14  Game Development / Networking & Multiplayer / Re: Lag when sending position data on: 2015-06-26 14:31:55
I suggest you do all your networking on a separate thread that's not linked to rendering nor logic. This will probably remove the fps drop.

Also, instead of trying to send more packets to make it smoother, you'll have to do some interpolation (and possibly extrapolation) of the positions. That is, you'll smoothly move the entity from its old position to the new one over a series of frames to appear smooth.

15  Game Development / Newbie & Debugging Questions / Re: Kryonet connection issue on: 2015-06-24 17:10:12
As Soul Foam said, supply some code so we have more context as to what's going on.

Also, next time surround your code/exception with code tags.

[ code]
System.out.println("Hello world!");
[ /code]

without the spaces becomes

1  
System.out.println("Hello world!");
16  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Text Input listener. on: 2015-06-23 21:20:32
The methods in TextInputListener here have two methods: input(String) and canceled(). Note that they spelt cancelled with one l for some reason...

Could we see the code for your input listener?
17  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Text Input listener. on: 2015-06-23 20:44:05
Are you overriding the cancelled method in the input listener? You can override it to do something when it gets called.

Meaning, nothing gets called if I press the cancel button on the dialogue on android.

I might be interpreting your question incorrectly. Is the method not actually getting called or just not doing anything?
18  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting how would i do this on: 2015-06-23 18:38:34
Maybe you could try using the built-in libgdx Color lerp method. In my lighting engine I use lerp with 0.5 strength so it's a 50% interpolation from X colour to Y colour.
19  Game Development / Newbie & Debugging Questions / Re: Issue with sprite rotation distortion and need advice on speed of rotation on: 2015-06-22 00:49:11
It doesn't really matter for singleplayer games, but it matters the most in multiplayer games where you can't spam movement packets 60 times a second. I have to limit it to 20 per second and interpolate the positions in-between frames.

Also, that snippet of code in your reply was essentially my tick counter, albeit with (1f / TICKS where TICKS is 20). I changed it to nano-second time for precision.
20  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting how would i do this on: 2015-06-21 19:29:11
As the others have said, use a 1x1 white texture. You can create it at the beginning using Pixmap or load it from a file. I highly prefer using the white texture rather than ShapeRenderer because I can draw it in between batches rather than stopping the SpriteBatch and starting the ShapeRenderer batch.

Also, if you like to peek in my source code for my lighting engine, you can do so here.

However I use recursion to create a diamond shape rather than a circular shape.
21  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting how would i do this on: 2015-06-21 18:15:02
Are you batching all the shadows or starting/ending the shape renderer batch for each tile? If so stop doing that. Also make sure you're culling off the tiles that aren't visible and not rendering them.
22  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting how would i do this on: 2015-06-21 04:02:33

Well there is a rounded version in the thread i linked him to
Ah, I overlooked that as I skimmed the post. Sorry!

Also this is more related to your code TritonDreyja, but I don't really think you should be creating a new Color object for every recursion of the lighting update. Maybe store a bunch of shared Color objects that you can re-use over and over (I had to use around 7 of them Pointing).
23  Game Development / Newbie & Debugging Questions / Re: Issue with sprite rotation distortion and need advice on speed of rotation on: 2015-06-20 23:42:37
I use libgdx as well. I implemented ticks exactly as you said: there's a counter for delta time and when it hits a threshold it subtracts the threshold from the delta time and does a tick update. I need to make it use nanosecond time instead for more precision. As a matter of fact, I'll go do it right now... Lips Sealed
24  Game Development / Newbie & Debugging Questions / Re: Issue with sprite rotation distortion and need advice on speed of rotation on: 2015-06-20 23:34:44
Does your game run in "ticks"? (as in, there's a tick for every X frames)? If so, you should have a tick counter. To find when you should re-calculate the targets, you could do
1  
totalTicksElapsed % (yourTimeBetweenUpdatesInTicksHere) == 0


Basically if the modulo division of the total tick time and the time between updates is 0, you can update. You could replace 0 with any number within range of the update duration but 0 works for all cases like these.
25  Game Development / Game Mechanics / Re: Inheritance Headache on: 2015-06-20 22:57:57
So if i made a picture, i would load it in as a tile. if i wanted all things that could shoot something to be able to use .takedamage(), i would run into a problem. I was using MoveableTile but didn't wanted all of them to be able to take damage (cause it may just be a moveable picture/button). That's where I ran into this issue.

When you mean you wanted something to be able to use the takeDamage method, do you mean they should be able to call it or actually have it inside their class?

Also not to be rude, but I have no idea what you mean by a picture.
26  Game Development / Game Mechanics / Re: Inheritance Headache on: 2015-06-20 22:45:56
Tiles are tiles. They aren't entities nor creatures.
Creatures fall under the category of Entity because they aren't static.
If you want Entity to represent objects that are projectiles, make a Projectile class and make it a sub-class of Entity.

Items can be a bit different because I suppose they're not truly represented in the world as physical, collideable objects. I would separate them from Entity entirely and make an Item abstract class for them. Then they can create Entities when you call their onFire method to make a bullet, etc.

As for your shootable/non-shootable question...
Have a sub-class of Item that's called ItemWeapon (or just Weapon). Then you can sub-class it further and have a WeaponShootable and a WeaponMelee. Instead of making new methods for each (onStrike, onFire), just have a common method inside Item that's called onLeftClick (or something). Then WeaponShootable and WeaponMelee can override that method as they wish

Something that can take damage yet have no health makes no sense. If you want an entity to have health, make it under Creature or EntityLiving. If you want it to shoot, that's more of an AI thing. You could implement some AI system for an Entity. That way the AI will carry through with Entity's subclasses like Creature.

Quote
should i just yolo it and make moveableEntity have a bunch of stuff?

No. Object-oriented programming is supposed to make sense and be able to elaborate on in the future, not be a pile of spaghetti laying around that manages to become a game. It has to be easy for you to use so that in case you leave a project and come back in the future it won't be totally incomprehensible.

EDIT: why are lists so hard to do god damn just take this
27  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting how would i do this on: 2015-06-20 22:35:59
As i can see, it's my lighting effect youre looking for Cheesy
-snip-

Actually, that's pretty much identical to mine. It's recursive and has a diamond shape. The shape OP is looking for is rounded.

Yours does look a lot simpler than mine programmatically Tongue
28  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting how would i do this on: 2015-06-20 18:55:36
MrPizzaCake means use the light brightness as the brightness value in the HSB (not HSV!) colour model. HSB stands for hue, saturation, and brightness. Then in order to get the brightness of a tile, you would take its position from a light source (perhaps the nearest source since it'll have the most effect) and take the light source's brightness and divide it by the distance away and that's the tile's brightness.

Personally how I do it is by overlaying a shadow on top of the tile which is the "darkness" of each block. I have to use a shader to mask the lightmap onto the terrain so it doesn't cover the background.

You can see how I do it more in depth here. Note that it seems a bit more complex but can make really good looking effects.
29  Game Development / Newbie & Debugging Questions / Re: Issue with sprite rotation distortion and need advice on speed of rotation on: 2015-06-20 15:09:10
Glad you figured it out! Maybe you should update the target "direction" only once or a few times per second because trigonometry functions can be slightly computationally expensive (obviously with today's hardware it's practically negligible. You can then update the actual direction by moving it towards the target direction.
30  Game Development / Newbie & Debugging Questions / Re: Issue with sprite rotation distortion and need advice on speed of rotation on: 2015-06-18 04:19:55
Another overkill solution is to make separate sprites for different rotations. This'll definitely solve your distortion but it's kinda like killing a fly with a sledgehammer.
Pages: [1] 2 3 ... 6
 
deepthought (48 views)
2015-06-30 15:39:44

deepthought (55 views)
2015-06-30 15:39:09

deepthought (64 views)
2015-06-30 15:36:52

Za\'Anzabar (41 views)
2015-06-29 05:44:54

TritonDreyja (48 views)
2015-06-24 17:10:40

CopyableCougar4 (47 views)
2015-06-23 00:34:45

BurntPizza (54 views)
2015-06-21 20:36:46

cookiecompiler (93 views)
2015-06-11 15:42:53

cookiecompiler (55 views)
2015-06-11 15:41:14

NegativeZero (80 views)
2015-06-11 09:49:18
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

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
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!