Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (616)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
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 ... 59
1  Game Development / Newbie & Debugging Questions / Re: Client + Server, "Same" code running at different speeds on: 2013-09-03 11:25:38
I think I understand the problem you are having. I don't really have a solution, but something you might try is changing the time between updates (eg 20 ms instead of 10ms) just to see what happens, if the ratio between the client and server's speed changes it might eliminate the timer as the issue.
2  Game Development / Performance Tuning / Re: Are Ternary Operations optimized at compile time? on: 2013-07-15 09:12:32
There's already a thread about open braces. Just thought I'd point that out before there's any more debate.  Grin
3  Game Development / Newbie & Debugging Questions / Re: [SOLVED!] Real-time Strategy Unit Highlighting on: 2013-07-11 06:40:05
While you could do it with the code you have now, and you would do that by comparing if the object.x is between mousestartx and mouseendx and the same for y.

but another (probably cleaner) way to do this would be to just make a rectangle instead of doing the 4 lines yourself, and then do rectangle.contains(x,y) to find if it is in there. Or like heroesgravedev said, rectangle collision.
4  Game Development / Artificial Intelligence / Re: Enemy moving towards player with low friction on: 2013-07-09 14:27:46
its acceleration.

(m/s-m/s)/s = m/s^2 aka acceleration

yeah, sorry it wasn't very clear witht he multiple 2's.... But I hope it all works for you.
5  Game Development / Artificial Intelligence / Re: Enemy moving towards player with low friction on: 2013-07-09 13:42:26
yes there is calculating it.

for example if you want to be on the new course in 2 seconds and you want to have a finaldx of 6, and your startdx is 2

then ddx = (6-2)/2 = 2

then its just
enemy.xVelocity += xAcceleration
enemy.yVelocity += yAcceleration

for 2 seconds.

The reason I phrased ddx how I did was so that you would realize the above on your own, if you view acceleration as the rate of change of velocity then this is very obvious.
6  Game Development / Artificial Intelligence / Re: Enemy moving towards player with low friction on: 2013-07-09 13:17:05
Yes, sorry, I wasn't very clear I assumed the notation would make sense. When I say ddx I mean the rate of change of the x velocity (ie the rate of change of x displacement from the origin (0,0))
7  Game Development / Artificial Intelligence / Re: Enemy moving towards player with low friction on: 2013-07-09 12:50:22
Off the top of my head, you could have ddx and ddy values and then change the dx and dy values accordingly.
8  Game Development / Newbie & Debugging Questions / Re: Scrolling Tiledmap Slick2D on: 2013-07-09 12:10:01
Oh woops, I thought you said it didnt work. Ignore me I am obviously confused today Wink.
9  Game Development / Newbie & Debugging Questions / Re: Scrolling Tiledmap Slick2D on: 2013-07-09 11:48:14
unless if I am misunderstanding your code, thats pretty much what I told you to do  persecutioncomplex?

anyways, kudos Smiley
10  Game Development / Newbie & Debugging Questions / Re: Scrolling Tiledmap Slick2D on: 2013-07-09 10:50:58
That usual is the way to do this, yes.
But, because all the coordinates besides x, y are in tiles, it will only render full tiles, so that means an ugly scrolling in a block-by-block way.
I wish I could make a video of this..

Yes, I understand what you mean and the video was very clear. I had thought that the code I posted would fix that because it takes into account the block issue by using the remainders. I can't test anythign becuase I am at work right now. So the code I gave you produced the same results as you had before?
11  Discussions / General Discussions / Re: Making a Static Free Engine on: 2013-07-09 09:19:34
Static isn't inherintly evil, it is just something that needs to be used intelligently just like everything else in java. For a beginner it can seem so easy to use static because often in simpler projects it can make all of your problems dissapear. Scaling up those faulty techniques causes the nightmares the OP described. In a properly coded program static will probably be required, however it needs to be used correctly otherwise you'll have some headaches later.
12  Game Development / Newbie & Debugging Questions / Re: Scrolling Tiledmap Slick2D on: 2013-07-09 08:57:02
You can just check how close your offset is to being a multiple of your tilesize and use that difference to move the map slightly so for example if your xoffset is 100 and your tilesize is 30 then your code would look like

or more generally


that may not be perfect because I just came up with it on the spot, but it should be the right idea. You might have to add 1 to the width and height, but you'll be able to figure that out.
13  Game Development / Newbie & Debugging Questions / Re: Scrolling Tiledmap Slick2D on: 2013-07-09 08:37:23
There used to be a great example by kevglass on this exact topic, but maybe it was lost when slick was taken over by other developers.

The basic idea is that you use Graphics.translate(float x, float y) to move everything so that the player (or wahtever your camera is following) stays at the center of the screen. The key to this is to find the offset of the player from the center and translate everything by that much.
14  Game Development / Newbie & Debugging Questions / Re: Multiplayer Games on: 2013-07-09 08:25:48
If I'm understanding the OP correctly he's trying to learn some networking basics, not create an MMO. I agree with you entirely that reinventing the wheel is usually not the smartest approach, but sometimes when trying to learn, it is good to understand everything that is going on, and then hand it over to the library for ease.
15  Game Development / Newbie & Debugging Questions / Re: Multiplayer pong on: 2013-07-09 08:08:20
I wrote a multiplayer pong a while back using kryonet, it was very dirty code and didnt end up working too well, but it did work.

HeroesGraveDev has the right idea in that one of them is a server and one is a client and the protocols are just like any other client-server relationship. All you have to decide is how you want them to interact.

You can decide to keep all information on both of them and try to keep them synced. The other way is to keep all of the information on the server and make the client a dummie, just sending input to the server which then does the computations and sends back the neccesary information.

For a game as simple as pong you can probably get away with either, especially since security probably isnt much of an issue.
16  Game Development / Newbie & Debugging Questions / Re: Computing volume on: 2013-07-09 07:59:55
Try using the trapezoid rule or a reiman sums? you could choose how accurate you got from the subintervals with the tradeoff being performance.
17  Game Development / Newbie & Debugging Questions / Re: Working On first Text based RPG game. on: 2013-07-03 09:19:36
like RobinB said you're off to a good start, just remember your structure as you code because if you code the core of your program with everything in mind it'll be really easy to add extremities Smiley
18  Games Center / Featured Games / Re: State of Fortune on: 2013-06-03 12:21:28
I actually really enjoy your monologue just for the record Smiley. It inspires me to actually get off my ass (figuratively) and start coding Wink.
19  Game Development / Networking & Multiplayer / Re: [KryoNet] 'Field not declared as byte: 0' on: 2013-05-22 08:10:36
You said you made a change, I assume undoing that change fixes it? Because its entirely possible something else is the problem. I've had that happen to me in the past that I was looking in the wrong place.
20  Game Development / Performance Tuning / Re: Anyone else here get a major kick out of refactoring and optimizing regularly? on: 2013-05-19 15:09:45
I am absolutely the worst about this, I take forever just trying to find the best possible solution that takes the least amount of code possible. Its a really bad habit, but I REALLY hate writing inefficient code.
21  Game Development / Newbie & Debugging Questions / Re: Player wall collision sliding problem [Need Help] on: 2013-05-03 12:24:31
I'm not sure I understand completely because some of the code isn't there (collision() for example).

However, I think you are doing things a little backwards, you're moving then verifying that move. An easier way is to verify the move and only move if it is a legal move.

If you can give more information I can help further Smiley.
22  Game Development / Newbie & Debugging Questions / Re: Re-Spawning in same position with same enemy states [Help Needed] on: 2013-04-26 14:16:30
I may be mistaken, but I think GlennBrann was asking how to keep htem in the same position as they were before the player died. In which case you should have a block of code in your update procedure that only runs when the player is alive, so if the player is dead the enemies stop moving and when he comes back they resume.
23  Game Development / Newbie & Debugging Questions / Re: [Java2D] findind x and Y after Rotation on: 2013-04-26 12:36:46
I'm also not sure about your question, but I'm gonna make an assumption that you are looking for  the tip of the gun's x and y?

If that is the case, then you just use your basic trigonometry knowledge:

Sin means the y value of an angle on a unit circle (r=1).
Cos means the x value.

In order to find the tip of the gun you would do this:

gunTipX = math.sin(gun.angle)*gun.length + gun.x;
gunTipY = math.cos(gun.angle)*gun.length + gun.y;

Hope I could be of help Wink.

If I misunderstood your question, then please clarify Smiley.
24  Game Development / Newbie & Debugging Questions / Re: Collision Detection for tiled map via cross products? on: 2013-01-16 08:34:12
well, with your current setup it might be a little tricky. This is something I've seen very commonly with people using Slick.

Instead of checking each time which keys are down for movement, you could respond to the events keyPressed and keyReleased, and then set a velocity for your sprite (rectangular form), and then if you run into a wall going up, you just set your y component to zero which won't affect your x component at all.

Does that make sense?
25  Game Development / Newbie & Debugging Questions / Re: ConcurrantModificationException on: 2013-01-01 01:16:19
yeah, I guess, but you could just do a counter-- if it is critical. while not optimal, still easier than making another list.
26  Game Development / Newbie & Debugging Questions / Re: [unsolved] Recalling an int, gives an "empty" spot. on: 2012-12-31 14:26:54
I'm not sure I entirely understand your question, but can't you just make a variable that stores it?

for example StoredX and StoredY? and then use those?
27  Game Development / Newbie & Debugging Questions / Re: ConcurrantModificationException on: 2012-12-31 14:14:27
I personally just use the simple for-loop  persecutioncomplex

I think it is a lot easier to just use that line of code (which shouldn't confuse you at all), and not have to worry about multiple lists and the like.

On another note, I don't agree with your use of a removal list, I would just use the boolean like ra4king recommended.

And also, look into having a single list if you can, it is much cleaner and often easier to handle as your game becomes more complicated (less loops).
28  Game Development / Newbie & Debugging Questions / Re: Thread sleeping not playing well with Java2D? on: 2012-12-31 14:09:13
Yeah, this is just a thought, but sleeping may prevent your program from rendering until after the sleep is over.

You could try using a timer instead?
29  Discussions / General Discussions / Re: Trying To Make A Shared JTextArea on: 2012-12-30 21:20:42
I think you're looking at this backwards. You aren't synchronizing the JTextField, you are synchronizing the String for the contents of the field, and as a consequence the JTextField.

Does that make sense?
30  Discussions / General Discussions / Re: Trying To Make A Shared JTextArea on: 2012-12-30 19:50:40
You could synchronize your two users using a database. Not sure how scalable that would be. Another alternative would be to have a server program that communicates with the clients and has a central copy of the edited document and uses it to keep the clients synchronized.

Hope I could help,
Pages: [1] 2 3 ... 59
Coldstream24 (15 views)
2015-09-03 00:41:28

Andrew_3ds (24 views)
2015-09-01 19:08:10

afikri (16 views)
2015-08-31 09:30:22

afikri (24 views)
2015-08-31 09:30:07

afikri (13 views)
2015-08-31 09:27:24

afikri (16 views)
2015-08-31 09:26:40

Roquen (24 views)
2015-08-29 11:30:54

GamerC4 (35 views)
2015-08-22 20:38:50

GamerC4 (33 views)
2015-08-22 20:37:18

GamerC4 (40 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

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