Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (683)
Games in Android Showcase (196)
games submitted by our members
Games in WIP (750)
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 ... 58
1  Game Development / Newbie & Debugging Questions / Re: LibGDX + Ashley, Entity is stationary (Mostly) on: 2016-07-17 14:48:59
What is the unit of delta time here? If the unit is in seconds, then I'm sure that the delta is a fraction, and hence multiplying the velocities by it will only cause a negligible movement. If that is the case, just increase the velocity values.
2  Java Game APIs & Engines / Engines, Libraries and Tools / Re: JGLOOm - Loading Every File Format for Every OpenGL Lib* on: 2016-07-16 06:20:09
Why is there no support for XM files?

How did you think that it is popular formats?
3  Games Center / WIP games, tools & toy projects / Re: JTimelapse on: 2016-07-15 16:55:32
Working great, tested on Windows 10 64-bit and 32-bit VM.
4  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-07-15 15:08:05
After a lot of days, made some more progress on my game, and drawn the king (appears in cutscenes, not in game play):



Left: Vector version in Inkscape.
Right: Original hand made sketch with pen on paper.
5  Discussions / General Discussions / Re: JGO bounced back on: 2016-07-13 01:54:36
Immediately after noticing that JGO is down, I have stopped by cron job to automatically fetch the backups. Can I resume it now?
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-07-10 14:08:18
Finished my basic XML Parser. Now time to add support for CData elements.



I think I will push this to GitHub now, and integrate it into SilenceEngine.
7  Game Development / Newbie & Debugging Questions / Re: getters and setters vs public vars on: 2016-07-10 12:51:57
I dunno why I read
vars
as
wars
in the title at first, but here are my opinions in that regard. Note that I have changed my style, after coming to know of the 64k method limit on android, but I like this new style, as this is more simple.

Rule #1: Prefer to use public variables when they make sense

For example, take a class which is only a container of data, such as a
Vector2
. Then it is better to leave the variables x and y as public. Using setters and getters is not a good option because it's not clean.

1  
2  
3  
4  
5  
// Clean way, using public variables.
speed.x += 4;

// Not so clean when you use getters and setters
speed.setX(speed.getX() + 4);

Using getters and setters like this will make your code look complex. However do this only when you need no validation on the variables, like in this case. It is a simple data class so keep them as public.

Rule #2: For objects that don't need to be set, consider using
final
and public.


For example, you have to write a class that has a property called position, and it is of type
Vector2
. Now you want your users to be setting its contents and not itself directly. Use the final keyword here, and initialize it once in the constructor.

1  
2  
3  
4  
5  
6  
7  
8  
// This works, and you intend to do this simply.
entity.position.x += 4;

// But this will give an error if you try to assign it.
entity.position = new Vector2();

// And you just do this in the class, pretty simple.
public final Vector2 position = new Vector2();

This gives a benefit that you do not need to evaluate the variable each time for being null, and we can enjoy the simplicity too. Keep in mind that getters and setters are needed if the data requires validation.

Rule #3: Use Getters in case you need the value to be readonly to users and not in that same class.

Yes, in case you are needed to set the value of the variable internally and prevent the user from accessing it, use a getter and make it private or protected. For example, you can do this for FPS value from the game loop so the user is able to get the fps but not set it.

Rule #4: Use Setters in case you need data verification.

Yes, I don't say never use setters, you have to use them when you really need and this is one of such areas. Consider that you have to set a value, like the volume of the playing sound, and it should be in a range.

1  
2  
3  
4  
public void setVolume(float volume)
{
    this.volume = Math.min(1, Math.max(volume, 0));
}

These are the four basic rules that I've taught myself recently after reading a lot of sample android code, and they work great for me so I do recommend them to you. Additionally this removes the function call overhead, as I heard (but am not sure) that invoking virtual functions causes some overhead.
8  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-07-08 17:49:00
I started writing an XML parser today, and it's getting along pretty well. This one is part of college assignment, and is purely educational. Just did some work on the tokenizer and got some basic tokens.

1  
2  
3  
<?xml version="1.0" ?>
<test>
</test>

Will generate these tokens.

1  
2  
3  
4  
5  
6  
XmlToken{type=TAG_BEGIN, text='<', line=2, start=1, end=2}
XmlToken{type=NAME, text='test', line=2, start=2, end=6}
XmlToken{type=TAG_END, text='>', line=2, start=6, end=7}
XmlToken{type=TAG_CLOSE, text='</', line=3, start=1, end=3}
XmlToken{type=NAME, text='test', line=3, start=3, end=7}
XmlToken{type=TAG_END, text='>', line=3, start=7, end=8}

This is pretty awesome, now time to add support for attributes. I'm omitting the prologue for simplicity and this is not a real parser.
9  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Best way to store/get textures for rendering ? on: 2016-07-08 17:08:18
I'm not a user of LibGDX, but the procedure I follow might be the same, because I employ a resource loader that loads the resources asynchronously too. First of all, I define a class called
Resources
and store all my references in it.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
public class Resources
{
    public static class Programs
    {
        public static Program SPRITE_PROGRAM;
        public static Program FONT_PROGRAM;
    }

    public static class Textures
    {
        public static Texture BACKGROUND;
        public static Texture CLOUDS;
        public static Texture GROUND;
        public static Texture BULLET;
        public static Texture BLOCKS_SHEET;
        public static Texture AMOEBAM_SHEET;
        public static Texture ENEMY_SHEET;
        public static Texture AMOEBAM_SHOOT_SHEET;
        public static Texture LOGO;
        public static Texture EXIT;
        public static Texture AMOEBAM_ROLL;
    }

    public static class Sounds
    {
        public static ALBuffer MUSIC;
        public static ALSource EXPLOSION;
        public static ALSource SHOOT;
    }

    public static class Animations
    {
        public static Animation AMOEBAM;
        public static Animation AMOEBAM_SMALL;
        public static Animation WATER;
        public static Animation AMOEBAM_SHOOT_START;
        public static Animation AMOEBAM_SHOOT_STOP;
        public static Animation ENEMY;
    }

    public static class CollisionTags
    {
        public static final CollisionTag GROUND  = new CollisionTag();
        public static final CollisionTag AMOEBAM = new CollisionTag();
        public static final CollisionTag BULLET  = new CollisionTag();
        public static final CollisionTag ENEMY   = new CollisionTag();
        public static final CollisionTag EXIT    = new CollisionTag();
        public static final CollisionTag WATER   = new CollisionTag();
    }

    public static class Levels
    {
        public static Level LEVEL_1;
        public static Level LEVEL_2;
        public static Level LEVEL_3;
        public static Level LEVEL_4;
        public static Level LEVEL_5;
        public static Level LEVEL_6;
        public static Level LEVEL_7;
        public static Level LEVEL_8;
        public static Level LEVEL_9;
        public static Level LEVEL_10;
    }
}

My resource loader loads the defined resources too, and it gives a long handle to get them back once handled. Once they are loaded, I just copy them to these references and I can use them anytime. For example, when I want to draw the background, I can just say

1  
renderer.draw(Resources.Textures.BACKGROUND, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

And it works just fine. The resource loader still keeps the resources in the HashMap, which will be released at the end. These are just references and this is how I do for my games. The above source is actually from my game Amoebam, my LD entry.
10  Discussions / General Discussions / Re: What does your dream language look like? on: 2016-07-06 10:08:16
I never really liked aliases, because they often confuse the reader.

Regarding iOS, I heard that oracle is working on OpenJDK mobile with version 9. If it is true, I'd be the most happiest person, until Java 10 is announced I guess...

I don't understand what's wrong with multidimensional arrays though, could you please kindly explain that to me?
11  Discussions / General Discussions / Re: What does your dream language look like? on: 2016-07-06 09:30:45
I meant encrypting everything other than classes. User should be able to store the resource files in a container that only the JVM can decode.
12  Discussions / General Discussions / Re: What does your dream language look like? on: 2016-07-06 08:52:11
I'd take Java 8, and add value types and operator overloading to it. And I will add a way to encrypt the jar files to prevent from decompiling. That's basically enough for me.
13  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-07-04 05:43:22
Is this an audio library?
Have you implemented a better performing method for streaming PCM than Android's AudioTrack?

I don't know the internals, but it uses OpenSL ES as the backend. I'm compiling opensles, wave and the null backend.
14  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-07-03 18:49:26
Spent time on updating the AndroidOpenAL project, now updated the OpenAL Soft sources to 1.17.2. Today was a tough day, because I had failed to compile it since last four days, and my only successful compilation was a month ago with 1.12 version. Finally, I made it!

I learnt how libraries work in C environment, how makefiles work, and how GNU makefiles are different from Android makefiles. I have read the CMake lists, found out the different options, and found how it creates a config file, and hand composed that configuration. I also pulled out the sources into my NDK lib, made sure that the JNI sources still work, fixed a ton of linker errors and finally it is now done.

AndroidOpenAL version 0.2-SNAPSHOT is now in OSSRH snapshots repo. I'm facing a crash when loading 32-bit binaries (shared objects) into 64-bit phone, but it works fine on 32-bit phone. Will have to crack that tomorrow.

Anyways, this is the thing that I made today. Technically yesterday, 12:20 AM now, but am off to sleep with a ton of satisfaction today.

By the way, I got more devices to test and learn development, currently doing development on OnePlus X running 5.1.1, Lenovo K4 Note with 6.0.1, and my father's Samsung Note 10.1 which is running 5.1.1 as well.
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-06-29 17:37:37
I thought of combining large repeating meshes and push them to the GPU as a single mesh which improves performance, and I have created another constructor for my
MeshRenderer
which takes an instance of the
DynamicRenderer
instance so the same data can be reused again and again without uploading it every frame to the GPU.

1  
2  
3  
4  
5  
6  
7  
DynamicRenderer dynRenderer = ...;

dynRenderer.begin(Primitive.TRIANGLES);
{
    // Add vertex data, colors, normals and texcoords here.
}
dynRenderer.end();

This is how normally I render meshes. This renderer is a utility class which collects the data in a big VBO under the hood and streams it to the GPU, giving the ease of the immediate mode rendering with custom shaders. Now in case I want to store some meshes into a large meshes that I know they are static, I can combine them into a batch.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
DynamicRenderer dynRenderer = ....;

// The RenderPolicy here prevents the renderer from calling glDrawArrays and
// clearing the data. The data will be cleared once the renderer begins again.
dynRenderer.begin(Primitive.TRIANGLES, RenderPolicy.NO_RENDER);
{
    // Add the vertex data here now.
}
dynRenderer.end();

// Finally create a mesh renderer using this dynamic renderer to get a large Mesh
MeshRenderer meshRenderer = new MeshRenderer(dynRenderer);

That's it, I can now freely render multiple static meshes in one go, and instead of streaming large meshes every frame, I can create them once into a batch, and call render as many times as I can do. It helps me as I can now reuse the dynamic renderer for rendering other entities or even dispose it altogether. It took me an hour, but is worth its time.
16  Discussions / General Discussions / Re: Thanks to JGO - Exiled Kingdoms wouldn't have been possible without this website on: 2016-06-29 12:39:31
Thanks a lot for this, am already playing the game since the last one hour and it is extremely awesome. I use the last key by the way.
17  Game Development / Performance Tuning / Re: The Android/LibGDX conspiracy on: 2016-06-29 04:39:21
Did I miss something here @Hydroque? I think the issue is with Android application running on an actual device, how did the windows task manager come into this context?
18  Game Development / Performance Tuning / Re: The Android/LibGDX conspiracy on: 2016-06-28 21:50:00
This is what I originally said with what package did you declared in the manifest. You will be giving the package of the main activity class in the manifest which is located in src/AndroidManifest.xml file. The one in the apk is of course binary.
19  Game Development / Performance Tuning / Re: The Android/LibGDX conspiracy on: 2016-06-28 09:53:12
Okay this is interesting now. Thing number two, what is the Java source version that you are using?

Android VM is not like the standard Java VM and it is said that it still doesn't support some features in Java 7. In this case the compiler generates code which is back ported to Java 6. This is especially true for invokeDynamic instructions which are unsupported by android.

The next thing to look for is using accessor methods. Whenever possible we should use the variables directly. The method count also has some impact on the performance. The tips specified in the android developer manual may be useful for you.

https://developer.android.com/training/articles/perf-tips.html

Apart from that, make sure that you enable Progaurd which is disabled by default. This helps as it eliminates the dead code prior to JIT execution.
20  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-06-28 04:40:04
I just found that WebGL 2.0 arrived on android in experiments.



To enable you must also enable the draft extensions list. Here's the link for quick access:

chrome://flags/#enable-unsafe-es3-apis
21  Game Development / Performance Tuning / Re: The Android/LibGDX conspiracy on: 2016-06-28 01:23:24
Thing number one: Are you making a Java library or an android library?

This is the first question to be solved and I think it will point to a solution. Android can support Java libraries, but android libraries are a different case that they have the package in the manifest so that the compiler can optimise those classes. The android libraries have the .aar extension which is short for android archives.

This might be happening in case of LibGDX, because it was declared in the manifest. Try making another manifest for your library.

I'm not completely sure but I think this might be the case. In case you already made JOML as an android library then something might be the issue.
22  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-06-27 08:48:31
@theagentd You should definitely consider emitting the #line directives which allow you to get correct line numbers while debugging shaders.
23  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-06-26 05:30:20
I'm pretty much happy with PHP 7 right now as we are using it for college project. I don't know much about security as I'm a newbie in PHP. The point is that I'm happy enough with it.
24  Java Game APIs & Engines / Engines, Libraries and Tools / Re: GWT-AL - OpenAL implementation for the GWT platform on: 2016-06-20 15:54:38
GWT-AL is now version 0.2-SNAPSHOT. The main change is that the older version will not work anymore due to the recent deprecations to some nodes in the Web Audio API and Chrome is issuing warnings in the console.

The new version have fixed that issue, and also implemented doppler shift on the sources. Additionally a number of old bugs are fixed. In case you are using the older version, change it immediately and if you have any code already compiled, you'd have to recompile it. There is no change in the public API.

Maven

1  
2  
3  
4  
5  
<dependency>
    <groupId>com.goharsha</groupId>
    <artifactId>gwt-al</artifactId>
    <version>0.2-SNAPSHOT</version>
</dependency>

Gradle

1  
compile 'com.goharsha:gwt-al:0.2-SNAPSHOT'

All the users are requested to update to the new version as soon as possible.
25  Games Center / WIP games, tools & toy projects / Re: Drift Team on: 2016-06-19 09:12:48
I'm so happy that you made a real game using WebGL4J. Your game is pretty awesome. Though I felt the controls were a bit hard, it is really fun. Congratulations.

Why not add sound to it using GWT-AL now?
26  Game Development / Newbie & Debugging Questions / Re: [Libgdx]GWT 'not emitting code for accessing method' on: 2016-06-18 19:19:06
CopyOnWriteArrayList has perfectly fine usecases in single-threaded code.

But GWT doesn't provide any concurrent utilities like this in it's JRE emulation.



http://www.gwtproject.org/doc/latest/RefJreEmulation.html
27  Game Development / Newbie & Debugging Questions / Re: [Libgdx]GWT 'not emitting code for accessing method' on: 2016-06-17 17:24:23
There is no point in using concurrent collections here, since GWT doesn't support threads.
28  Game Development / Newbie & Debugging Questions / Re: [Libgdx]GWT 'not emitting code for accessing method' on: 2016-06-17 15:20:57
SHC, seems that file doesn't exist anymore, returning a 404

Yes, the docs now recommend not to use the DTD (atleast the folks on IRC said that they aren't using DTD) but the latest URL is here. The project has now moved to GitHub.

https://raw.githubusercontent.com/gwtproject/gwt/master/distro-source/core/src/gwt-module.dtd
29  Game Development / Newbie & Debugging Questions / Re: [Libgdx]GWT 'not emitting code for accessing method' on: 2016-06-17 13:39:16
I use this in my GWT modules, and it works fine for me.

1  
2  
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
        "http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">

Of course this is from the documentation of Wiki, as I don't use LibGDX. In any case, this should fix it.
30  Games Center / Android Showcase / Re: Circlus [libgdx] on: 2016-06-13 13:51:13
Same here, it says it's not available in India.
Pages: [1] 2 3 ... 58
 
orrenravid (170 views)
2016-07-16 03:57:23

theagentd (240 views)
2016-07-11 14:28:54

Hydroque (323 views)
2016-07-06 05:56:57

Hydroque (475 views)
2016-07-03 08:52:54

GrandCastle (357 views)
2016-07-01 09:13:47

GrandCastle (349 views)
2016-07-01 09:09:45

CopyableCougar4 (404 views)
2016-06-25 16:56:52

Hydroque (380 views)
2016-06-22 02:17:53

SwampChicken (350 views)
2016-06-20 13:22:57

SwampChicken (290 views)
2016-06-20 13:22:49
Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42

FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17
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!