Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (690)
Games in Android Showcase (201)
games submitted by our members
Games in WIP (764)
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 ... 71
1  Game Development / Newbie & Debugging Questions / Re: Point changing for some reason on: 2016-09-27 08:52:57
public Cell(Point location)

Java passes references, and Point is a mutable type.
Any changes (outside this class) made to the Point instance that you pass into the constructor will alter the value returned by Entity#getLocation().

Java actually passes by value, it never passes by reference.

It may look like it passes by reference but it is actually by value.

This doesn't change the answer though.

I didn't say it passes by reference; I said it "passes references", and yes, it passes references by value.

However, this is semantic complexity that is entirely beyond the level of understanding demonstrated by the OP, hence why I avoided the topic.
2  Game Development / Newbie & Debugging Questions / Re: Point changing for some reason on: 2016-09-26 23:25:27
public Cell(Point location)

Java passes references, and Point is a mutable type.
Any changes (outside this class) made to the Point instance that you pass into the constructor will alter the value returned by Entity#getLocation().

A superficial way of fixing this would be to replace:
super.location = location;

super.location = new Point(location)

There's a 2nd problem with your code; your Entity class has a protected member:
protected Celltype cellType

while your Cell subclass has a private member of the same name.

So the assignment in your Cell constructor:
cellType = MasterGame.cellTypes.get(random.nextInt(MasterGame.cellTypes.size())); assigning a value to the member Cell#cellType.

While the Entity method:
   public CellType getCellType() {
      return cellType;

...will be returning Entity#cellType.

I doubt this is what you intend.
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LibZ - 2D Java Game Library on: 2016-09-26 01:19:15
It isn't that slow.

In the order of 1000x slower than hardware accelerated drawing.
That *is* what I'd consider really slow.
4  Game Development / Newbie & Debugging Questions / Re: Directional collisions with rectangles and circles on: 2016-09-19 12:11:43
Breakout is a simple enough game to use swept area collision detection; the maths for both swept circle<->line segment and swept circle<->swept circle are well documented.

Such a technique would give you perfectly accurate collision detection, unlike a rigid body physics engine with penetration & restitution, which sacrifices precision for universality.

Though your approach should really depend on how you want the ball to behave; anything more than perfect elasticity, and a physics engine might be the better choice.
5  Java Game APIs & Engines / OpenGL Development / Re: Vertex cache shenanigans on: 2016-09-13 01:57:25
Batch size test invocations: 130056 / 50331648
Calculated vertex cache batch size: 387

Cache size 1 invocation test: 130056 / 50331648
Cache size 2 invocation test: 260112 / 50331648
Cache size 3 invocation test: 390168 / 50331648
Cache size 4 invocation test: 520224 / 50331648
Cache size 5 invocation test: 650280 / 50331648
Cache size 6 invocation test: 780336 / 50331648
Cache size 7 invocation test: 910392 / 50331648
Cache size 8 invocation test: 1040448 / 50331648
Cache size 9 invocation test: 1170504 / 50331648
Cache size 10 invocation test: 1300560 / 50331648
Cache size 11 invocation test: 1430616 / 50331648
Cache size 12 invocation test: 1560672 / 50331648
Cache size 13 invocation test: 1690728 / 50331648
Cache size 14 invocation test: 1820784 / 50331648
Cache size 15 invocation test: 6372742 / 50331648
Cache size 16 invocation test: 11184822 / 50331648
Cache size 17 invocation test: 50331648 / 50331648

  Renderer: AMD Radeon HD 5800 Series
  Calculated vertex cache batch size: 387
  Cache size: 16

AMD HD 5870 1GB. (Crimson 16.2.1)
6  Java Game APIs & Engines / OpenGL Development / Re: *AMD testing needed!* Vertex cache shenanigans on: 2016-09-12 16:38:05

  Renderer: AMD Radeon HD 5800 Series
  Calculated vertex cache batch size: 2147483647
  Cache size: -1

Yep, same failure on my AMD HD 5870 1GB. (Crimson 16.2.1)
7  Game Development / Networking & Multiplayer / Re: Why Threads for the Client on the Server? on: 2016-09-10 02:16:26
Have a read up on blocking and non-blocking I/O.
8  Discussions / General Discussions / Re: Pokemon GO 'augmented reality' game on: 2016-07-13 18:04:22
Few would consider a child scribbling all over the Mona Lisa to be augmentation; just sayin'  Grin
9  Game Development / Newbie & Debugging Questions / Re: getters and setters vs public vars on: 2016-07-10 11:10:32
have sense ^^

public void Proc_Collis(){
   Return_Collis.Reset_Data();//Always first
   Return_Collis.have_Collis = true;
   ///calculate Pos_Offset + Velocity
class Return_Collis{
   static public boolean have_Collis;
   static public Vec3 Velocity;
   static public Vec3 Pos_Offset;

   static public void Reset_Data(){
      have_Collis = false;
      Velocity = new Vec3();
      Pos_Offset = new Vec3();

If I encountered that in a code base, I'd run for the hills.
10  Game Development / Newbie & Debugging Questions / Re: getters and setters vs public vars on: 2016-07-09 11:11:36
a variable like "speed" in your example would be good (in my opinion) to make public. This is because you cant do:
player.speed *= 10;
player.speed %= 30;
easily with getters and setters

Encapsulation. A class of objects should manage its own state.

If you've got code all over the place directly manipulating the speed of the player (either the member directly, or through getters/setters), then you've failed to properly encapsulate your code.
11  Discussions / Miscellaneous Topics / Re: Scripting Language on: 2016-07-09 10:55:06
That makes sense. Thanks for your reply.

This lead me to a blog which details out some nice information

It detailed out for me two types of VMs: Stack and Register. I like the register based one, which was obviously more promoted. I rarely deal with stacks anways.

As of now I am just messing around trying to discover how things work more down deep. Everyone eventually writes the 'basic' language at some point. Aha Smiley

That blog is good, though it doesn't address the most important advantage of a stack-based VM; portability.

A stack-based VM can be run on a processor with any number of registers.
Equally a stack-based VM can be easily transposed onto a register-based VM. (as demonstrated by the translation of java bytecode into dalvik bytecode)

Essentially a stack-based VM is more abstract, and thus more flexible.
True it leaves more work for the JIT to do, but (beyond the most naive of implementations) doesn't mean it's necessarily less efficient.

Rather than attempting to write your own VM, I'd suggest just studying Java's VM specification. It's an excellent document:
12  Discussions / Miscellaneous Topics / Re: Scripting Language on: 2016-07-09 02:44:43
push 32
push a

Does add pop 32 and pop a from the state? Or should future pushes pop the second push in that pop has to be ran twice to edit push 1? Or am I getting this process wrong?

If we're talking about a stack based (virtual) machine:
- the push instruction would take one operand (in your example 32 or a) and push it onto the stack.
- the add instruction would pop the top 2 values from the stack, add them together, and place the result back onto the stack.

There are many resources on the Internet explaining how basic stack based VMs work.
13  Game Development / Newbie & Debugging Questions / Re: Temporary ObjectOutputStream wrapping InputStream on: 2016-07-07 09:58:42
Buffering of input streams is horrible Undecided ; it makes for fragile code and breaks the encapsulation of streams.

Contractually isn't the only foolproof way of 'temporarily' using any buffered input stream(incl. OIS), to return it as a new wrapper of the passed in stream? Therefore requiring any subsequent reads to pass through the (potentially non-empty) buffer, and in so doing making the new stream permanent not temporary?

Though this obviously creates the potential for an ever increasing chain of streams & buffers due to multiple invocations.

14  Discussions / General Discussions / Re: What does your dream language look like? on: 2016-07-06 17:14:11
This  Cool
15  Discussions / Business and Project Management Discussions / Re: How to package game files on: 2016-07-05 23:30:18
I would compare it to locking my vehicle. Stealing is against the law and even so, someone may be able to get in there by various means to take things. Maybe even the car itself. But that still doesn't deter me from locking it whenever I exit. Of course it's not a bullet proof method to keep my things completely safe but I'm not about to stop locking my car.

I just want something simple to package everything into a file rather than leaving all my sprites out in the open.

Your analogy isn't really equivalent; yes you lock your car because it makes it harder to break into, but:
1) This increased difficulty for the thief increases the chance of their detection.
2) Which encourages the thief to go elsewhere.

Obfuscating your resources (or code) doesn't increase the chance of detection (it remains zero), nor does it encourage the thief to go elsewhere (if they need what you have, you are the only source).

Moreover there exist tools, that operate at the binary level, able to identify & rip image, sound, and video assets both from disk & from the in-memory representation.

Obfuscating your resources might deter the casual browser; but the casual browser isn't the one who is going to use your assets in a damaging way. (They may in fact be using them in a constructive way, building a wiki or the like)

Thus you're at best wasting your time, and at worst impeding fans of your game.
16  Game Development / Shared Code / Re: XM File Formats on: 2016-07-04 00:22:14
Stop wasting your time reinventing the wheel (badly); write some games instead!


...and for the record, PNG images don't have to be compressed.

Back when I was doing J2ME work for MIDP1 devices a neat way of doing image rotation was to:
- store the png images uncompressed inside the jar (relying on the jar's own deflate to keep the file size reasonable)
- load each into a byte[]
- rotate the uncompressed pixels in the IDAT chunk in situ (never supported multiple chunks, so image size was constrained)
- recalculate the CRC
- then pass the byte[] to the midp1 image loader.

A horrible hack, but useful knowledge as it forced me to become intimately familiar with the excellent PNG format.
17  Game Development / Newbie & Debugging Questions / Re: Movement interpolation - alpha ruins floating point and makes jerky moves on: 2016-06-20 22:28:38
I believe re-arranging the expression so only the delta is multiplied by alpha will (in this situation) avoid the issue.

drawX = prevX + (currentX-prevX)*alpha;
18  Discussions / General Discussions / Re: Question: Bit-exact floats on different computers? on: 2016-06-17 20:26:46
Why not just use StrictMath everywhere?

Do some of the Math methods with exactly defined results (e.g. Math.sqrt) get intrinsified?
19  Discussions / General Discussions / Re: Question: Bit-exact floats on different computers? on: 2016-06-15 22:13:48
Even on ARM and for both floats and doubles? Can I be 100% sure that if I run the exact same deterministic program on both the result will be bitwise exactly the same?

Short of a VM bug, hardware bug, or error in your own code, yes.

Java requires & utilizes only IEEE 754 floating point.
( )
FP-strict forces all intermediate values to be constrained to the same precision as the operands.
( )
20  Game Development / Game Mechanics / Re: [LibGDX] Rotate around a shape in a non-circular motion on: 2016-06-14 00:46:47
Linearly interpolate between the vertices.
21  Game Development / Newbie & Debugging Questions / Re: Notifying another class, in another thread, of a variable change? on: 2016-05-02 22:00:15
Stick the input in a queue*, and poll the queue in your game thread.

*(obviously making sure reads & writes to the queue are properly synchronized)
22  Game Development / Game Mechanics / Re: Hardware-like software cursor. on: 2016-05-01 16:06:46
Wasn't that the technique used in Molyneux's Black & White?
I seem to remember the cursor & game framerates being disconnected from one-another as being a major selling point of that game.
23  Discussions / General Discussions / Re: Interesting proposals: Java 9 and beyond on: 2016-03-16 11:58:04
      String s = Cast_Me(aaa, String.class);
   static public<T> T Cast_Me(Object Obj, Class<T> cl){  
         return (T)Obj;
      return null;

I hope you realize how & why that is really really nasty.

To the other suggestions, I favor if instanceof; it's the one closest to 'fixing' the instanceof operator (it should have never been a binary operator).
24  Games Center / WIP games, tools & toy projects / Re: War of Conquest on: 2016-02-26 00:00:56
Instructions needed  Clueless
25  Games Center / Android Showcase / Re: FiveMinuteGame on: 2016-01-25 20:42:59
Interesting game.
Can't say I've worked out very much of a strategy; best I've managed so far over the 5 rounds is 2524.

Is there a good strategy to it?
The only vague rules I've come up with so far are:
- trace out the results of the 1st few rotations, ensuring that it spreads to at least 4 simultaneous node activations.
- Try to start near the middle of the board
- Avoid starting near areas containing many aligned nodes

I can imagine there must be board states that will lead to an endless cycle?
26  Game Development / Game Play & Game Design / Re: Risk design on: 2016-01-25 16:41:24
If world map of Risk is a problem, we can call it World Domination game, inspired by risk and change countries names and I think we are okay, no ?

Hasbro don't own the copyright for planet Earth's political map.........

You can do what the f**k you want.
27  Discussions / Miscellaneous Topics / Re: Looking for a old wipeout-like game on: 2015-12-26 16:48:41
CyberSpeed? PSX & PC.
Looks pretty grey to me.
28  Game Development / Networking & Multiplayer / Re: Titanfall - some math on server bandwidth requirements. on: 2015-12-16 23:42:11
It doesn't mention or address the lack of continuity, coherence & community endemic with matchmaking systems.

While this isn't something that's been a major part of console gaming, PC has (until fairly recently) enjoyed the benefits of the traditional server browser + private servers model.
While such a system doesn't scale as neatly or efficiently as the cloud-based system described for Titanfall, the community benefits of static named servers cannot be understated.
Being able to visit the same server, and encounter the same 'locals' is an invaluable foundation upon which friendships & a community grows.

That's something Blizzard have really missed with games like Hearthstone.
The degree of anonymity given to players means it's essentially a glorified Turing test; A community will never develop in such a sterile environment.
This is IMO a missed opportunity, as social investment can be a huge draw to keep players coming back long after they've exhausted the content of the game itself.

I think that's why Twitch streams are so successful; however chaotic they can be, they permit the social interaction that isn't provided by most modern games.
29  Game Development / Networking & Multiplayer / Re: what would be the basic structure for UDP multiplayer server/client on: 2015-12-15 23:58:13
Adding reliability to UDP will incur the same penalty.

That's simply not true; as implied in my previous post, there are other ways of implementing reliability without incurring the massive latency spikes inherent with TCP's strategy.

The simplest approach being to append all unack'ed packets each time you broadcast data, so when a packet goes missing, you simply wait for the next.
Of course this redundancy approach increases packet size significantly, but that's a perfectly valid compromise if latency is your priority.

The point is, even on modern reliable connections, TCP is not the universal answer.
30  Game Development / Networking & Multiplayer / Re: what would be the basic structure for UDP multiplayer server/client on: 2015-12-15 18:40:16

You shouldn't use UDP to build games, at least not without a lot of extra complexity,
for the simple reason that UDP is not guaranteed to be reliable.   UDP messages
can arrive out of order, or not at all.  You can use UDP for non-critical messages
such as the instantaneous mouse position, but anything that affects the flow of
the game has to be sent reliably.

This leaves you with two choices.  Either use TCP for "important" messages, and
somehow integrate the non-synchronized TCP and UDP streams, or add a layer
of complexity to your UDP messages to add TCP-like reliability guarantees to
the important messages.

True enough, reliability is the crux of the issue.
Though there are many ways to achieve reliability, and while TCP's implementation is a good general purpose solution, for games where latency is a concern & packet loss is probable, its behaviour is pretty horrible.

So I'd never say "You shouldn't use UDP to build games".
You should use UDP when you know that the performance characteristics of TCP are unacceptable.

Though the OP's question sounds like he's trying to run before he can walk.
Write your RPG 1st; don't even think about how to make it multiplayer until you've finished making it work for 1 player.
Pages: [1] 2 3 ... 71
xTheGamerPlayz (149 views)
2016-09-26 21:26:27

Wave Propagation (343 views)
2016-09-20 13:29:55

steveyg90 (456 views)
2016-09-15 20:41:23

steveyg90 (453 views)
2016-09-15 20:13:52

steveyg90 (495 views)
2016-09-14 14:44:42

steveyg90 (519 views)
2016-09-14 14:42:13

theagentd (503 views)
2016-09-12 16:57:14

theagentd (433 views)
2016-09-12 14:18:31

theagentd (308 views)
2016-09-12 14:14:46

Nihilhis (742 views)
2016-09-01 13:36:54
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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!