Search the Community

Showing results for tags 'Java'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • News

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • Audio Jobs
  • Business Jobs
  • Game Design Jobs
  • Programming Jobs
  • Visual Arts Jobs

Categories

  • GameDev Unboxed

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Critique and Feedback
  • Topical
    • Virtual and Augmented Reality
    • News
  • Community
    • GameDev Challenges
    • For Beginners
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams

Blogs

There are no results to display.

There are no results to display.

Marker Groups

  • Members

Developers


Group


About Me


Website


Industry Role


Twitter


Github


Twitch


Steam

Found 36 results

  1. Marching cubes

    I have had difficulties recently with the Marching Cubes algorithm, mainly because the principal source of information on the subject was kinda vague and incomplete to me. I need a lot of precision to understand something complicated Anyhow, after a lot of struggles, I have been able to code in Java a less hardcoded program than the given source because who doesn't like the cuteness of Java compared to the mean looking C++? Oh and by hardcoding, I mean something like this : cubeindex = 0; if (grid.val[0] < isolevel) cubeindex |= 1; if (grid.val[1] < isolevel) cubeindex |= 2; if (grid.val[2] < isolevel) cubeindex |= 4; if (grid.val[3] < isolevel) cubeindex |= 8; if (grid.val[4] < isolevel) cubeindex |= 16; if (grid.val[5] < isolevel) cubeindex |= 32; if (grid.val[6] < isolevel) cubeindex |= 64; if (grid.val[7] < isolevel) cubeindex |= 128; By no mean I am saying that my code is better or more performant. It's actually ugly. However, I absolutely loathe hardcoding. Here's the result with a scalar field generated using the coherent noise library joise :
  2. Recently I've been tackling with more organic low poly terrains. The default way of creating indices for a 3D geometry is the following (credits) : A way to create simple differences that makes the geometry slightly more complicated and thus more organic is to vertically swap the indices of each adjacent quad. In other words, each adjacent quad to a centered quad is its vertical mirror. Finally, by not sharing the vertices and hence by creating two triangles per quad, this is the result with a coherent noise generator (joise) : It is called flat shading.
  3. Java Java Network Library

    Hello everyone! I have a GitHub repository on which I'm developing a Open Network Library for Java Developers and I'd like to share it so more people come in and contribute. Till now the repo is being developed only by me so the library is not 100% bug free. I'd really like this repo to be famous and got people working on it! [You will find more information in the repo] Here's the link for the repo: https://github.com/giannismarinakis/java-open-nl Thanks!
  4. I'm currently remaking a game I made a few years back using Slick2D (as opposed to Swing/AWT, which was a terrible idea). I've fleshed out a lot of the background architecture, but I'm starting to run into issues with my architecture and I'm not sure how to proceed. The game I'm making is an overhead shooter. It's wave-based, with hordes of zombies coming at you. There are 10 weapons to choose from. Specifically, my latest issue is with a particular "weapon" I'm designing; the Laser Barrier. In the previous game, I had a "Laser Wire" weapon, which when two terminals were placed on the ground, created a wire made of laser on the ground that would damage enemies that passed through. Problem was that it didn't do enough damage in the short time that the enemies would be colliding with it for it to be of any use, so it was a waste of money. In the remake, I'm instead creating the "Laser Barrier", which visually looks the same, but instead of damaging enemies that touch it, it will act as an obstacle that enemies can't walk through. The enemies damage the shield while they are in contact with it until the laser barrier collapses. Projectiles however, can still pass through the barrier, allowing the player, and certain enemies, to shoot through them. The issue I'm running into, though, is the method of communicating between the Laser Wire itself and the enemy touching it. I'm currently able to detect a collision between the enemy and wire projected between the two laser terminals, but I'm not sure how I can implement the actual movement blocking part. It would take too much text to explain how it works, so here are the relevant files in my project: Player class - the checkProjectiles() method on line 344 is where the game loop checks for collisions between the player's weapon projectiles and the an enemy passed as an argument. On line 350, you can see that when there is a collision between the enemy and the LaserNode object (collision method is linked below), the laser node takes damage so that it will eventually be destroyed. I figured this is where the "movement blocking" should be, as I have access to the terminal and the enemy, and this is where a collision is confirmed. LaserNode class - this is the class representing the laser terminals on the ground that project the laser beam between them. The checkCollision() method on line 57 is used to determine if the enemy is touching either of the terminals, or if it is touching the beam itself. Enemy class - this is the base class for all game enemies. You can see what methods are available to all enemies, so perhaps this can provide some insight into what could be done to communicate with the LaserNode. I realize it's a lot to ask considering the scope of my project, but could someone give me an idea of how to communicate between the LaserNode and Enemy so that the enemy knows not to move when touching the LaserNode? The only methods I can think of seem cumbersome and it seems like I'd be adding a lot to the Enemy class just to get this one feature working. I'd love to script these weapons with LUA, but I never learned how to integrate a scripting language into my game architecture. I also have limited experience writing game engines, so I'm sure there's a lot of refinement that could be done to make my game architecture less restricting. I don't expect anyone to actually comb through my project and make suggestions, but I would super appreciate it.
  5. Java Simple Android Strategy game

    Hello everybody I am interested in learning how to develop an app/game for Android devices. I have experience with UE4 and know the basics of C++. Would a very simple version of Armory & Machine be a good starter project? It should not contain physics or AI or similar. What would be the way to make something like that? I read a lot about Java related to Android on the internet. Thanks for your help!
  6. Hi there, I have worked on multiple games in the past: text based/2D/3D. But now I want to make an mmo, specifically a text based one, known as a MUD. The thing is I don't know much about making them, I know: Loads of: C#, Python A bit of: HTML & JS Hardly any of: C++, Java What I would like to know is: How should I go about the networking? I know some sockets but don't like using others libraries. Is there any information on the topics that I haven't been able to find? And mainly, what language should I use. I am willing to learn a new one. THANK YOU IN ADVANCE I have done research.
  7. Hi everyone, I've made a small java game recently, just for education purpose. So this game is a endless scrolling 2D plaformer. all you can do is jumping, with the impulse force to it. So the basic is to keep the player standing(and jumping) and move the background/platform from right to left. And with the forced jump, increase the force everytime the player press the button(e.g spacebar) and jump with the increased force when the button is released. Then, I use Collision/Physics detection, with the platform in the air, or standing like a wall. So I want, when the player is hit against the wall, he will be dragged by it, as it move from right to left. And now I have 2 problems: - Sometime when the player is stand against a wall, and being dragged, he can't jump. Actually, just for a small distance and then stuck into a wall against him. - Some other times, when I press/hold the button, he is going through the wall, and not even jump when I released the button. - The second problem is, when he falling, if he hit the platform, he got stuck to it, unable to jump anymore. I tried checking online for this, I believe I am probably Googling the wrong things to find tutorials for this, most tutorials seem to be for platformers like Rockman, or Flappy Bird,...But nothing seemed to solve my problems. These are some of my code: Player.java package smithitsmiths; import bases.GameObject; import bases.Vector2D; import bases.inputs.InputManager; import bases.physics.BoxCollider; import bases.physics.Physics; import bases.renderers.ImageRenderer; import jdk.internal.util.xml.impl.Input; public class Player extends GameObject { private Vector2D velocity; private final float GRAVITY = 1f; private final float JUMPSPEED = 10; protected float force = 0; private BoxCollider boxCollider; final static int maxForce = 2; public static float currentForce; public GaugeBar gaugeBar; public Player() { super(); this.renderer = ImageRenderer.create("assets/images/players/player_walk1.png"); velocity = new Vector2D(); boxCollider = new BoxCollider(36, 45); this.children.add(boxCollider); gaugeBar = new GaugeBar(); GameObject.add(gaugeBar); } @Override public float run(Vector2D parentPosition) { super.run(parentPosition); //GRAVITY impact velocity && Inputs this.velocity.y += GRAVITY; if (InputManager.instance.spacePressed) { if (force <= maxForce) { gaugeBar.setValue(force); force += 0.1f; return currentForce = force; } } if (InputManager.instance.spaceReleased) { //when player is at platform(not in the air), enable jump, vice versa BoxCollider boxColliderAtBottom = this.boxCollider.shift(0, 1); if (Physics.collideWith(boxColliderAtBottom, Platform.class) != null) { velocity.y = -JUMPSPEED * force; } force = 0; gaugeBar.reset(); } //Platform physics moveVertical(); moveHorizontal(); //gaugebar update: gaugeBar.setPosition(this.position.x - 40, this.position.y - 40); return 0; } private void moveVertical() { //calculate future position(box collider) & predict collision BoxCollider nextBoxCollider = this.boxCollider.shift(0, velocity.y); Platform platform = Physics.collideWith(nextBoxCollider, Platform.class); if (platform != null) { //move player continously towards platform boolean moveContinue = true; float shiftDistance = Math.signum(velocity.y); while (moveContinue) { if (Physics.collideWith(this.boxCollider.shift(0, shiftDistance), Platform.class) != null) { moveContinue = false; } else { shiftDistance += Math.signum(velocity.y); this.position.addUp(0, Math.signum(velocity.y)); } } //update velocity () velocity.y = 0; } //velocity impact position this.position.addUp(0, velocity.y); this.screenPosition.addUp(0, velocity.y); } private void moveHorizontal() { //calculate future position(box collider) & predict collision BoxCollider nextBoxCollider = this.boxCollider.shift(velocity.x, 0); Platform platform = Physics.collideWith(nextBoxCollider, Platform.class); if (platform != null) { //move player continously towards platform boolean moveContinue = true; float shiftDistance = Math.signum(velocity.x); while (moveContinue) { if (Physics.collideWith(this.boxCollider.shift(shiftDistance, 0), Platform.class) != null) { moveContinue = false; this.position.subtractBy(platform.getSpeed(),0); } else { shiftDistance += Math.signum(velocity.x); this.position.addUp(Math.signum(velocity.x), 0); } } //end move player continously towards platform //update velocity () velocity.x = 0; } //velocity impact position this.position.addUp(velocity.x,0); this.screenPosition.addUp(velocity.x,0); } } Platform.java: package smithitsmiths; import bases.GameObject; import bases.Vector2D; import bases.physics.BoxCollider; import bases.physics.PhysicsBody; import bases.renderers.ImageRenderer; public class Platform extends GameObject implements PhysicsBody{ private BoxCollider boxCollider; private final float SPEED = 2; Vector2D velocity; public Platform() { super(); this.renderer = ImageRenderer.create("assets/images/platform/yellow_square.jpg"); boxCollider = new BoxCollider(30,30); this.children.add(boxCollider); velocity = new Vector2D(); } @Override public float run(Vector2D parentPosition) { super.run(parentPosition); velocity.x = -SPEED; position.addUp(velocity); return 0; } @Override public BoxCollider getBoxCollider() { return boxCollider; } public float getSpeed() { return SPEED; } } BoxCollider.java: package bases.physics; import bases.GameObject; public class BoxCollider extends GameObject { private float width; private float height; public BoxCollider(float x, float y, float width, float height) { super(); this.position.set(x, y); this.screenPosition.set(x, y); this.width = width; this.height = height; } public BoxCollider(float width, float height) { this(0, 0, width, height); } public BoxCollider shift(float dx, float dy){ BoxCollider shiftedBoxCollider = new BoxCollider(this.width, this.height); shiftedBoxCollider.position.set(this.position.add(dx,dy)); //new position of newBC = current position + (dx,dy) shiftedBoxCollider.screenPosition.set(this.screenPosition.add(dx,dy)); return shiftedBoxCollider; } public float left() { return this.screenPosition.x - this.width / 2; } public float right() { return this.screenPosition.x + this.width / 2; } public float top() { return this.screenPosition.y - this.height / 2; } public float bottom() { return this.screenPosition.y + this.height / 2; } public float getWidth() { return width; } public float getHeight() { return height; } public boolean intersects(BoxCollider other) { return this.bottom() >= other.top() && this.top() <= other.bottom() && this.right() >= other.left() && this.left() <= other.right(); } @Override public String toString() { return "BoxCollider{" + "width=" + width + ", height=" + height + ", screenPosition=" + screenPosition + '}'; } } So the ground is a total of many square platforms, with the BoxCollider of each. I really confuse where the bug is, and how to fix it. So I post it here hopefully you guys can tell me what to do. I really appreciate it. Thanks for reading my post.
  8. Hello everyone! Right now I am writing my own physics engine in java for LWJGL3 3D game and I would like to consult my ideas with you guys. It's not about writing the actual code, but asking if my solution is good, and/or can it be better. And I would like to make it easy to refactor to much others render engine and "game-loop engine". So lets get started! The base game architecture looks like this: The Core holds just the information about the game itself, so whenever I decided to write some new game I would just have to edit this module. The render engine holds just the information about rendering the models, however it only gets the material and mesh data from the model. The Model module holds 4 basic information about model: Models - basic Model that holds only information about ModelView, position, rotation and scale. Other types of models inherits it and add unique params (AnimatedModel adds Animation mesh data). ModelView is build of ModelPart which are build from TexturedMeshes (will be explained later). Loaders - classes to load specific model type (i.e. Assimp loader for *.obj files) and process classes - to create necessary data to render model (ie. create Mesh which holds vboID, vertices/textures/normals arrays etc). Components - every model can have some component, ie. moveable - which allows to move the object arround the world. Materials - used together with Mesh to create TexturedMesh. Material holds information about diffuse, ambient, etc colors, diffuse, normal textures. PhysicsEngine module has the core (initiation of physics world), collision detection, CollidableComponent (inherit from BaseComponent) and Shapes (i.e AABB, Sphere, Cylinder, MeshCollider). This is the part I would like to discuss with you guys (however if you have something to say about other parts - please go for it!). Core: PhysicState - initiation of physics world, update methods, holds default data (i.e. Default narrow collision shape) Collision: Broad Phase Collision Detection (BPCD) and Narrow Phase Collision Detection (NPCD) CollidableComponent - component that can be added to model to make it collidable (in future I was planning to add other components such as: WindComponent for grass model - adds reaction to wind). Only models with CollidableComponent are checked in BPCD and NPCD, the rest are ignored. CollidableComponent has also a boolean isMoveable - i.e. Rock - it is collidable, but its never, ever gonna move. so it doesn't have to be checked with other non-moveable components at BPCD and NPCD. Shapes - basic shapes and info about them (AABB - points min/max, Sphere - center, radius, etc.) More info are shown below on diagram: Right now it works like this: I create a model and add a CollidableComponent to it like this: public CollidableComponent(Model model, TypeOfShape typeOfShape, boolean isMoveable) TypeOfShape declares the basic Broad Phase Collision Shape (AABB, Sphere, Cylinder, Mesh). The Shape is created from the raw data of the model and transformed to actual data (position, rotation*, scale).If I want to I can add the Narrow Phase Collision Shape MAP - which declares the CollisionShape for each Model Part inside the ModelView. In most cases for me it's going to be MeshCollider (since the game I'm planning to create is in Low Poly Style). IDEA 1: When the CollidableComponent is created it is automatically added to BPCD map to check its collision. Of course it's just temporary, later on I would have to set limit to the map size (i.e. to 500) or split the world to smaller parts and add just the entities which are in this world's part to BPCD. So this is the part where you guys could give me some advice IDEA 2: Collision Detection update: Right now the update works like this: public void update() { narrowPhase.narrowPhaseCollisionMap.clear(); if (!broadPhaseCollisionMap.isEmpty()) { for (Model model : broadPhaseCollisionMap.keySet()) { if ((model.getComponent(CollidableComponent.class)).isMoveable()) { for (Model model2 : broadPhaseCollisionMap.keySet()) { if (!model.equals(model2)) { CollisionShape cs1 = getCollisionShape(model); CollisionShape cs2 = getCollisionShape(model2); if (checkCollision(cs1, cs2)) { narrowPhase.narrowPhaseCollisionMap.add(model); narrowPhase.narrowPhaseCollisionMap.add(model2); } } } } } } if (!narrowPhase.narrowPhaseCollisionMap.isEmpty()) { narrowPhase.update(); } } so: 1. It checks if the BPC Map is not empty, and if its not it proceed, else nothing happens. 2. It loops through all the models inside the map and check if it's isMoveable - as I said, I ignore collision detection with objects that doesn't move 3. 2nd loop throught models and check the model from 1st loop isn't the model from the 2nd loop. If they are - lets ignore it. 4. If they are 2 different models it retrieve the BPC shapes from the models and if it is the moveable model it updates its CollisionShape data (by the current the position, rotation,* scale*) 5. Check the intersection between these 2 shapes, and if it true it's added to NPC List 6. After the BPCD loops if the NPC List is not empty it runs its update The NPCD update is pretty similar to BPCD with just 2 exceptions: 1. It used the List<Models> instead of Map<Model,CollidableComponents> (from models I can retrieve the info about the CollidableComponent, so I might use the List in BPCD aswell instand of Map **) 2. It checks the collision intersection same as for BPCD but for each ModelPart of Model_1 with each ModelPart of Model_2, returns true and/or excact collision point, etc, and breaks this model-model loop check (so it doesn't check if other parts of the models collide with each other). With my calculations for 50 objects - 27 is static and 23are movable with random position (but some collides): the NP Took: 0.0ms for: 1224 collision checks and: 24 positive collisions for BPCD Took: 10. ms for: 55776 collision checks and: 576 positive collisions for NPCD Took: 11.0ms in total for BPCD and NPCD I can see a huge space to improve the Collision Detection update methods, but I can't find them, so I hope you guys can help me out Maybe not all models has to be checked in NPCD, i.e. check how far from camera they are, and after some point just ignore NP since it won't be anyhow visible? Well, that's all! Sorry for a bit long post, but I hope you at least enjoyed reading it *Actually just forgot about adding it to calculation **Just came to my head when I was writing this topic
  9. I'm currently working on remaking a game I made a few years ago, and it didn't occur to me until recently that the new code is very framerate dependent, in that the speeds of various game entities vary depending on what framerate you're getting. I'm making the new version of the game using Slick2D. I modified the calculations that "move" the projectile to take deltaTime into account, and this has got me some better results with various frame rates, but now I'm running into another issue. Specifically, the accuracy of my projectile collision detection varies depending on the frame rate. The faster the frame rate, the more accurate it is. I can understand why this is, as with a slower frame rate, the projectiles will be moving further along their path, meaning they could skip right past the enemy collision radius; so I'm trying to think of how I could modify the existing system to give me better results that would be consistent regardless of frame rate. I've thought about using raycasting to decide whether the projectile hits. I was about to start writing the code so that the raycasting would be done when the weapon fires, so it would determine then if there is a collision, and then just fire the projectile really fast so it gets there before the enemy can move away from it. I realize that this is not a good approach, because this means the enemy will take damage before the projectile actually arrives, which would result in some.... interesting visuals. So would it be feasible to have the projectile simply raycast along its own trajectory and if it's within the enemy's collision radius, then it hits? Currently, the collision detection is: But as mentioned before, the varying frame rate can cause particles to completely miss just because of lag. So my new idea is... I feel like I'm confusing myself every time I try to reason this out. Can anyone offer advice? My current code base is available at: Generic Zombie Shooter: Redux Relevant Files: I'm also open to any suggestions about the rest of my code, specifically any design patterns I could use to make things easier to modify or anything that I could do differently.
  10. I have strip the code down to barest minimum for clarity With the window up and draw rendering correctly, I set the key press to take the 'x' key, but when I press 'x' and print anywhere (and everywhere) to test, nothing prints to console. I scrutinised to see why, but I can't find what is missing. Can anyone see why its not working? Thanks public class PuzzleG extends JFrame implements GLEventListener, KeyListener { private static final long serialVersionUID = 1L; final private int width = 800; final private int height = 600; int numOfUnits; GLU glu= new GLU(); List<ObjVertices> dataArray; public PuzzleG( int units, List<ObjVertices> vertXYZ ) { super(" Puzzle game "); Globals.camera = new Point3D(0.0f, 1.4f, 0.0f); Globals.view = new Point3D(0.0f, -1.0f, -3.0f); GLProfile profile = GLProfile.get(GLProfile.GL2); GLCapabilities capabilities = new GLCapabilities(profile); GLCanvas canvas = new GLCanvas(capabilities); canvas.addGLEventListener(this); this.setName("Minimal OpenGL"); this.getContentPane().add(canvas); this.setSize(width, height); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); this.setResizable(false); dataArray = vertXYZ; numOfUnits = units; canvas.requestFocusInWindow(); } public void play() { } @Override public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt( Globals.camera.x, Globals.camera.y, Globals.camera.z, Globals.view.x, Globals.view.y, Globals.view.z, 0.0f, 1.0f, 0.0f); gl.glTranslatef(0.0f, 0.0f, -3.0f); gl.glBegin(GL.GL_LINE_LOOP); /*=========================== START =========================================================== ... draw object vertices ... ============================= end ============================================================ */ gl.glEnd(); gl.glFlush(); } @Override public void dispose(GLAutoDrawable drawable) { if( Globals.c == 'x')System.out.println(" 3333 "); } @Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glClearDepthf(1.0f); gl.glEnable(GL2.GL_DEPTH_TEST); gl.glDepthFunc(GL2.GL_LEQUAL); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST); gl.glShadeModel(GL2.GL_SMOOTH); gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); if( Globals.c == 'x')System.out.println(" 1111 "); } @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL2 gl = drawable.getGL().getGL2(); if (height == 0) height = 1; float aspect = (float)width / height; gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective( 45, aspect, 0.1f, 100.0f); if( Globals.c == 'x')System.out.println(" 2222 "); } @Override public void keyPressed(KeyEvent e) { Globals.c = e.getKeyChar(); if( Globals.c == 'x'){ System.out.println(" 5555 "); } } @Override public void keyReleased(KeyEvent arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } } Just for the sake of checking I also tried the other key options as in the code below, but still didn't see any prints to console @Override public void keyReleased(KeyEvent e) { Globals.c = e.getKeyChar(); if( Globals.c == 'x'){ System.out.println(" 8888 "); } } @Override public void keyTyped(KeyEvent e) { Globals.c = e.getKeyChar(); if( Globals.c == 'x'){ System.out.println(" 7777 "); } }
  11. Hi, I am a newbie game developer. I need to develop a simple 2D game, it is really simple. I have a Human model that should jump every n seconds. 1. User sets different several options in settings. The first option is the game time and the second option is jump count. 2. The Game engine should determine how much time is required to model one single jump, simply by dividing gameTime/jumpCount. As a result we will find the time per one jump. 3. Single jump has some kind of physics. When the human model jumps, it should bend the elbow, knees. Jump starts from the bottommost point to some top point. Up and down. But this doesn't really important and all physics should be considered by moving some point up and down. I cannot figure out how should I build my game loop and physics processing to respect user options. If a device cannot draw or process physics at desired time it should be laggy, but the whole game time should as a user has set in settings. Please suggest a strategy to implement this correctly. Thanks
  12. I was reading on this site about the Liskov substitution principle. It states: From my understanding this means that whatever methods are in my base class, they must be implemented in my subclass, and according to this page, if you override a method in the base class and it does nothing or throws an exception, you're in violation of the principle. Suppose I had an abstract class called Weapon, and the subclasses ReloadableWeapon and Sword. ReloadableWeapon contains a method that's unique to that class, called Reload(). When declaring objects, standard practice is you do it from the abstract class and then subclass, like so: Weapon rifle = new ReloadableWeapon(); Weapon sword = new Sword(); If I wanted to use the reload method for a rifle, I could cast it. Based on numerous articles and textbooks, this could lead to problems later on. Also, if I have the reload method in the base class Weapon, then Sword would ignore or throw, which is wrong. If I wanted to avoid all that, would using the Strategy Pattern be a viable option? public final Weapon{ private final String name; private final int damage; private final List<AttackStrategy> validactions; private final List<Actions> standardActions; private Weapon(String name, int damage, List<AttackStrategy> standardActions, List<Actions> attacks) { this.name = name; this.damage = damage; standardActions = new ArrayList<Actions>(standardActions); validAttacks = new ArrayList<AttackStrategy>(validActions); } public int attack(String action){} // - Call any actions that are attacks. public void standardAction(String action){} // - Call aim or reload here. public static Weapon Sword(final String name, final damage, final List<AttackStrategy> standardActions, final List<Actions> attacks){ return new Weapon(name, damage, standardActions, attacks); } Attack Interface and Implementation: public interface AttackStrategy{ void attack(Enemy enemy); } public class Shoot implements AttackStrategy { public void attack(Enemy enemy){ //code to shoot } } public class Strike implements AttackStrategy { public void attack(Enemy enemy){ //code to strike } } 'm not asking if I've implemented the Strategy Pattern correctly, but rather can I use the pattern when faced with a subclass that has a method unique to that subclass and I don't want to cast it? or in other words, rather than violate the LSP, can I prohibit the use of inheritance and use the Strategy Pattern to implement the require methods? Notes: The pattern solves my problem in 2 ways: I don't have to downcast, I can store my Weapons in a List<Weapon> collection without worrying about checking the type, and then casting Any weapon that isn't Reloadable, won't have the concrete class Reload. This mean no throwing or leaving the method blank
  13. I want to make professional java 3d game with server program and database,packet handling for multiplayer and client-server communicating,maps rendering,models,and stuffs Which aspect of java can I learn and where can I learn java Lwjgl OpenGL rendering Like minecraft and world of tanks
  14. i created a YouTube series walking through and teaching the basics of my java game framework: https://www.youtube.com/playlist?list=PLm5Xd0Q4vJdXNEd3iO6ADihDsC59ser6j i code all of my games with the same framework structure and logic(most of them aren't even in java). once you learn it once you can use my js phaser framework and those i will port in the future (in other programming languages/engines). i figured no one will use or learn it from written tutorial only (lazy people). so i made video tuts. if you have any quastions or feedback i will gladly help and change the tutorials until they are easy to understand and use. also if anything isnt clear im willing to personally help even via teamviewer (as long as i have free time to do so which i do for now). edit: thers also phaser js port of my framework: https://github.com/yoel123/yoel-phaser-js-framework java framework repo: https://github.com/yoel123/yoel-java-slick2d-framework
  15. 2D Camera Jitters

    Hey, I'm running through some game tutorials and have just implemented my camera. It scrolls, following the player sprite, and culls tiles from the map outside of bounds. One thing I'm noticing is some minor artifact tearing between some of the tiles that make up the on-screen map. Originally, I assumed it was because I coded my camera X and Y as Integers, and my player coordinates as floats, so there was some classic data loss from downcasting float -> int. I modified that, and removed integer casts that related to passing player coordinates to the camera. This has reduced the tearing, but everything still jitters a small amount. The player only moves at a speed of 1.0f. If I run it at 3.0f, it is more noticable. Where could I be going wrong? Thanks, Stitchs (code below). package dev.mygame.display; public class Camera { private float x; private float y; private int w; private int h; private int focusX; private int focusY; public Camera(float x, float y, int w, int h) { this.x = x; this.y = y; this.w = w; this.h = h; } public float getX() { return x; } public void setX(float x) { this.x = x; } public float getY() { return y; } public void setY(float y) { this.y = y; } public int getFocusX() { return focusX; } public void setFocus(float focusX, float focusY) { float lerp = 1.0f; x += lerp * (focusX - w/2 - x); y += lerp * (focusY - h/2 - y); } public int getFocusY() { return focusY; } public int getWidth() { return w; } public int getHeight() { return h; } public void tick() { // centre the camera on the focus point //focusX -= w/2; //focusY -= h/2; // set the origin so we can offset everything else x = focusX; y = focusY; } } package dev.mygame.entities.creatures; import java.awt.Graphics; import dev.mygame.gfx.Assets; import dev.mygame.Game; public class Player extends Creature { private Game game; public Player(Game game, float x, float y) { super(game, x, y, Creature.DEFAULT_WIDTH, Creature.DEFAULT_HEIGHT); this.game = game; } @Override public void tick() { getInput(); move(); } private void getInput() { xMove = 0; yMove = 0; if(game.getKeyManager().up) { yMove = -speed; } if(game.getKeyManager().down) { yMove = +speed; } if(game.getKeyManager().left) { xMove = -speed; } if(game.getKeyManager().right) { xMove = +speed; } } @Override public void render(Graphics g) { g.drawImage(Assets.playerOne, (int)(x - game.getCamera().getX()), (int)(y - game.getCamera().getY()), width, height, null); } } package dev.mygame.states; import java.awt.Graphics; import dev.mygame.entities.creatures.Player; import dev.mygame.gfx.Assets; import dev.mygame.Game; import dev.mygame.worlds.World; import dev.mygame.display.Camera; public class GameState extends State { private Player player; private World world; public GameState(Game game) { super(game); world = new World(game, "/maps/World1.json"); player = new Player(game, world.getSpawnX(), world.getSpawnY()); } @Override public void tick() { player.tick(); game.getCamera().setFocus(player.getX() + player.getWidth()/2, player.getY() + player.getHeight()/2); } @Override public void render(Graphics g) { world.render(g); player.render(g); } }
  16. I'm working on a voxel engine using Libgdx and I've been reading that using vertex buffering will increase my performance dramatically. I understand it to be packaging up all of the renderables into one object and sending that to the GPU as opposed to making thousands of draw calls individually. This sound really convenient, but I can't seem to wrap my head around it. I've looked at the wiki but still don't really know how this would be implemented. Edit: From further reading, what I think I want to do is convert a list of modelInstances into a mesh? Is that correct? If so, how do I go about doing that?
  17. Text Based RPG

    Hello everyone! First if you are taking the time to read this "Thank You!" I'm new to programming (Java and C), and I would like to learn/practice more by making a Text-Based RPG. I have an idea in mind and I kinda started to code it in Java but I'm not sure how to put my bits of code together and would like some help. I'm not asking to make the game for me, but to guide me in the right direction... maybe some books, tutorials or even some one on one if you don't mind. The game I have in mind is going to contain: A player, world, leveling system, melee combat system(with some skills), monsters, inventory system, intractable objects(like a tree that you can cut down), item storage system, NPC's that interact maybe a store or something, and a saving and loading system. After that maybe I would like to add some more Non-Combat skills, a mage and range combat system along with some more skills, and make the world a bit larger with some interesting stuff in it... Anyways that's a lot so thank you for taking your time to read this, let me know if I can explain anything better or if I didn't explain something enough!
  18. As my project is beginning to take shape, most of the problems I've encountered, I've been able to solve, but this latest one cunningly beats me, not because of any complexities but because I don't know whats going on under the hood of the parser. I am using a pattern matcher() Pattern.compile("\\d+"); - (in JAVA) - to extract and read floats, but there were problems as white spaces are being interpreted as 0.0 808.00.0472.00.036.00.0202.00.018.00.024.00.0 782.00.096.00.036.00.0202.00.018.00.024.00.0 909.00.01028.00.036.00.0202.00.018.00.024.00.0 931.00.01149.00.036.00.0202.00.018.00.024.00.0 but should, correctly, be something like this 808.0 472.0 36.0 202.0 18.0 24.0 782.0 96.0 36.0 202.0 18.0 24.0 909.0 1028.0 36.0 202.0 18.0 24.0 931.0 1149.0 36.0 202.0 18.0 24.0 It was wrong because it was making white space to be 0.0 As said It was wrong because it was making white space to be 0.0 My quick fix was to use an if statement that exclude 0.0. Well I got away with it until the inevitable began to happen,- some of the real data started turning out to be 0.0, so my if statement was excluding the real data from being read. Any help on how to get this fixed? I need white space to be read as white space not as 0.0 public void readDataFromSelectedTextFile( File fPathplusName ){ List<Float> numbers = new LinkedList<Float>(); try { bufferedReader = new BufferedReader(new FileReader(fPathplusName)); while ((stringObjectData = bufferedReader.readLine()) != null){ Pattern p = Pattern.compile("\\d+"); Matcher m = p.matcher(stringObjectData); while (m.find()) { numbers.add(Float.parseFloat(m.group())); } } ListIterator<Float> floatIterator = numbers.listIterator(); int i=0, t=7, n=0; float s, size=0; while( floatIterator.hasNext() ){ if( (s = floatIterator.next()) > 0 ){ ... ... plenty of good coding here ... ... } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }/**/ }
  19. Tile Picker

    First of all sorry, for my terrible writing im not good with it, but there is no need to hold back with your answers i only have problems when it comes to writing. I started to write my own 2D Game Engine in Java for practice(and for fun) reasons. Until now i've made very good progress but i got a problem, which i got stuck on. I started to build a basic tile picker (left click: setTile | right click: getTile). So far so fine, but here is the problem. The further away my mouse gets from the upper left corner of the screen, the more inaccurate the tilepicker gets. In the picture, you can see the overall tile i clicked on (black cross) and the accurat point (orange dot). This would get me the blue tile underneath. This is the code i used to translate the mouse coordinates to tile coordinates. if(input.mouseleft.isClicked()) { tx = (int) (Math.floor(world.getCamera().getX() + input.getMouseX()) / world.getTileSize()); ty = (int) (Math.floor(world.getCamera().getY() + input.getMouseY()) / world.getTileSize()); // Checks if the coordinates are within the tilemap if(tx >= 0 && tx <= world.getWidth() && ty >= 0 && ty <= world.getHeight() ) world.setTile(holdtileid, tx, ty); } I hope somone can help me and thanks in advance.
  20. Hi, I want to present my game called "What's that?". I developed it using Android Studio. Download from here: https://play.google.com/store/apps/details?id=com.threemgames.whatsthat&hl=en Youtube video gameplay: It contains Google Play leadboards so you can compare your score with your friends. It is an easy game in which u have to use your head and guess the names of 50 objects - things, animals or activities. Use your imagination and on the basis of a few strokes deduce what may be in the drawing. Open your mind because it will allow you to put together lines, dots and bows into one. When you are sure of what the drawing represents, enter the name using the letters at the bottom. If you have doubts or can not guess, use the tips. So to the work, wake up your mind, duck your mind in the missing elements and solve the mystery. Let the imagination be with you! * 50 different puzzles * An amazing quiz that stimulates the imagination * Different degrees of puzzle difficulty in the quiz It is FREE! I am waiting for your comments . Please, give me feedback. If you notice any bugs please tell me . Thanks !
  21. https://www.youtube.com/playlist?list=PLx2OWCj5oxNPuqz2o3Tk8exOQtAAtIeRd
  22. Im trying to create a simple " give order to Sprite, make Sprite do thing" game much like rimworld or oxygen not included. So far I have two controllers type objects, on for the player and one for each Sprite. When a Sprite is selected, the player controller takes a reference of the Sprite and sets a Boolean variable hasMoveOrder to true when the player clicks on a spot. My code right now is filled with if/else statements in order to get this to work. Once I add more work orders like digging, building, etc, a thousand if statements starts to get sloppy. The question is what kind of data structure or algorithms can I use to make this more efficient? Would an enumeration of the Sprite states be fine and just switch through them when the Sprite gets a new work order? Or would something more complex like a state machine make sense?
  23. About game Mini casino game in which you can games like: Clicker (Beginning game in which you can earn your first diamonds and experience points) Roulette (Spin roulette and win!) Towers (Try to reach the top and with every level double your winnings) Crash (riskiest game, fast way to the top) Dices (Roll the dice and double your bet, set winning chance or use automatic betting) Blackjack[21] (Play the most popular casino game, try to win against dealer) Try to complete all quests, buy all upgrades and don't forget to spin lucky wheel everyday! Information Trailer video: CLICK HERE! Android (Google Play): CLICK HERE! Website: CLICK HERE! Game screenshots You can find us at [TWITTER] [FACEBOOK] [INSTAGRAM]
  24. Hello! I am currently a student at Aberystwyth University between my 2nd and 3rd years of my BSc in Computer Science. I am currently on an internship year where I am working at Google in London. I've always had an interest in game development and it's something I would very much like to go into once I graduate. I am most proficient in Java and Python, but am also currently learning C++ and Go. I can also do JavaScript and SQL and have experience in using SVN and Git for version control. In terms of game dev experience I have little other than a group project worth 75% of a module for my second year at university where I achieved the highest classification. For the engines I am familiar with I am learning Unity with a view as to learn Unreal at some point in the near future when I feel I have become very competent with Unity. Other than my programming skills I am also able to perform QA and basic business operations for products. I would also consider myself approachable and easy to talk with. I am looking for any kinds of projects currently just to get some experience in game development and am willing to answer any questions that you might have relating to myself or my skills. Thanks in advance, Liam
  25. Hello! My name is SirWhiteBear and I am currently searching for a game project where I could help/assist as a programmer. About me I'm currently a student who spends some of his free time coding, around 10h/week or more. I have experience working in a team (48h game jam =P) and accomplished some small solo projects. Coding experience By starting learning Java, I experimented with some simple games and went on to develop a game for Android phones with libGDX. After that, a long timespan began where I was coding with C++ and Summer 2016, I finished a simple 3D engine with C++/OpenGL. Currently, I am extending/improving it, but looking at how time consuming it gets, I'd like to focus on other projects. My experience in Unity comes from a 48h game jam, where I worked with a small team which consisted of 2 artists and 2 coder (including me). In addition working with the OpenGL-Pipeline helped me to understand some of the 3D mechanics of a game engine (Unity). My Projects ColorSplash (Android app, unreleased) 3D Simulation of a school (C++/OpenGL) NLights Engine (My own engine with C++/OpenGL/Lua) La Bohnilia (BeansJam) So, if you need of a coder (preferably in Unity :P) just PM me or reply to this topic! SirWhiteBear