Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (734)
Games in Android Showcase (222)
games submitted by our members
Games in WIP (811)
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 ... 62
1  Game Development / Newbie & Debugging Questions / Re: Text rendering problems on: 2017-08-16 16:45:24
What does that mean? Did it work or not?
2  Game Development / Newbie & Debugging Questions / Re: Text rendering problems on: 2017-08-15 17:39:17
No, disabling the depth testing forces the renderer to replace the pixels, and the blend function tells it to blend with existing pixels instead of overwriting completely. In case your font texture has a black background, then yes, and in that case you have two options:

Modify the font shader to discard on a black pixel.

1  
2  
if (texel.rgb == vec3(0, 0, 0))
    discard;

Or you can set the texel's alpha to zero so it won't be overwritten.

1  
2  
if (texel.rgb == vec3(0, 0, 0))
    texel.a = 0;

That should do what you are aiming for. An even simpler solution is to edit your font textures and save them as PNG images with transparent background. In that case, you can simply multiply the texel with a color vec4 to change the text color too.
3  Game Development / Newbie & Debugging Questions / Re: Text rendering problems on: 2017-08-15 17:28:56
Disable depth testing before rendering text, that works for me. Also set your blend function to the following.

1  
2  
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

That should solve this issue. Also make sure to render text after all the drawing in the scene is done. Don't forget to enable the depth testing back once the text rendering is done.
4  Discussions / General Discussions / Re: Setting resolution for your game? on: 2017-08-14 08:01:52
I had to use this line too when I was using Java2D in 2012 on Mac.

1  
getRootPane().setWindowDecorationStyle(JRootPane.NONE);


Otherwise, I got the menubar still visible in the past. By the way, I too prefer OpenGL, that makes graphics really easy and gives good performance too.
5  Game Development / Shared Code / Re: Mp3 Player with Jlayer on: 2017-08-08 17:43:10
I gave a read on the licensing of MP3, and I got some quotes from the following links:

http://www.thehindu.com/sci-tech/technology/no-mp3-is-not-dead/article18474158.ece
http://www.audioblog.iis.fraunhofer.com/mp3-software-patents-licenses/

This announcement only means that the licensing of MP3 software ends, and they aren't required to pay to the Fraunhofer institute to use MP3 in their products. One important part is this:

Quote
This licensing program has now ended. Manufacturers which have already been mp3 licensees can still use the licensed software without any problems moving forward.

The licensing program has of course been ended, but still there is a small catch. From this quote:

Quote
Should other vendors be interested in using Fraunhofer’s mp3 software, they can now get in touch with Fraunhofer directly with their query.

They aren't saying that the MP3 software is now license free, you still have to get in touch with the company directly with your queries. It's only that from now on, they won't collect any fee, but there might be restrictions on the use of the software.

Quote
However, the end of the mp3 licensing program does not automatically mean that all mp3 technology is available license-free now. Apart from the core mp3 patents included in the licensing program, there might still be some implementation–specific patents (or patents for other functional enhancements) that have not expired.

MP3 has got some patents, and as I'm aware, they're in the European union and in the US. The patents in Europe were already expired in 2012, while since the US had patents for much longer time, they expired in the US in 2017. This means only that the software is patent free, and patents are much different from licenses and copyrights.

But having all this very sensitive stuff, and also that there are even better formats available, I think switching to either AAC or OGG Vorbis (there is also a term Theora I didn't know about) is a much better option.
6  Game Development / Shared Code / Re: Mp3 Player with Jlayer on: 2017-08-08 14:46:51
I heard there are licensing issues with using MP3s in Java applications, and hence I always use OGG. I don't know what they are though, could someone explain me about them?
7  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-08-07 14:50:32
I thought I need a better way to keep track of what resources are in memory, and decided that Scene should be able to define dependencies on resources. To make this easier, I thought I might define a DSL. So here is it:

1  
2  
3  
4  
5  
6  
public static class LevelResourceTable extends ResourceTable<Resource>
{{
    texture(Resource.PLAYER, FilePath.getResourceFile("player.png"));
    texture(Resource.ENEMY, FilePath.getResourceFile("enemy.png"));
    texture(Resource.SKY, FilePath.getResourceFile("sky.png"));
}}

Where Resource is a simple enum.  I can then simply let the scene declare the dependencies. I'd be having different tables like these, and scenes will be declaring them as:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public class Scene1 extends Scene
{
    @Override
    public List<ResourceTable> getDependencies()
    {
        return Arrays.asList(
            new LevelResourceTable(),
            new GlobalResourceTable()
        );
    }
}

I'm still thinking of an even easy method of having returning the dependent resource tables from a scene. Seems Java can have the beauty of these DSLs right?
8  Game Development / Newbie & Debugging Questions / Re: javafx canvas like swing on: 2017-08-04 08:39:34
you cannot add awt.Canvas to java FX stage, it have to be javaFX.Canvas

Maybe you can use a SwingNode to embed it, although I prefer not to do so and migrate to JavaFX instead of sticking with swing and AWT.

http://docs.oracle.com/javafx/8/embed_swing/jfxpub-embed_swing.htm
9  Discussions / Miscellaneous Topics / Re: Cheerpj: convert any Java application and library to a browser-based Web app on: 2017-07-26 18:35:00
I'm already using their chrome extension to run applets (I know they're dead, but college forces them). They run excellent.

https://chrome.google.com/webstore/detail/cheerpj-applet-runner-bet/bbmolahhldcbngedljfadjlognfaaein?hl=en
10  Discussions / General Discussions / Re: JGO Twitter List on: 2017-07-26 12:30:56
I don't use Twitter much but you can find me @shchilak
11  Game Development / Shared Code / Re: Tagged Human JSON (THJSON) Parser on: 2017-07-11 14:55:15
Wait, a repost by mistake I guess? Seems removed soon before I post..

By the way, if you wanted to learn GIT, use the command line. I find myself lost in a different galaxy far far away when using IDE tools.
12  Game Development / Shared Code / Re: jbump - 2D AABB collision library on: 2017-07-04 19:06:27
Is this compatible with GWT? I'm asking because I skimmed over the repo and found mention of thread in the Readme file. This is a great work, thanks!
13  Discussions / Miscellaneous Topics / Re: Gotta make a new Shading Language for College Project - Opinions? on: 2017-06-30 06:08:23
D3D and OpenGL aren't quite exactly the same, so you'll bodge over the top of the differences creating something that's probably not optimal for one or both backends.

I never meant that I'm going to abstract HLSL too, it is only for GLSL. I mentioned D3D when mentioning that CG had issues when it has custom runtime functions and causing memory leaks. I'm only interested in getting GLSL and GLSL ES outputs.
14  Discussions / Miscellaneous Topics / Re: Gotta make a new Shading Language for College Project - Opinions? on: 2017-06-29 18:27:56
What I get is
+ a more complicated development process
+ another leaky abstraction

I understand introducing a new phase in the development process is a bit of effort, but in the end it is worth of it. Even complex engines have asset pipelines, and shaders are assets too.

I don't understand why call it a leaky abstraction. It doesn't leak any memory like CG (known to leak memory when binding a texture with the shader in D3D), SESL is a transpiler that works on files and produces GLSL files. You use normal OpenGL functions, there won't be any runtime specific to SESL.
15  Discussions / Miscellaneous Topics / Re: Gotta make a new Shading Language for College Project - Opinions? on: 2017-06-29 18:21:57
But why have the frag/vert after the shader keyword? Looks more natural to write "vert shader" and "frag shader".

That was because I thought about the parser, which I plan to make in recursive descent manner. Having shader keyword in the start helps in keeping the code clean. Like we only care about the type only when we know that it is a shader.
16  Discussions / Miscellaneous Topics / Gotta make a new Shading Language for College Project - Opinions? on: 2017-06-28 17:38:02
I'm planning to write a transpiler for a new shading language as a final year college project. This transpiler will read the SESL (what I call until I come up with a good name) code and produce valid GLSL or GLSL ES code. You can find the current thoughts here:

https://gist.github.com/sriharshachilakapati/00c172b2f77607826a22db29e472589a

A glimpse of the code is as follows:

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  
// Import shader functions from libraries
import sesl.phong.*;
import sesl.lights.*;

// Declare the VertexShader called as MyShader. This will be
// compiled to the output file MyShader.vert.glsl
shader vert MyShader
{
    uniform mat4 mv;
    uniform mat4 mvp;

    in vec3 position;

    // Pass variables are similar to inputs, but they are automatically
    // passed to the next shader stage.
    pass vec3 normal;
    pass Material material;
    pass PointLight pointLight;

    // Additional outputs can be added here
    out vec3 vertex;

    // The main shader function. Note that we avoid having a gl_ variables.
    // The return value of the main function will be automatically assigned
    // to gl_Position in GLSL target.
    vec4 main()
    {
        vert = vec3(mv * vec4(position, 1.0));
        return mvp * vec4(position, 1.0);
    }
}

// Declare the FragmentShader called as MyShader. This will be
// compiled to the output file MyShader.frag.glsl
shader frag MyShader
{
    // out variables of vertex shader as well as the pass variables
    // are in variables in the fragment shader here.
    in vec3 vertex;
    in vec3 normal;

    in Material material;
    in PointLight pointLight;

    // The main shader function. Older GLSL has gl_FragColor and in modern
    // GLSL, we have to declare an output of vec4 and assign to that. In
    // SESL, the shader simply returns the fragment color, which will be
    // handled automatically.
    vec4 main()
    {
        // Call the phong function from the sesl.phong package.
        return phong(pointLight, material, vertex, normal);
    }
}

You can extend shaders to create new ones!

1  
2  
3  
4  
5  
6  
7  
8  
import sesl.Math;
import sesl.Color;

shader frag MyNewShader extends MyShader {
    vec4 main() {
        return Math.mix(Color.BLUE, super.main(), 0.5);
    }
}

This is an interesting project to be done for a final year project. I'd like to know your opinions guys.
17  Game Development / Shared Code / Re: "Better" LinkedList implementation on: 2017-06-20 14:57:04
Instead of exposing the internal element class, won't it be better to keep a static pool of element objects in the linked list class? That's better for the API and easily fixes the corruption problems. I'd like to see how that performs over the standard list.
18  Discussions / Miscellaneous Topics / Re: Silly Programming Mistakes on: 2017-06-05 10:19:28
I know the need of using try catch to catch the errors, but not the next parameter. As far as I'm aware, the next parameter is only present in the middlewares in express.

1  
2  
function (req, res, next)
    // call next to begin calling the middleware described next


But in case of route handlers, there is no next parameter as far as I know. Am I wrong somewhere?
19  Discussions / Miscellaneous Topics / Re: Silly Programming Mistakes on: 2017-06-05 06:08:10
In case you don't know, Node supports the async await pattern, so you could easily eliminate callback hell by using it with promises. Combined with Mongoose, I'd write

1  
2  
3  
4  
5  
app.post('/login', async (req, res) =>
{
    let user = await users.findOne({ "uid": req.body.uid }).exec();
    // Do something with the user
});


The mistake possible here, is it you forget the await keyword, you'd get a Promise instead of the value which you'd expect. Took me an hour to find this.
20  Discussions / General Discussions / Re: Programmer jokes on: 2017-05-21 06:24:57

Just stop drinking and you'll find it beautiful again. Programming is just a way of expressing your thoughts and getting the computer do what you want.
21  Discussions / Miscellaneous Topics / Re: What I drew today on: 2017-05-13 19:07:28
@ndnwarrior15

I'm not an artist, but here I come!

22  Game Development / Newbie & Debugging Questions / Re: [Solved] Returning specific type of Object that extends Object? on: 2017-05-01 23:33:14
You can even return mid loop.

1  
2  
3  
4  
5  
6  
7  
8  
9  
@SuppressWarnings("unchecked")
public <T extends Component> T getComponent(Class<T> klass)
{
    for (Component c : components)
        if (klass.isInstance(c))
            return (T) c; // Is Class#cast better here?

    return null;
}
23  Discussions / Miscellaneous Topics / Re: Silly Programming Mistakes on: 2017-04-24 09:24:02
Am making a tower defense game, and I decided to make the turrets fire to the nearest point in the path of enemies. Then I also wanted to do optimized code, that is, the nearest point will only be computed on the creation of the turret and not with every projectile created.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
if (nearestPathPoint == null)
{
    nearestPathPoint = path.get(0);

    for (Vector2 pt : path)
        if (pt.distanceSquared(this.position) < nearestPathPoint.distanceSquared(this.position))
            nearestPathPoint = pt;
}

// Now fire projectile towards nearestPathPoint after timer

But when creating the turrets, all turrets are firing towards same point. Then after an hour I realized, that I accidentally declared nearestPathPoint as static when it shouldn't be. Precious amount of time in LudumDare JAM.
24  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-04-20 16:32:38
I just downloaded SASM, an IDE for ASM programming. I'm gonna learn NASM after my exams, can't wait Grin

Wow cool! Am excited too. Am however using Atom instead of an IDE. Will check it out now.
25  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-04-18 15:42:21
Yes @ShadedVertex, it absolutely makes one program efficiently. I'm now very much interested in the low level details more than in higher OOP abstractions that I used to be fond of. Whenever I see a program, I'm now wondering how many instructions that this generate, etc.,

And by the way, I don't want to offend, but I don't believe one works so busy when in school, not only in school but anywhere. If you really want to do something, you can always try to make time for it. I did this in the two day preparation time that I got before my end semester examination, and the subject was Web Technologies, I had to study HTML, CSS, JS, PHP, Ruby, Perl, CGI and MySQL all for one exam. But I did great on the test. Just wanted to say, don't think otherwise.

Congratulations on your inter-school game dev competition, hope you do it well, and hope we will be able to play your game soon.
26  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-04-16 07:46:42
Took a peek into Assembly with NASM and wrote a factorial program.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
; The equivalent C code is as follows:
; ~~~
; long fact(long n)
; {
;     return (n == 0) ? 1 : n * fact(n - 1);
; }
; ~~~
fact:
    cmp dword ebx, 0    ; n == 0
    je .yes
.no:
    push ebx            ; save ebx in stack
    sub  ebx, dword 1   ; sub 1 from ebx. (n - 1)
    call fact           ; call fact recursively
    pop  ebx            ; get back the ebx from stack
    imul eax, ebx       ; eax *= ebx; eax == fact(n - 1)
    ret
.yes:
    mov eax, dword 1    ; store 1 in eax to return it
    ret


Complete program can be found at https://gist.github.com/sriharshachilakapati/70049a778e12d8edd9c7acf6c2d44c33
27  Game Development / Game Play & Game Design / Re: Graphics Backend Abstraction on: 2017-04-14 20:08:34
@princec It certainly is possible to do a low level abstraction, and here is an example of it: https://github.com/livingcreative/xgs
28  Game Development / Newbie & Debugging Questions / Re: Incorrect boolean value returned by keyboard input functions? on: 2017-04-07 14:03:56
If it is present in all the library or apps that you are using, then have you considered other scenarios that it might be possible?

  • Do you have sticky keys or some other driver related bloatware app that does this?
  • Have you considered checking whether the keyboard is the culprit? Connecting and testing on another system or laptop?
  • What is the polling rate of GameMaker? As far as I know, GameMaker targets 30 FPS and not 60, and hence it's input polling rate might also be 30 Hz. So input gathered every 33 ms.

These, are just really guesses. Maybe a test on other system will reveal more clues.
29  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-04-01 16:45:56
It's not at all related to code, or anything digital, but a general event. I have got my ID card broken, and I had to write a letter to the HOD to grant me a new ID card. So I wrote this letter:

I, Ch. Sri Harsha, student of CSE 3rd year section A bearing the roll number <myroll> had got my ID card broken into pieces due to a series of unfortunate incidents. So I request you to kindly grant me a new one.

Then my HOD asked me, may I ask what are those series of unfortunate incidents??

I replied, "Ma'm I was playing with it, swinging it around by the tag. Unfortunately it hit the desk and due to that it broke into two".

Dunno why, but this is the funniest letter that I have ever written and wanted to share with you guys.
30  Game Development / Game Play & Game Design / Re: Graphics Backend Abstraction on: 2017-03-24 11:48:33
@CoDi^R

That would be an issue when someone reordered the enum contents.
Pages: [1] 2 3 ... 62
 
cybrmynd (30 views)
2017-08-02 12:28:51

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

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

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

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

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

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

theagentd (1133 views)
2017-03-24 15:32:08

Rule (1108 views)
2017-03-19 12:43:22

Rule (1085 views)
2017-03-19 12:42:17
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

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
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!