Daily Archives

Articles indexed Sunday October 28 2012

Page 12/13 | < Previous Page | 8 9 10 11 12 13  | Next Page >

  • Implementing an automatic navigation mesh generation for 2d top down map?

    - by J2V
    I am currently in the middle of implementing an A* pathfinding for enemies. In order to implement the actual A* logic, I need a navigation mesh for my map. I am working on a 2D top down rpg map. The world is static, meaning there is no requirement for dynamic runtime mesh generation. My world objects are pixel based, not tile based and have associated data with them such as scale, rotation, origin etc. I will obviously need some vertex data being generated from my world objects, maybe create a polygon generation from color data? I could create a colormap with objects for my whole map, but I have no idea how to begin creating nav mesh polygons. How would an actual navigation mesh generation look like with this kind of available information? Can anyone maybe point to some great resources? I have looked into some 3D nav mesh tools, but they seem kind of overly complex for my situation and also have a lot of their req data available from models. Thanks a lot in advance! I have been trying to get my head around it for some time now.

    Read the article

  • Design: How to model / where to store relational data between classes

    - by Walker
    I'm trying to figure out the best design here, and I can see multiple approaches, but none that seems "right." There are three relevant classes here: Base, TradingPost, and Resource. Each Base has a TradingPost which can offer various Resources depending on the Base's tech level. Where is the right place to store the minimum tech level a base must possess to offer any given resource? A database seems like overkill. Putting it in each subclass of Resource seems wrong--that's not an intrinsic property of the Resource. Do I have a mediating class, and if so, how does it work? It's important that I not be duplicating code; that I have one place where I set the required tech level for a given item. Essentially, where does this data belong? P.S. Feel free to change the title; I struggled to come up with one that fits.

    Read the article

  • matrix to transform unit cube to space defined by 8 arbitrary points

    - by aadster
    I asked a question relating to similar to this already, but I think this is a clearer objective of what Im trying to achieve.. or whether its possible at all! Im trying to find a transformation (matrix ideally) which would transform the 8 points of a 3d unit cube to 8 arbitrary points in space. The 8 target points have no known structure. e.g: My gut feeling is that a matrix is unable to provide this xform since the cube faces vertices can be concave.. but are there any other methods of transformation? Thanks!

    Read the article

  • How a "Collision System" should be implemented?

    - by nathan
    My game is written using a entity system approach using Artemis Framework. Right know my collision detection is called from the Movement System but i'm wondering if it's a proper way to do collision detection using such an approach. Right know i'm thinking of a new system dedicated to collision detection that would proceed all the solid entities to check if they are in collision with another one. I'm wondering if it's a correct way to handle collision detection with an entity system approach? Also, how should i implement this collision system? I though of an IntervalEntitySystem that would check every 200ms (this value is chosen regarding the Artemis documentation) if some entities are colliding. protected void processEntities(ImmutableBag<Entity> ib) { for (int i = 0; i < ib.size(); i++) { Entity e = ib.get(i); //check of collision with other entities here } }

    Read the article

  • ArrayList of Entites Random Movement

    - by opiop65
    I have an arraylist of entites that I want to move randomly. No matter what I do, they won't move. Here is my female class: import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import java.util.Random; import javax.swing.ImageIcon; public class Female extends Entity { static int femaleX = 0; static int femaleY = 0; double walkSpeed = .1f; Random rand = new Random(); int random; int dir; Player player; public Female(int posX, int posY) { super(posX, posY); } public void update() { posX += femaleX; posY += femaleY; } public void draw(Graphics2D g2d) { g2d.drawImage(getFemaleImg(), posX, posY, null); if (Player.showBounds == true) { g2d.draw(getBounds()); } } public Image getFemaleImg() { ImageIcon ic = new ImageIcon("res/female.png"); return ic.getImage(); } public Rectangle getBounds() { return new Rectangle(posX, posY, getFemaleImg().getHeight(null), getFemaleImg().getWidth(null)); } public void moveFemale() { random = rand.nextInt(3); System.out.println(random); if (random == 0) { dir = 0; posX -= (int) walkSpeed; } } } And here is how I update the female class in the main class: public void actionPerformed(ActionEvent ae) { player.update(); for(int i = 0; i < females.size(); i++){ Female tempFemale = females.get(i); tempFemale.update(); } repaint(); } If I do something like this(in the female update method): public void update() { posX += femaleX; posY += femaleY; posX -= walkSpeed; } The characters move with no problem. Why is this?

    Read the article

  • "Marching cubes" voxel terrain - triplanar texturing with depth?

    - by Dan the Man
    I am currently working on a voxel terrain that uses the marching cubes algorithm for polygonizing the scalar field of voxels. I am using a triplanar texturing shader for texturing. say I have a grass texture set to the Y axis and a dirt texture for both the X and Z axes. Now, when my player digs downwards, it still appears as grass. How would I make it to appear as dirt? I have been thinking about this for a while, and the only thing I can think of to make this effect, would be to mark vertices that have been dug with a certain vertex color. When it has that vertex color, the shader would apply that dirt texture to the vertices marked. Is there a better method?

    Read the article

< Previous Page | 8 9 10 11 12 13  | Next Page >