Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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 ... 68
1  Game Development / Newbie & Debugging Questions / Re: Trouble making circular boundaries for 2D game on: 2014-11-10 22:47:00
Can't you just use the distance formula?

1  
2  
3  
4  
double distanceFromCircle = Math.sqrt( (player.x-circle.x)*(player.x-circle.x) + (player.y-circle.y)*(player.y-circle.y) );
if(distanceFromCircle < circle.radius){
   //ship is inside radius of circle
}


Where possible, always compare the squares.
2  Java Game APIs & Engines / Java 2D / Re: Fast 2D hardware scaling of images (without GL?) on: 2014-11-01 08:02:30
Try using BufferStrategy.
Also stick some delays around switching into FSEM, as its interaction with the rest of the J2D API is prone to race conditions. (Even when it's all executing on the EDT)

It's a terribly unstable and unreliable API.

Also, spinning on Component.repaint() is terribly wasteful(flooding the EDT's EventQueue with repaint events) and is not guaranteed to achieve what you want it to.
3  Discussions / Miscellaneous Topics / Re: Draw a point or a dot. on: 2014-10-31 16:50:02
From what I recall, drawLine(x,y,x,y) is the preferred way of drawing just a single pixel through the general purpose rendering pipeline.
Obviously if you're doing a lot of individual pixels, then you should bypass the pipeline, and manipulate an Image's Raster directly
4  Discussions / General Discussions / Re: Paint program that allows full rotation? on: 2014-10-14 01:11:14
Hope you're not pre-rotating sprites persecutioncomplex

Nope Cool, I could draw the text in Java2D than rotate it, but I'd like to pre-rotate the text and save it in the .png VS. programmatically rotating the text to the desired angle every frame.
Quote

So rotate the text once, and draw it into an Image?

Embedding text in graphic resources is a bad habit that should be avoided whenever possible; makes localisation a lot more difficult.
Probably not a concern for your project, just something to keep in mind going forwards.
5  Discussions / General Discussions / Re: Paint program that allows full rotation? on: 2014-10-13 10:30:38
Hope you're not pre-rotating sprites persecutioncomplex
6  Game Development / Networking & Multiplayer / Re: Using UDP and TCP? on: 2014-10-12 12:45:45
UDP & TCP serve different purposes; if you have needs that are fulfilled by using both, then it's absolutely right to use both.

If it's any reassurance, there are lots of AAA games that use.
7  Discussions / Miscellaneous Topics / Re: Name that Poker hand - Tiny Code Challenge on: 2014-10-09 20:31:32
If they were using an older version of Java (circa Java 1.5), you'd be able to completely destroy the Java FizzBuzz highscore with this:

1  
class S{static{for(int i=0;i<100;)System.out.println((++i%3<1?"Fizz":"")+(i%5>0?i%3>0?i:"":"Buzz"));}}


Back then the static initializer would execute before the main thread threw the "No Main method" error.
As that error is delivered to stderr, not stdout, it'd still fulfill the competition's requirements.

Alas, not to be.
8  Discussions / Miscellaneous Topics / Re: Name that Poker hand - Tiny Code Challenge on: 2014-10-09 20:14:39
For fizzbuzz? No, because the method declaration would be too large. It's such a tiny challenge there is no room for any fanciness.
The only one I used a recursive solution for was the sudoku solver.

Nah, for the Tiny Poker challenge.

Tbh I hadn't given it much thought, just emphasizing that micro-optimisation can only get you so far - an algorithmic change might give much more significant gains.
Though if the algorithm doesn't benefit from a virtually free & unbounded stack, it's unlikely recursion will offer a more efficient solution.

I did wonder if Java 8's lambda syntax might be able to give significant gains ( e.g. "myList.forEach(System.out::println)"), unfortunately the package locations of even the most basic class requirement (java.util.Arrays) sinks that idea pretty quickly.
9  Discussions / Miscellaneous Topics / Re: Name that Poker hand - Tiny Code Challenge on: 2014-10-09 14:41:45
I wonder if a recursive solution might be smaller.
10  Discussions / Miscellaneous Topics / Re: Is drinking half a bottle of vodka safe? on: 2014-10-09 14:32:24
Without your 'friend' noticing, replace the vodka with another clear colourless liquid and you're good to go! (so long as the replacement isn't Petrol....)
11  Discussions / Miscellaneous Topics / Re: [news] Windows 10 (9) on: 2014-10-05 14:55:57
It's laughable how being able to move and resize apps is being marketed as a feature.

...and why is the UI still composed of these hideous opaque rectangles?
Is it a case of the lowest common denominator? Microsoft wanting to present a consistent visual style between infinite-resource desktop & constrained-resource laptop/tablet?
If so they should shoot themselves for making such a compromise as it's uglier than Windows 3.1!

...and why is having search accessible from 2 places that are mere pixels away from one-another good design???
What's more important is that search ACTUALLY SEARCHES; Windows search hasn't worked properly since Windows XP.
If I search the root directory of my hard drive for all files containing a particular phrase, that's *precisely* what I want it to do - I don't want to restrict the search to indexed files, nor do I want to restrict the search to only a 'special' list of file types or locations.
Sure, use an index & file type priorities to accelerate easy searches, but DON'T lie to me by saying that you've finished looking & found nothing; until cancelled, a search should be exhaustive.

Also, why do a few UI tweeks justify:

a) a huge development team
b) a whole new product

Nothing I've seen so far justifies more than a simple patch developed by a lone student programmer.
The Windows code base must be so grotesquely bloated that making even the simplest change requires man months of effort.

It's time to incinerate it & start from scratch.
12  Game Development / Newbie & Debugging Questions / Re: NullPointerException or if statement on: 2014-09-30 11:30:35
Exceptional circumstance - > Exception

Missing resources is a perfectly acceptable example, though checking that they loaded properly in the first place is preferable (but not always possible).
13  Game Development / Game Mechanics / Re: Issues with gravity on: 2014-09-28 23:38:39
Have a Google for separating axis theorem and swept volumes.

http://www.metanetsoftware.com/technique/tutorialA.html
14  Game Development / Newbie & Debugging Questions / Re: Storing and getting bounding boxes. on: 2014-09-27 22:48:17
Keeping them sorted on 1 axis is a very simple solution that, for a sparsely populated domain, can be very efficient.
15  Discussions / General Discussions / Re: Performance Test for the Voxel Thing on: 2014-08-30 16:55:08
Phenom II x6 1055T @ 3.36GHz,
8GB ram @ 1280MHz
Win 7 x64
HD 5870 @ stock

uncapped: 95-105 fps
16  Discussions / General Discussions / Re: Performance Test for the Voxel Thing on: 2014-08-28 14:52:25
56-61fps

Hard to tell if the drops are simply timing inaccuracy, or if it's actually failing to hit the fps cap.

Phenom II x6 1055T @ 3.36GHz,
8GB ram @ 1280MHz
Win 7 x64
HD 5870 @ stock

Didn't need to increase vm memory
17  Game Development / Newbie & Debugging Questions / Re: Lost my CODE! on: 2014-08-13 23:44:29
Anything recoverable from your Windows 'Previous Versions' ?
18  Game Development / Networking & Multiplayer / Re: 10 Player(instanced) 3D Game, would TCP Suffice? on: 2014-07-17 09:39:20
If you have client side prediction, you'll be able to get away with the latency spikes inherent to TCP's packet retransmission method.

If you're doing lockstep without prediction, you'll need UDP. Instead of retransmission, have redundancy through duplication; every packet sent by the client contains everything that occurred since the last ack.
19  Discussions / General Discussions / Re: What's with unorganized code? on: 2014-06-24 10:28:26
Disorganised...
20  Discussions / Miscellaneous Topics / Re: Can any wireless usb connect to a router on: 2014-06-20 17:31:50
£15 gets you an 8 port gigabit switch; the number of ethernet ports on your router shouldn't be the reason* for opting for wifi.

*mobility & convenience on the other hand are perfectly reasonable justifications for wifi.
21  Game Development / Newbie & Debugging Questions / Re: Creating a chunk-based custom binary file format on: 2014-05-27 10:09:27
As I started to work on this, I noticed that I can't come up with a good way to write chunks into byte arrays, then output the byte arrays using DataOutputStream.

You're going to have to be more specific; what is the problem?

All I can suggest is that you look at the file format specification for a popular chunk based format, I'd suggest PNG (section 4.7 onwards); it's straight forward and well documented.
22  Game Development / Performance Tuning / Re: Questions about Java4k Code on: 2014-05-16 11:12:01
A class member requires a constant pool entry, and larger bytecode to access.

That said, once obfuscated these two are equivalent:

1  
2  
3  
4  
static final int a = 0;
run() {
final int b = 0;
}
23  Discussions / General Discussions / Re: Oracle wins copyright for the Java APIs on: 2014-05-09 22:48:44
/facepalm.

Their need to use similes to define their case tells you all you need to know about lawyers.... they know nothing about programming.

So, what next? Microsoft to sue the various Linux DirectX emulation layers?

24  Game Development / Performance Tuning / Re: Is there a logical reason to stuff 2D array data into one? on: 2014-05-06 12:26:17
Going back to the original question...

Quote
Is there a logical reason to stuff 2D array data into one?

If your game logic can be implemented more simply with a 1D array, then there is most definitely a good reason.

Pixel operations for example, can often be performed irrespective of axis coordinates, thus the algorithm will look a lot neater if the data is manipulated as a flat array (avoiding the need for nested loops).
25  Game Development / Performance Tuning / Re: Parallel insertion sort for almost sorted data sets on: 2014-05-01 09:45:09
So teleporting entities from one end of the domain to the other would be a catastrophe for the efficiency of this algorithm.
Cylindrical/toroidal coordinate systems are a big no no then!
26  Game Development / Performance Tuning / Re: Parallel insertion sort for almost sorted data sets on: 2014-04-30 08:09:35
Just from a quick skim of your initial diagrams, I'm curious what the algorithm does when an element belongs in a chunk that isn't a neighbouring chunk?
Eg if an element supposed to be in the last chunk,  was placed in the first.

Are the overlaps rechecked until the list is completely sorted?
27  Game Development / Newbie & Debugging Questions / Re: moving a generalPath on: 2014-04-19 22:31:38
Graphics.translate(x,y) or Graphics2D.translate(tx,ty)

The latter being equivalent to Graphics2D.setTransform(AffineTransform.getTranslateInstance(tx,ty))
28  Game Development / Newbie & Debugging Questions / Re: Can you randomly bitwise shift an integer left or right? on: 2014-04-13 11:31:31
Shifts are defined for all inputs

Just not what you might expect* Grin
*right-hand operand is truncated to 5 bits(for an int shift) or 6 bits (for a long shift).

I came a cropper of this behaviour some time ago.
29  Game Development / Newbie & Debugging Questions / Re: Advice on a faster way to check every pixel in an image. on: 2014-04-12 18:04:50

Not when you're loading 10~ of these sheets (depending on the spritesheet it needs to grab) about 300~ times... /snip

You're reloading the same image multiple times?
30  Game Development / Newbie & Debugging Questions / Re: Gradient fill a BufferedImage on: 2014-04-12 17:54:37
You googled for it?
http://lmgtfy.com/?q=gradient+fill+java
Pages: [1] 2 3 ... 68
 

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

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (57 views)
2014-11-26 15:22:04

toopeicgaming1999 (50 views)
2014-11-26 15:20:36

toopeicgaming1999 (10 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (26 views)
2014-11-25 11:26:43

Gibbo3771 (23 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (75 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

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

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

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!