Search Results

Search found 5 results on 1 pages for 'frinkz'.

Page 1/1 | 1 

  • 8-direction path finding algorithm

    - by frinkz
    I'm having trouble finding the right pathfinding algorithm for some AI I'm working on. I have players on a pitch, moving around freely (not stuck to a grid), but they are confined to moving in 8 directions (N NE E etc.) I was working on using A*, and a graph for this. But I realised, every node on the graph is equally far apart, and all the edges have the same weight - since the pitch is rectangular. And the number of nodes is enormous (being a large pitch, with them able to move between 1 pixel and another) I figured there must be another algorithm, optimised for this sort of thing?

    Read the article

  • Powder Physics Games

    - by frinkz
    Does anyone have any experience with this sort of thing? I'm talking about applets like this http://dan-ball.jp/en/javagame/dust/ I'm really interested in how they work, it seems more like fluid-dynamics than regular game physics. Does anyone know any open source variations, or any hints on how they might work? I think it would be really fun and challenging to work on something like this, but I'm not sure where to start researching... Thanks :)

    Read the article

  • Matching Class arrays

    - by frinkz
    I'm writing a routine to invoke methods, found by a name and an array of parameter Class values Matching the Method by getName works, but when trying to match the given Class[] for parameters, and Method.getParameterTypes(), I'm having trouble. I assumed that this would work: Class[] searchParams = new Class[] { float.class, String.class }; Class[] methodParams = m.getParameterTypes(); if(methodParams == searchParams) { m.invoke(this, paramValues); } But apparantly not - m.invoke is never reached. I've checked, and methodParams gives the same classes as searchParams. The code below works, and picks the right method, but it seems like a very dirty way of doing things, I'm sure I'm missing something obvious. Class[] searchParams = new Class[] { float.class, String.class }; Class[] methodParams = m.getParameterTypes(); boolean isMatch = true; for(int i = 0; i < searchParams.length; i++) { if(!searchParams.getClass().equals(methodParams.getClass())) { isMatch = false; } } if(isMatch) { m.invoke(this, paramValues); }

    Read the article

  • Which is the 'correct' way to do this (if statement)

    - by frinkz
    I've got plenty of these lying around, and I'm wondering if I'm going to face any trouble - or performance problems. I have method A: MyClass monkey; ... if(monkey != null) { ... } Or method B: boolean hasMonkey; //This is set to TRUE when monkey is not null MyClass monkey; ... if(hasMonkey) { ... } On a functional level, they both do the same thing. Right now, I'm using method A. Is that a bad way of doing things? Which is going to perform better?

    Read the article

1