Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (686)
Games in Android Showcase (198)
games submitted by our members
Games in WIP (758)
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  Discussions / General Discussions / Re: Ludum Dare 36 on: 2016-08-27 01:33:10
The theme is Ancient Technology. Have fun guys.
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-08-24 19:05:56
Got a 3D low-poly character with an armature! Built it in 20 minutes initially, but it took 3 days for the weights to be properly applied.

3  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-08-22 17:21:06
Found this in Windows Store today.



What is this Microsoft? How is it possible? Are you injecting something else into my system?  Huh
4  Game Development / Newbie & Debugging Questions / Re: JOML - quatf.addScaledVector(vec3, float) on: 2016-08-22 13:43:36
FMA stands for Fused Multiply Add if I remember this right. I have never used it myself, but think I read this somewhere. Correct me if I'm wrong.

Assuming quatf to be a quaternion in floats, how will you add a vector to it? I think quaternions are only used for rotations and not translations or scalings.
5  Discussions / Miscellaneous Topics / Re: There is no hope on: 2016-08-21 10:45:24
Give him a reply:

Because you cannot create a game exactly like this. If you don't want to purchase, make your own game and play it yourself.
6  Discussions / General Discussions / Re: Ludum Dare 36 on: 2016-08-19 18:31:06
I'm in, and this time with a team.

http://ludumdare.com/compo/2016/08/19/im-in-for-my-8th-time-2/

And with my own SilenceEngine. You can run tests online.
7  Java Game APIs & Engines / Engines, Libraries and Tools / Re: JGLOOm - Loading Every File Format for Every OpenGL Lib* on: 2016-08-18 14:32:07
My plan was to have an AiSceneRenderer that simply renders a scene given an AiScene. Then we'd have different variations of LWJGLAiRenderer, WebGLGWTAiRenderer, and JOGLAiRenderer.

My advice is to create an interface with OpenGL functions that the renderer would need, and implement the renderer in the core. The interface with the opengl functions will be passed to the renderer from the backends.
8  Java Game APIs & Engines / Engines, Libraries and Tools / Re: JGLOOm - Loading Every File Format for Every OpenGL Lib* on: 2016-08-17 16:06:07
GWT and JS both have the support for reading binary files too. You can create an XHR to a file, set it's type to ArrayBuffer and receive an array buffer, which is like a container for binary data. You can create a DataView on top of it which behaves like a DirectByteBuffer. For example, here is a GwtDirectBuffer class that I wrote for the GWT backend of SilenceEngine.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
public void readBinaryFile(FilePath file, UniCallback<DirectBuffer> onComplete)
{
    // Create a XMLHttpRequest to load the file into a direct buffer
    XMLHttpRequest request = XMLHttpRequest.create();
    request.open("GET", file.getAbsolutePath());

    // Set to read as ArrayBuffer and attach a handler
    request.setResponseType(XMLHttpRequest.ResponseType.ArrayBuffer);
    request.setOnReadyStateChange(xhr -> {
        if (request.getReadyState() == XMLHttpRequest.DONE)
            // Invoke the onComplete handler
            onComplete.invoke(new GwtDirectBuffer(request.getResponseArrayBuffer()));
    });

    // Send the request
    request.send();
}

And now I have this method to read the file as a binary file. Note that this is callback based because of JavaScript's single threaded nature. Once done, the callback is invoked, and then you can simply read the bytes from the buffer as you wish.

9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: JGLOOm - Loading Every File Format for Every OpenGL Lib* on: 2016-08-15 18:29:43
I'll take a look into this for a few days (had training programme in college, so I can't immediately work on this). And here are some things to keep in mind when working with GWT, and IO in specific.

  • There is no synchronous IO. IO should happen in form of XmlHttpRequests and we should use callbacks to do the result.
  • GWT has no support for threading, and waiting on the main thread will cause the browser to become unresponsive.
  • GWT doesn't support reflection because it is a source-to-source translator.
  • There are only a limited number of classes emulated from the JRE, no NIO classes are available.

These are the things to keep in mind, and I think you are violating all these right now. Even though you get the data of the files through XHR, you can't directly get the pixel data out of it. The only way to load images is to inject a IMG tag to the browser and set it to not visible, and once it's loaded, you have to pass it directly to WebGL.

We can of course work-around the NIO classes by implementing a GWT support library with super source. Hope we can deal with these.
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: JGLOOm - Loading Every File Format for Every OpenGL Lib* on: 2016-08-15 17:03:40
I just gave a look at your code, and I can offer myself to port it to WebGL4J. But there is a problem in jgloom-io that you are reading from InputStream and others which aren't available in GWT. You're also using ImageIO and BufferedImage classes? Other than that, this is great work.
11  Game Development / Newbie & Debugging Questions / Re: How Do I time events? on: 2016-08-14 12:54:14
I keep a custom timer which is updated automatically at the same time as game update events. Here is the class I'm using.

https://github.com/sriharshachilakapati/SilenceEngine/blob/silenceengine-1.0.1/silenceengine/src/main/java/com/shc/silenceengine/utils/GameTimer.java

It is just implemented based on keeping track of elapsed time since last update. These should be updated each frame, and the callback is called once the elapsed time is greater than the scheduled time. And the usage, how I use it.

Run once timer

1  
2  
3  
4  
5  
6  
GameTimer timer = new GameTimer(2, TimeUtils.Unit.SECONDS);
timer.setCallback(() ->
{
    // Do the timer task here.
});
timer.start();

Repeating timer

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
GameTimer timer = new GameTimer(2, TimeUtils.Unit.SECONDS);
timer.setCallback(() ->
{
    // Do the timer task here.

    // Reschedule the timer
    timer.setTime(newTime, newUnit);
    timer.start();
});
timer.start();

In case you didn't set the new time, it will just use the old values. Hope this helps.
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-08-01 13:51:13
I learned to animate using skeleton in blender, now time to learn how to properly apply the weights.

Click to Play


This is really easy, more easy than I thought. Now also time to learn the formats and playing it in OpenGL. Anyone have an idea to import without knowing the maximum number of bones in shader?
13  Game Development / Newbie & Debugging Questions / Re: getters and setters vs public vars on: 2016-08-01 06:39:41
Don't 100% agree, if you think as methods being actions then you could "rename" your setters to something more meaningful like:

1  
2  
speed.accelerate(10);
speed.brake(5)


That just gives issues, and increases method count, thereby increasing the code size. And on android, there is a limit of 64k methods, it's just not worth it.
14  Java Game APIs & Engines / Engines, Libraries and Tools / Re: I created game engine on: 2016-07-31 15:42:56
Hi, as I said that I will reply here on my forum, here are some of my observations.

The first thing is usability, your engine is tightly fixed with IDEA, but what if someone wants to contribute code and wants to use Eclipse or Netbeans? I'd recommend looking into Gradle or Maven build systems so people can import your engine into their favorite IDE.

Your engine is not also usable easily by the users. You should provide instructions to the users on how to setup for each platform. Again build systems help a lot here, and you might consider distributing through maven repositories.

I tried to look into the source code, and realised that what you call as OpenAL is not really it, I read the OpenALImpl.java on android and what does it have to do with Music class? I have a library which ports OpenAL Soft to Android here by name AndroidOpenAL. This provides complete OpenAL with the extensions and the Java interface through JNI and it might help you.

These are the main issues that I had when watching your source code. By the way, how are you compiling to iOS?
15  Discussions / General Discussions / Re: Supporting both Desktop and Android displays on: 2016-07-31 08:49:44
If the game is tetris, make the window size look like portrait on the desktop too. On android, just leave it as portrait. It won't be good to make extra background in desktop nor leave it black.
16  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-07-30 18:06:11
Finished packing for JCrete 2016. Super-excited, been a Java developer for 16 years and this is my first Java (un)conference. Actually, first work-related conference of any kind.

If there's interest, I'll try to do a session on LWJGL (and maybe Kotlin). Will post again if a live stream is available.

I hope for a session on LWJGL. Congratulations spasi, hope you enjoy the trip.
17  Discussions / General Discussions / Re: Supporting both Desktop and Android displays on: 2016-07-30 15:10:26
Why not make the android game use landscape orientation?
18  Games Center / Showcase / Re: Red Defense - Tower Defense Game on: 2016-07-28 19:12:57
To use the img tag, this is how you'd do.

1  
[img width=640 height=480]http://i.imgur.com/M5M85IR.png[/img]

The width and height attributes are optional.
19  Game Development / Newbie & Debugging Questions / Re: [LibGDX] JSON, What does it know how to use? on: 2016-07-28 07:20:22
Slightly off topic, but what you had there is not valid JSON. The keys in JSON should be strings.
20  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.
21  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?
22  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.
23  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.
24  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?
25  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.
26  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.
27  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.
28  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.
29  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?
30  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.
Pages: [1] 2 3 ... 58
 
roseslayer (531 views)
2016-08-06 11:43:29

roseslayer (486 views)
2016-08-06 09:43:11

xTheGamerCodes (560 views)
2016-08-04 15:40:59

xTheGamerCodes (555 views)
2016-08-04 15:40:24

orrenravid (900 views)
2016-07-16 03:57:23

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

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

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

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

GrandCastle (644 views)
2016-07-01 09:09:45
Rendering resources
by Roquen
2016-08-08 05:55:21

Rendering resources
by Roquen
2016-08-08 05:52:42

Rendering resources
by Roquen
2016-08-08 05:50:38

Rendering resources
by Roquen
2016-08-08 05:49:53

Rendering resources
by Roquen
2016-08-08 05:32:39

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