Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
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
1  Java Game APIs & Engines / Engines, Libraries and Tools / Re: JBullet Math Library Requirements on: 2017-03-06 03:23:00
I just wrote some wrapper functionality in my engine, which only expose a few functions that just re-direct to the jbullet ones.

That is a very reasonable approach, I think I will take a similar path, thank you!

@unlight, it would certainly be great if you could do the port. The latest JOML 1.9.3-SNAPSHOT version should now contain everything for a straightforward port.

Doing the port myself is definitely something that I would be interested in doing. I will create a post once university wraps up to gauge interest.
2  Java Game APIs & Engines / Engines, Libraries and Tools / JBullet Math Library Requirements on: 2017-03-04 07:15:57
Hi guys,

I am looking to begin integrating physics into my game engine with JBullet. I am using JOML as my math library, but the JBullet library appears to use the javax.vecmath library. Does this mean that I will need to add the vecmath library to my project in order to use Bullet, or is there a port that uses JOML instead of vecmath? I understand that the two libraries offer different features that are suited to different tasks, but coordinating between two math libraries seems a little gross.

How have you guys gone about physics integration?
3  Java Game APIs & Engines / OpenGL Development / Re: ByteBuffers and Memory on: 2017-02-24 09:25:57
Thank you for the reply Spasi, very clear explanations. I'll have a good read of the FAQ.
4  Java Game APIs & Engines / OpenGL Development / ByteBuffers and Memory on: 2017-02-24 05:27:51
Hi guys,

I just want to make sure that I am using Java Buffer objects in the correct way. Through most of my code, I have used the following method to fill a Buffer object from an array of data:

1  
2  
3  
4  
5  
6  
7  
private FloatBuffer getFloatBuffer(float[] data)
{
    FloatBuffer buffer = BufferUtils.createFloatBuffer(data.length);
    buffer.put(data);
    buffer.flip();
    return buffer;
}


However, I found a tutorial that describes how to use LWJGL's STB binding to load a texture into openGL. I have included the code below which shows the process of creating and filling a byte buffer with image data via STB.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
public void loadTexture(String filepath)
{
    ByteBuffer imageData;

    try (MemoryStack stack = MemoryStack.stackPush())
    {
        IntBuffer w = stack.mallocInt(1);
        IntBuffer h = stack.mallocInt(1);
        IntBuffer comp = stack.mallocInt(1);

        imageData = stbi_load(filepath, w, h, comp, 4);
    }

   // do openGL texure stuff
   
    MemoryUtil.memFree(imageData);
}


At the end of this function, the LWJGL memory util class is used to free the image data from memory, which is what causes confusion. Why does this Buffer's memory need to be freed manually? Should I also be doing this with the Buffer objects being created in my first code sample?

Also, why use the MemoryStack class in the try statement? What would be the consequences of creating standard IntBuffers without the aid of this utility?
5  Game Development / Game Play & Game Design / 3D Indoor Environment Design on: 2017-02-16 10:52:48
Hi guys,

I am super interested in hearing all about the technical process behind building and using 3D indoor environments for your engines/games. What software do you use? How do you approach importing the maps? How do you handle large maps? Do you use a skybox/equivalent? Do you use a specific shader for the interior? Do you have any screenshots of an indoor environment that you designed? Anything you're willing to share would be awesome!

Backstory - I have spent a lot of time trying to build my first 3D renderer, I would love to design a simple Doom-like map to put it to the test and need some inspiration/direction.
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: GLFW Key Event Bouncing on: 2017-02-11 10:19:02
I have just noticed that this problem occurs in Ubuntu, but not in OS X.
7  Java Game APIs & Engines / Engines, Libraries and Tools / GLFW Key Event Bouncing on: 2017-02-11 04:10:17
Hi guys,

I have come across an issue with GLFW's key event callback function that I can't seem to work out. I have set up the following callback function:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
glfwSetKeyCallback(Window.getWindowId(), (window, key, scancode, action, mods) ->
{
    if (action == GLFW_PRESS)
    {
        currentKeyState.put(key, true);
        System.out.print("P");
    }

    if (action == GLFW_RELEASE)
    {
        currentKeyState.put(key, false);
        System.out.print("R");
    }
});


In my main loop I am calling glfwPollEvents once per frame.

When I quickly press and release a key, I get an output of "P" followed by "R" upon release.

If I press and hold a key for more than two seconds, I get an output of "P" followed by "RPR" upon release, regardless of how long I hold the key down.

It seems to me as though the key repeat event is causing the the key press and release events to bounce?? I am moving my camera based on the key state stored in the "currentKeyState" map. When I hold a directional key, my camera will move, when I release the key, it stops for a split second, then moves a small amount due to this bouncing.

Is this behaviour expected?
8  Game Development / Newbie & Debugging Questions / Re: How to learn openGL? on: 2017-02-09 01:27:57
The more resources, the better right?

A guy called Antonio Bejarano wrote a free book about building 3D games using LWJGL available here:

https://www.gitbook.com/book/lwjglgamedev/3d-game-development-with-lwjgl/details

I found that the book has a similar structure/approach to ThinMatrix's tutorials, but he goes into more theoretical depth. I am finding the book extremely useful myself.
9  Java Game APIs & Engines / OpenGL Development / Re: OBJ File Parsing - More than one UV coordinate per vertex on: 2017-02-08 04:22:25
Hi,

if interested, I am writing an assimp port here and obj is already implemented. When you load an obj you get mTextureCoord which is a two dimensional array of float arrays, [coordinate number][vertex][coordinates]. coordinate number ranges from 0 to 8.

Why yes, I am very interested in the port, I'll look into using it.
10  Java Game APIs & Engines / OpenGL Development / OBJ File Parsing - More than one UV coordinate per vertex on: 2017-02-07 06:16:57
Hi guys,

I am looking to write an OBJ file parser. There are a couple of tutorials that describe how to do this, but all of the ones I have found apply to engines that cannot assign more than one UV coordinate to a vertex. The workaround usually involves creating double-vertices at the model's texture seams.

Is this a hacky solution? How do you guys get around this issue?
11  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-01-20 08:14:59
Quote
Added entities:
Entity-player collision (Vertical cylinder)
Entity-world collision (Ellipsoid)
Entity-ray collision (Ellipsoid)

Are you implementing your own collision/physics? If so, is there a book or resource that you're using?
12  Game Development / Newbie & Debugging Questions / Re: How to set up an LWJGL project on: 2017-01-17 09:51:10
Thank you so much for the responses guys! Everything is working well now Grin

I appreciate the extra information aldacron.
13  Game Development / Newbie & Debugging Questions / How to set up an LWJGL project on: 2017-01-17 06:54:31
Hi guys,

I am looking to begin OpenGL programming but I am having trouble compiling a project using the LWJGL 3.1.1 library Jar files. My trouble seems to be with the native library files.

I have downloaded the "minimal OpenGL" zip bundle and added the LWJGL, OpenGL and GLFW Jar files (classes, source and natives) as shown in the following picture.



I have attempted to run the basic "Getting Started" code from the LWJGL website, it compiles successfully, but if I try to run the project I get the following error message:



After some investigation I have found that I need to point the project to the location of the native files using the "Djava.library.path" argument in the "Run Configuration" screen. I have tried setting this argument to my project's "lib" folder containing the library JAR files, but this did not work. I also noticed that the LWJGL Wiki provides the following information:

"The LWJGL native shared libraries do NOT need to be extracted from their .jar files. The SharedLibraryLoader that is included with LWJGL does it automatically at runtime."

..but I do not know how to use the SharedLibraryLoader, or what it really is for that matter..

Is anyone able to show me what I am doing wrong? Maybe provide a screenshot of your library/run configuration screens of a working project?

Thanks in advanced guys!
14  Game Development / Newbie & Debugging Questions / Re: Recommended architecture to allow entities to access each other's data. on: 2016-12-26 12:44:29
Wow, thank you so much for the advice guys. I wouldn't have thought to maintain my projects in this way, there is still much to learn about effective software development!
15  Game Development / Newbie & Debugging Questions / Re: Recommended architecture to allow entities to access each other's data. on: 2016-12-26 08:06:20
This does sound like a cleaner approach, do you happen to know of any resources or examples that I could have a look through? I'm having difficulty finding the right words to Google.
16  Game Development / Newbie & Debugging Questions / Recommended architecture to allow entities to access each other's data. on: 2016-12-26 04:14:28
Hi guys,

I'm looking for some advice or resources on game programming patterns / architectures that are most appropriate to handle interactions between entities in games. To give some background, I am currently designing a game mechanic where projectiles are launched in space and affected by the orbital gravity of planets (similar to Angry Birds in Space). In this case, the projectile entities need to be aware of the positions of the planet entities in order to calculate their velocities due to gravity. They also need to be aware of other projectile entities for collision detection.

After doing some research I have come up with the following potential solution:

  • Create an entity management class to store reference to all entities.
  • Pass entity manager to entities during construction.
  • During game loop update, the projectile objects can access the planet objects via the entity manager class to calculate velocity and collision detection.

However, it seems like the point of having an entity manager is so that the entity manager can perform the collision detection so that the entity classes do not need to know of one another. However, the entity manager would then also need to calculate the velocities for each projectile, per update, and this is where i get confused.

I get that I can simply pass a planet entity list to the projectile class update function, but what about in big games where many entities require information on each other to function correctly?

I would really appreciate if anyone can share any resources that could help me build a pretty architecture for this, or how they handle these types of interactions themselves.

Getting my head around programming architectures is the reason I enjoy game programming.
17  Discussions / Miscellaneous Topics / Re: AGB Programming on: 2016-10-13 11:26:13
I think it is largely to do with the fact that you are programming quite close to the machine with a GBA. It requires a lot of direct, low-level hardware access; more akin to writing code for a micro-controller than a modern computer. This process is extremely time-consuming and a lot of game-devs probably don't care to go that low-level if the don't need to. Modern game engines that are all about simplifying the process of game dev typically offer a high-level programming language that is compiled to run on a range of different computer hardware configurations. The trade off is that the programs will not run as efficiently as (well-written) assembly code created for one specific piece of hardware.
18  Games Center / Showcase / Re: Indago -- The Search on: 2016-10-13 11:07:46
Just out of interest; what is it about your development process that makes this project Windows-only?
19  Game Development / Game Play & Game Design / Re: What's the design approach to rogue-likes? on: 2016-10-08 08:38:55
Mark Brown made an excellent video about how Spelunky's levels were made

Awesome video. In fact, awesome channel, thanks for sharing!
20  Discussions / Business and Project Management Discussions / Re: How to package game files on: 2016-07-06 00:46:19
I know that there are tools for packing java projects, along with a JVM, as a native executable for a particular operating system. Perhaps you could do as HeroesGraveDev suggested by including your assets folder within your JAR file and then seek to package the JAR as an executable. Check out this stackoverflow post and see if the solution works for you.
21  Game Development / Game Play & Game Design / Re: Moving platforms as tiles or objects? on: 2016-03-20 03:40:27
Thank you for the suggestion Chrisio, that sounds like the cleaner way to go. It can be difficult to foresee some of the future challenges that will break a system.
22  Game Development / Newbie & Debugging Questions / Re: Character sprite rotation on: 2016-03-20 03:33:04
You can rotate your buffered image using an AffineTransform object (which is an object that applies linear transformations). Lets say that you store the rotation of a sprite as a variable, then the following will rotate the image if the rotation is != 0.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public void render(Graphics2D g) {
        if (rotation != 0.0f) {
            AffineTransform at = new AffineTransform();

            // go to sprite position
            at.setToTranslation(spriteX, spriteY);

            // translate to centre of sprite
            at.translate(spriteWidth() / 2, spriteHeight() / 2);

            // rotate about the centre of sprite
            at.rotate(Math.toRadians(rotation));

            // translate back to sprite position
            at.translate(-spriteWidth() / 2, -spriteHeight() / 2);

            // draw the sprite using the affine transform object
            g.drawImage(sprite, at, null);
        }
        else {
            g.drawImage(sprite, spriteX(), spriteY(), null);
        }
    }

23  Game Development / Game Play & Game Design / Moving platforms as tiles or objects? on: 2016-03-20 03:15:49
Hi guys,

I am curious to know some of you have gone about implementing moving platforms in your games, whether you use a custom tile map system or Tiled.

I am currently looking to write a TileMap system and can imagine two possible ways of handling moving platforms:

  • I can animate the platform tiles within the tile map by manipulating the map array. This could be a nightmare to manage as each platform will have different constraints on how and where it moves, but I can handle entity collisions with the platforms in the same way as all other tiles, which would be nice.
  • I create objects external from the TileMap system, which would be nice in the way of setting their travel paths, speeds and the like, but handling collisions would be more difficult

With my previous attempt at a tile map system, I handle collisions by updating entity velocity and then processing the x and y components separately, adjusting the velocity magnitude if a blocked tile is in the path of travel. If I have moving platforms as external objects, then would it be as simple as to check both the map and a list of moving platform objects during this collision checking process?
24  Games Center / Showcase / Re: Super Java2D Engine! on: 2016-03-19 22:33:49
I think it may be in reference to the cats..
25  Discussions / General Discussions / Re: Make game development step on: 2016-03-18 10:15:32
I am much more of a logical thinker than a creative thinker which makes graphics, level and mechanics design difficult. I fantasise about building the architecture to do something, for example, making a tile map editor, but once I finish it I have no idea how to go about making a creative map and end up moving on to something else. This made taking to use a library like LibGDX (mentally) difficult because it provides all of the things that I have worked so hard to create for free, and they work better than I could ever have done. However, since forcing myself to pick up LibGDX my mind has been free to come up with creative ideas because of the freely available functionality, which is pretty exciting for me.

I was considering learning Unity as well and still might one day but I enjoy the freedom that comes with using a programming language like Java or C++ to create your own tools or modify the engine to behave differently if you need it to. I wonder if with your programming experience you might feel a bit trapped or restricted by Unity..?
26  Games Center / Showcase / Re: Super Java2D Engine! on: 2016-03-13 13:04:02
This looks like it would have been fun to make, it will be cool to see where you go with it.
27  Game Development / Newbie & Debugging Questions / Drawing a rotating ellipse in JavaFX on: 2016-03-12 12:21:20
Hi guys,

I am wondering if anyone here knows how to draw a rotated ellipse to a JavaFX canvas similar to as shown in the image linked below?

http://robotics.cs.unc.edu/BeliefSpacePlanning/carODDP.png
28  Game Development / Newbie & Debugging Questions / Looking for the simplest practical Javafx game-loop. on: 2015-11-15 23:59:25
Hi guys,

I am looking to create a really simple Javafx game loop and have come up with the following abstract class to extend for the typical iterative method-calls that you would expect from a game-loop. I was just looking for some guidance as to whether this can be improved while still remaining simple?

Ultimately, I still don't quite understand how the Javafx Canvas and GraphicsContext handles double buffering, will draw calls made in the render method automatically be rendered to the back buffer which is "magically" swapped at the end of the render method, or is this naive and I need to handle this myself?

Is the Animation Timer a good way to go, or should I be opting for the KeyFrame method?

I have tested rendering a few thousand sprites bouncing around on the screen and it appears to work well, I just want to make sure I am not building on top of a bad habit from the start.

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  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
public abstract class GameFramework extends Application {

    protected Color appBackground = Color.CORNFLOWERBLUE;
    protected String appTitle = "Title";
    protected int appWidth = 800;
    protected int appHeight = 600;

    private Canvas canvas;
    private GraphicsContext gc;

    private Keyboard keyboard;
    private Mouse mouse;

    private GameLoop gameLoop;


    @Override
    public void start(Stage stage) {

        initialise();

        canvas = new Canvas(appWidth, appHeight);
        gc = canvas.getGraphicsContext2D();

        Group root = new Group();
        root.getChildren().add(canvas);

        Scene scene = new Scene(root);
        keyboard = new Keyboard(scene);
        mouse = new Mouse(scene);

        stage.setTitle(appTitle);
        stage.setScene(scene);
        stage.setResizable(false);
        stage.show();

        gameLoop = new GameLoop();
        gameLoop.start();

    }

    private class GameLoop extends AnimationTimer {

       private long before = System.nanoTime();
       private float delta;

       @Override
       public void handle(long now) {

           delta = (float) ((now - before) / 1E9);

           handleInput(delta);
           updateObjects(delta);

           gc.setFill(appBackground);
           gc.fillRect(0, 0, appWidth, appHeight);

           render(gc);

           keyboard.poll();
           mouse.poll();

           before = now;
       }

   }

    protected abstract void initialise();

    protected abstract void handleInput(float dt);

    protected abstract void updateObjects(float dt);

    protected abstract void render(GraphicsContext gc);
}
29  Discussions / General Discussions / Re: JGO IDE Survey on: 2015-10-30 10:15:53
You're right, that was quick, and I need a shower.
30  Discussions / Miscellaneous Topics / Re: Crocotile3D alternatives? on: 2015-10-30 10:11:53
I hate to be that guy, but a one off $10 payment doesn't sound too steep for something you consider awesome software.
Pages: [1] 2
 
mercenarius (14 views)
2020-06-04 19:26:01

mercenarius (22 views)
2020-06-04 19:13:43

Riven (866 views)
2019-09-04 15:33:17

hadezbladez (5848 views)
2018-11-16 13:46:03

hadezbladez (2657 views)
2018-11-16 13:41:33

hadezbladez (6273 views)
2018-11-16 13:35:35

hadezbladez (1518 views)
2018-11-16 13:32:03

EgonOlsen (4749 views)
2018-06-10 19:43:48

EgonOlsen (5804 views)
2018-06-10 19:43:44

EgonOlsen (3298 views)
2018-06-10 19:43:20
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
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!