Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (744)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (825)
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 4 ... 11
31  Games Center / Showcase / Re: Project Raft - An Indie Shipwreck Survival on: 2014-02-26 22:29:23
No offence but this is not sell-able.
  • Poor graphics
  • JDialog for in-game messages
  • Java icon on jdialogs

Nevertheless, I wish you luck.  Stare
32  Game Development / Newbie & Debugging Questions / [LibGDX] Rotation of particle emitter on: 2014-02-26 22:18:02
I'm wondering how I can rotate a particle emitter around an origin. At the moment I'm using this code to rotate the particle emitters:

1  
2  
3  
4  
5  
6  
7  
Array<ParticleEmitter> emitters = p.getEmitters();
for (int i = 0; i < emitters.size; i++) {
   ScaledNumericValue emitterAngle = emitters.get(i).getAngle();
   emitterAngle.setLow(emitterAngle.getLowMin() + angle);
   emitterAngle.setHighMin(emitterAngle.getHighMin() + angle);
   emitterAngle.setHighMax(emitterAngle.getHighMax() + angle);
}

This works fine except I want to rotate the particle emitter around the origin of my sprite. This is my result otherwise which isn't desired.

 
33  Game Development / Newbie & Debugging Questions / Re: Trouble understanding bitmasking on: 2014-02-26 16:55:22
  • I have heard that primitive types in Java reserve the last bit to the sign of the variable (plus or minus). Is this true?
  • Java shorts are 2 Bytes, and longs are 8 Bytes. Should I then in theory be able to pack 4 shorts into 1 long? Will the different data types cause problems?

 1) Sort of. Java uses signed data types. A signed byte can represent the values of -128 to 127. An unsigned byte can represent the values of range 0 to 255.

Unsigned byte:
Decimal:+128+64+32+16+8+4+2+1
Binary:00000000

Signed byte:
Decimal:-128+64+32+16+8+4+2+1
Binary:00000000

Unsigned vs Signed:
BinarySignedUnsigned
0000 000000
0000 0010+2+2
0101 0010+82+82
1000 0000-128+128
1001 0000-112+144
0010 0100+36+36
1111 1111-1+255
1101 0110-42+214

 2) Yes you can hold 4 shorts (16-bit integer) into one long (64-bit integer).


Issues with your code:

1  
long pack = Long.MIN_VALUE;  // since Java primitive data types are signed, MIN_VALUE is -2^63. Instead initialize as 0

1  
pack |= (components[i] & 0xFFFF) << (i*16);  // & 0xFFFF does absolutely nothing


1  
components[i] = (short) (( pack >>> (i*16) ) & 0xFFFF); // better to use right shift (>>) operator and &0xFFFF will always result in 0


You're storing the values like so:
short[3]    short[2]    short[1]    short[0]

You're shifting the bits so that;
pack >> 0 = short[3]    short[2]    short[1]    short[0]
pack >> 16 = 0000...    short[3]    short[2]    short[1]
pack >> 32 = 0000...    0000...    short[3]    short[2]
pack >> 48 = 0000...    0000...    0000...    short[3]

So what you want to do is cast the rightmost bits to shorts. To do this, you need to do AND 0x000000000000FFFF. So pretty much,

1  
components[i] = (short) (( pack >> (i*16) ) & 0x000000000000FFFF);
34  Discussions / General Discussions / Re: When should I stop reinventing the wheel? on: 2014-02-25 20:20:25
If LibGDX has what you want, use it. I only started using LibGDX again last week and realised what a huge waste of time it was attempting to create my own game engine. If you like tinkering with all the low level jargon though, keep at it.
35  Discussions / Miscellaneous Topics / Re: What do you think about religion and opressing gay rights? on: 2014-02-22 22:16:17
Marriage is a religious concept...

Prove it.
36  Discussions / Miscellaneous Topics / Re: What do you think about religion and opressing gay rights? on: 2014-02-22 22:09:36
In response to the other posts about whether religion is a good idea or not, I have this to say:

Although I am not sure about other religions, I know that the on of the two main 'commands' of Chrisianity is to "love one another as you do yourselves".
My question to you is this:

Have any of the people who influenced your view of Christianity (or any religion) shown that to be true of their actions?

Not saying that those who don't aren't really Christians. Just that they may have missed a (very important) point. I have even been yelled at by people in the streets that I am going to hell. Which is actually kind of funny. I have also seen/heard of people who just show kindness to others and help them out. Who do you think is a better picture of a Christian? And who do you think is the more common one?

Instinct.
We don't need religion to tell us that we should be kind to one another.
37  Discussions / Miscellaneous Topics / Re: What do you think about religion and opressing gay rights? on: 2014-02-22 21:28:59
Religion is the partly successful manipulation of people, the partly successful suppressor of freedom, the partly successful blocker of innovation, the partly successful cause of war, the partly successful breakdown of peace, the partly successful controller of the mind. Religion is a hypocrite. Religion is a successful dictatorship. If religion didn't exist,..

Think. Escape.
38  Discussions / Miscellaneous Topics / Re: Applied for my HND (With life story) on: 2014-02-22 20:17:48
No offence to them, but most people my age are dumbf**ks. The stupid government is putting computer science as a compulsory subject in the curriculum. In IT I had to do scratch for 2 years, making shitty animations. I actually did some Visual Basic as well, which I consider to be one of the most revolting languages to look at, and the IT teach who claimed he was a programmer had to look up the syntax of a for loop. From eight weeks of VB no-one in the class learnt a thing.

So yeah, that's pretty much going to be the curriculum. f**king around with Scratch for probably 5-6 years and learning nothing from unqualified teachers.

It's expected that you spend 25 hours making a piece of crap using Greenfoot.
I hate that software, it is most for primary school learning, it should NOT be used in higher education.
Yes prices in England are shocking, just move here. 4 years you can get citizenship and take advantage of the broken system.
I totally agree. If the stupid government wants to put computer science on the curriculum, they might as well teach it when kids start school, when they teach you how to read, write and talk. After all, they say the younger you are the faster you learn. Greenfoot is a piece of crap. I installed it 4 months ago and learnt how to click a few buttons and write a few if statements.
Scratch, Greenfoot and BlueJ are shit.

Finally, putting computer science on the national curriculum is idiotic. The truth is that most kids are lazy idiots. They'll have learnt what an if statement is after 6 years then they'll believe that they can be a game developer or software engineer.

Have a look at this past GCSE computer science paper, it's a joke. Before I even started learning Java, I tried it and got 70%. http://filestore.aqa.org.uk/subjects/AQA-GCSE-COMPSCI-W-SQP.PDF
39  Discussions / Miscellaneous Topics / Re: Applied for my HND (With life story) on: 2014-02-22 19:45:07
Interesting life story.

It's ridiculous that education costs a bloody fortune in England; I don't want to pay £9000/yr (probably soon to be raised to £10k/yr) and risk being in debt for the rest of my life. It's also a pity that I live no-where near a college that does anything even related to game development. Oh well, I shouldn't have to worry about that for the next two years. At least I can do computing for GCSE - at the moment I have to do PHP, which I'll probably find totally useless, though next year I'll demand to do game development (obviously using Java) because I can. I can't wait for the reaction I get when I do that coursework. It's expected that you spend 25 hours making a piece of crap using Greenfoot.
40  Discussions / General Discussions / Re: My next step as aspiring developer on: 2014-02-22 19:13:13
I really suggest finishing the game completely before you add it to your resume. Whether you put it on Google Play or whether you build it for iOS is totally up to you; just make sure you complete the game. A near-complete buggy game looks so much worse than a 100% complete game.
41  Games Center / WIP games, tools & toy projects / Re: SixtyGig - Open World Retro RPG. on: 2014-02-21 19:27:16
Interesting theme. I love the graphics by the way, good job. Smiley
42  Discussions / Miscellaneous Topics / Re: for loop? on: 2014-02-20 13:10:37
Quote
The loop body is executed "for" the given values of the loop variable
http://en.wikipedia.org/wiki/For_loop
43  Java Game APIs & Engines / Engines, Libraries and Tools / [LibGDX] Drawable to texture on: 2014-02-18 23:37:15
Is it possible to convert a Drawable to a TextureRegion? I'm using Scene2D and I'm loading all of my Drawable objects via a Skin, however I want to apply linear filtering to one of them.

Edit: Never mind, stupid question once again.  Clueless
44  Game Development / Newbie & Debugging Questions / Re: Random Sprites Showing on: 2014-02-18 19:01:46
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class User {

    private Code code;

    public static Code getCode() {
        return code;
    }

    public static void main(String[] args) {
        User gibbo3771 = new User();
        System.out.println(gibbo3771.getCode().toString())
    }
}

I get a nullpointerexception.  Emo
45  Game Development / Newbie & Debugging Questions / Re: Best way to reuse a texture on: 2014-02-17 17:52:33
Don't create a new texture for everything. Generating and binding textures is an expensive operation. Instead use TexturePacker to pack textures and load each sprite with a texture region.

You can run TexturePacker every time you run your application while in development.
1  
2  
TexturePacker.process("../Project-android/assets/textures", "../Project-android/assets/textures/packed",
      "sprites"); // I find it easiest to use a json file for the settings

Ignore the atlas file that's generated; it's only useful for Scene2D skins now. Instead, load the generated spritesheet as a texture and load each sprite with a texture region, like so:
1  
2  
3  
4  
5  
private static Texture sprites = new Texture(Gdx.files.internal("textures/packed/sprites.png"));

private static Sprite spriteLoader(int x, int y, int width, int height) {
      return new Sprite(new TextureRegion(sprites, x, y, width, height));
}

Once set up, all you have to do is put a new sprite in the assets folder and it'll automatically pack it into the spritesheet.
46  Java Game APIs & Engines / Engines, Libraries and Tools / [LibGDX] Scene2D Image Skin constructor on: 2014-02-16 17:45:22
I'm working with Scene2D and I've noticed that you can create an Image actor using a skin. In the default skin JSON fine, you seem to use the name of an image atlas attribute to define a drawable. For example, the ButtonStyle object:

1  
2  
3  
4  
com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: {
   default: { down: default-round-down, up: default-round }, // uses image atlas attributes to define drawables
   toggle: { down: default-round-down, checked: default-round-down, up: default-round }
},


Image doesn't have a style yet you can still retrieve a drawable from the skin. Does this mean that to create an image, if I had an attribute named flower in an atlas then I would do the following:

1  
Image image = new Image(skin, "flower");


Or would I somehow have to define the drawable in the skin file?
47  Games Center / WIP games, tools & toy projects / Re: A Cup of Christmas Fear on: 2014-02-16 17:20:55
The screen size seems likely to be the issue. I can't recommend enough that you use Scene2D. It's really easy to use and once you get used to using skins, you can create a decent UI within 30 minutes. It provides table layout which is really useful for handling resizing.
48  Game Development / Newbie & Debugging Questions / Re: Is there an offline libGDX documentation? on: 2014-02-16 13:32:53
It should be included in the latest nightly build. All you should need to do is set up LibGDX in your IDE.
Going by your coding experience, I highly recommend getting more experience with Java before trying to use a game engine. LibGDX is quite difficult and confusing to use for a beginner.
49  Games Center / Android Showcase / Re: Dragon Run [NOW ON GOOGLE PLAY & APPLE APP STORE] on: 2014-02-15 19:35:37
Maybe I'm just being picky, though shouldn't the highest score change when you beat your previous highest score?

Took me 30 minutes to get that...  Clueless

By the way, I love the title of the webpage. Cheesy
50  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Stage projection matrix [fixed] on: 2014-02-14 15:40:08
I fixed this, finally...
At first I found a quick fix which was to manually set the combined matrix of the stage camera. After some snooping around through the source code I figured that I had to update the camera after setting the viewport.

This is the working render method, if anyone else finds this thread in the future:
1  
2  
3  
4  
5  
6  
7  
@Override
public void resize(int width, int height) {
   super.setViewport(width, height);
   super.getCamera().update();
   uiArea.setProjectionMatrix(super.getCamera().combined);
   uiArea.resize(width, height);
}
51  Game Development / Newbie & Debugging Questions / Re: LibGDX having trouble with tiled maps on: 2014-02-13 15:50:24
That's odd. There's obviously an error parsing the file. Have you edited it? All I can suggest is trying to recreate the map.
52  Game Development / Newbie & Debugging Questions / Re: LibGDX having trouble with tiled maps on: 2014-02-13 15:22:03
This is a really old thread.  Roll Eyes

Anyway, if you'd have read the previously replies, the problem is that a BOM has been saved in the file. Open the file with a text editor such as eclipse text editor or notepad++ and you should be able to remove the BOM.
53  Game Development / Newbie & Debugging Questions / Re: Double Buffering Clarification on: 2014-02-12 16:25:18
The value of the graphics instance in the dbImage is passed to the variable dbg. This allows access to that same graphics instance via the dbg variable. If you've had previous experience using another language, you may be confused because of pass by reference and pass by value. Java passes the value of the reference, i.e it's pass by value.

Example:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
class A {
    Graphics graphics;

    Graphics getGraphics() {
        return graphics;
    }
}

class B {
    B() {
        A a = new A();
        Graphics g1 = a.getGraphics(); // g1 is assigned to a.graphics - modifying a value of a variable of the g1 instance modifies the value of a variable of the a.graphics instance; they're both the same instance
    }
}

Regarding the order of method calls, as far as I understand it, repaint is called on the event dispatch thread which is created when you set up a JFrame, while drawImage is called on the main thread (I could be totally wrong, I'm just trying to recall what I remember from using Swing) but you really don't need to worry about it.

As I said previously, Swing isn't used for larger projects; it's usually only used for very small games. If you still don't completely understand it, don't worry. Just move on and start learning about game development concepts, then you should move on to using OpenGL/a game engine built on top of OpenGL.
54  Game Development / Newbie & Debugging Questions / Re: Double Buffering Clarification on: 2014-02-12 14:55:24
The paint method is called automatically when the JFrame is created.

1  
2  
3  
dbImage = createImage(getWidth(),getHeight());
dbg = dbImage.getGraphics();
paintComponent(dbg);

The variable dbImage is assigned the Image instance returned by the createImage method. The Java API says: "Creates an off-screen drawable image to be used for double buffering." So it creates an empty Image instance which is assigned the dimensions of the screen. It then assigns the variable dbg to the graphics instance returned by the getGraphics method, which you're passing to the paintComponent method. The paintComponent method then draws the oval to that graphics instance.

To sum that up, you're creating a new image to represent the screen and you're drawing the graphics to that image.

The paintComponent method then calls repaint, which in turn calls the overridden paint method from JFrame. Before that happens though, g.drawImage is called. This method pretty much draws the dbImage Image instance to the JFrame graphics instance.

The reason why this happens before the paint method is called is due to the mysteries of concurrency. I wouldn't worry too much about concurrency if you're new to game development; it's difficult for beginners to understand.

Overall, don't worry about not completely understanding what you're doing with Swing if you're focused on game development. Swing is good for learning about the basic concepts, but it isn't used often for more complex, larger projects.
55  Game Development / Shared Code / Re: ProtectedInteger - Protect your game from memory editors on: 2014-02-11 16:08:20
Sorry, I know nothing about memory editors, but why couldn't someone read both the key and value and do the bitwise operations themselves?
56  Game Development / Newbie & Debugging Questions / Re: [LibGDX] ShapeRenderer producing weird results on: 2014-02-11 15:54:35
Hm, well think about setting the projection matrix to the stage, how would that help? Unless your stage has a seperate size or coordinate system all your doing is making shit complicated by setting something that is the same as it would have been if you had done it normally.

That was my original thinking, though I couldn't think of any other reason of why it's not rendering correctly.
All I'm doing is setting up a stage (I'm extending stage in my screen class, as I see no reason why it'd be a bad idea), then I'm instantiating a separate class which at the moment simply calculates the bounds of the rectangle to draw. This is my resize method:
1  
2  
3  
4  
public void resize(int width, int height) {
   uiArea.resize(width, height); // calculates the bounds of the rectangle
   super.setViewport(width, height); // sets the stage viewport
}


This is my render method:
1  
2  
3  
4  
5  
6  
7  
8  
9  
   public void render(float delta) {
   Gdx.gl.glClearColor(bg.getRed(), bg.getGreen(), bg.getBlue(), 1f);
   Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

   super.act(delta);
   super.draw();

   uiArea.draw(); // calls the draw method which I posted in my OP
}


If you're wondering, the values I posted in my OP for sr.rect are the values for the screen size of (310, 275).
57  Game Development / Newbie & Debugging Questions / [LibGDX] ShapeRenderer producing weird results on: 2014-02-11 15:03:14
I'm having trouble with ShapeRenderer. All I'm doing is creating an instance of ShapeRender then I'm calling this method when I render:
1  
2  
3  
4  
5  
public void draw() {
   sr.begin(ShapeType.Line);
   sr.rect(15.5f, 13.75f, 279f, 247.5f);
   sr.end();
}

This is the result that I see on the screen.


It seems to be drawing the rectangle at (10, 11) with a size of (181, 214). I sussed that the problem is probably the projection matrix, so I tried to set the projection matrix to the projection matrix of the stage. When I do that though, nothing is rendered. What could be the problem?
58  Game Development / Newbie & Debugging Questions / Re: Is it easy to make games through pure java? on: 2014-02-09 16:47:50
Thank you guys by the way do you guys suggest from me to order this book?
http://www.packtpub.com/learning-libgdx-game-development/book

I've never read it, however the LibGDX wiki should tell you all you need to know.
Whether or not you have a good understanding of the Java language, I recommend starting off learning the basics (e.g collision detection and response, the game loop, etc.) using Swing and AWT. When you understand the basics then you can move on to OpenGL/LibGDX. I found it easier to use LibGDX after learning OpenGL, though some people would say otherwise.
59  Game Development / Newbie & Debugging Questions / Re: [repost]getBounds() on: 2014-02-05 19:15:41
You made a pretty fatal mistake there.
A byte has 8 bits, or 'booleans' in this matter, not just 4!

Have a nice day.

- Longor1996

Oh wow, I can't have been thinking consciously. I edited the post. Stare
60  Games Center / Featured Games / Re: FarSky on: 2014-02-05 16:21:59
The trailer is amazing. Those waves at the end... wow. When are you going to put this on Steam greenlight?
Pages: 1 [2] 3 4 ... 11
 
Ecumene (148 views)
2017-09-30 02:57:34

theagentd (213 views)
2017-09-26 18:23:31

cybrmynd (296 views)
2017-08-02 12:28:51

cybrmynd (285 views)
2017-08-02 12:19:43

cybrmynd (295 views)
2017-08-02 12:18:09

Sralse (288 views)
2017-07-25 17:13:48

Archive (967 views)
2017-04-27 17:45:51

buddyBro (1093 views)
2017-04-05 03:38:00

CopyableCougar4 (1665 views)
2017-03-24 15:39:42

theagentd (1426 views)
2017-03-24 15:32:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
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!