Show Posts
|
|
Pages: [1] 2 3 ... 5
|
|
3
|
Game Development / Newbie & Debugging Questions / Re: Finding a path to nearest walkable tile, of a nonwalkable tile
|
on: 2012-03-20 06:16:11
|
|
Here's how I would do it, in somewhat pseudo code:
A Node has an x, y, cost, and parentNode. parentNode is the Node that got you to this Node. Create a 2d array Node nodeMap[][]; equal to the width and height of the map (in tiles). Create an ArrayList<Node> openList = new ArrayList<Node>(); Create another ArrayList<Node> path = new ArrayList<Node>(); Add your starting tile to the nodeMap in the X and Y coordinate, set the x and y, cost = 0 and parentNode = null; Add it to the openList, openList.add(nodeMap[ x ][ y ]); Now your loop while(!openList.isEmpty()){ for(int n = 0; n < openList.size(); n++){ examine the possible reachable neighbors of openList.get(n) if this node already has data (check the parent value), see if your cost is better and update it. add them to the nodeMap and fill in the values Then add that entry to the openList. remove the current tile from the openList, openList.remove(n); } } When you've gotten to this point you've mapped out all reachable tiles. If the nodeMap[destinationX][destinationY].parent is null, you can't reach the tile so scan through your nodeMap and find the tile that is closest to the destination and assign it as the destination. Otherwise we'll start at the destination. Work your way back, from destination parent (in nodeMap) to parent to parent until you've reached the start node. Using 0 as the index will ensure it gets placed at the beginning of the list, path.add(0, thisNode.parent); Now you have an arraylist that is traceable from start to the destination (or close as you can get to the destination).
|
|
|
|
|
7
|
Game Development / Game Play & Game Design / Re: game balance, costs & benefits
|
on: 2012-03-18 03:59:02
|
|
I completely understand what 65k is saying. I thought about this in a Street Fighter scenario. Maybe your custom character starts out with flat speed, strength, etc... As you progress you can better fit your character to your style of game play, Increasing one aspect at the penalty of another (each level up, allows you to move x aspect points). Some prefer fast players with combo moves, others the big brutes, and then there's the lamers who prefer sitting in a corner throwing shuriken the whole time.
I think it's a good idea, as long as it doesn't become a game of rock-paper-scissors (strength beats speed, speed beats stamina, stamina beats strength).
|
|
|
|
|
13
|
Discussions / Miscellaneous Topics / Re: Single atom transistors!
|
on: 2012-03-06 20:29:26
|
That was meant as a joke, actually, I think everyone understood that. I was going to reference Microsoft in the joke, but figured not everyone has the hatred that I do towards them. Yeah, it's not like you split atoms when you break a glass.
I'm going to go break glass over and over until I split an atom. Just to prove you wrong! The look on your face when you actually do it... oh, wait...
|
|
|
|
|
23
|
Game Development / Newbie & Debugging Questions / Re: Using JScrollPane as the camera for a top-down shooter
|
on: 2012-02-29 05:37:30
|
I would do something to what ra4king is saying, but I would make a Followable interface with .getX() and .getY(). Have any class that you want to be able to follow implement the interface. You then could do something like this: 1 2 3 4 5 6 7 8 9 10 11 12
| Followable following;
following = player1;
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.translate(following.getX(), following.getY()); |
You could then have fancy stuff, like a Camera class that can be followed. It could move over to where something is going on, and then move back to Player1. etc... It's java, so it's all up to your imagination.
|
|
|
|
|
24
|
Discussions / General Discussions / Re: This ever happen to you?
|
on: 2012-02-24 05:39:46
|
Hmm, I'd add in something about not aging while in the bubble.
Yea, I've thought about that too, but then I get into the physics behind it and deem it all impossible with the electricity outside being paused in time and not being able to reach the computer to make it work.
|
|
|
|
|
25
|
Discussions / General Discussions / Re: This ever happen to you?
|
on: 2012-02-24 05:17:54
|
|
I love it when the alarm clock goes off waking me up early, walk towards the bathroom to take a shower, pause for a sec... run back to the bedroom, grab my cellphone, pull up the calendar... Today is my day off! And I'm up before the kids are. Time to get in some decent programming hours. I love that feeling. But then the wife comes down stairs shortly after and asks "Have you been on that thing all night long?"
I do the whole laying in bed, plotting the next couple of procedures and coming up with solutions to problems, I've even coded in my sleep. I remember waking up in the middle of the night thinking "that would totally work", but I never get up to type the code... If only I could type in my sleep.
When I was younger, I used to gauge what day it was based on the amount of code that I had. I remember the feeling of sadness when a 3 day weekend was over and it seemed that I had accomplished squat. Getting home from school and opening my math book to pull out a quiz that I had jotted pseudo code on the back of, to implement it. A lot of my coding is done this way now. I'll bring home, from work, drawings, diagrams, formulas, pseudo code, game maps, etc on blank paper swiped from the fax machine. When the wife and kids are in bed it's code time. Sometimes it'll be midnight and I tell myself "I can wrap this last bit up in a couple of minutes before bed" then when I get it done it's like 3:00.
I assume that I'm not alone, when deciding on a super power, I'd pick the ability to create a bubble around me with about a 6 foot radius. Everything on the inside would work as normal, everything on the outside would be paused in time. I could code forever and sleep as much as I want, and still have time to do the things that I must do.
|
|
|
|
|
26
|
Game Development / Performance Tuning / Re: Fast Collision Detection
|
on: 2012-02-22 04:58:09
|
|
If you already know how to tell if 2 images at given coordinates overlap, then scan the overlapping pixels in each image in that box, using Image.GetRGB(). If both overlapping pixels contain a solid color then the images have collided. You could speed this up by making an array of 1's and 0's for each image prior to playing and checking those for collision. I haven't done this in Java, but from my experiences in other languages, pixel perfect collision is very costly, especially if you have lots of blank pixels in your image, and many on screen images to check. There are other shortcuts that that aren't as costly, such as bounding vectors (an array of points that outline your shape). Do you necessarily need pixel perfect collision?
|
|
|
|
|
27
|
Games Center / Featured Games / Re: Pixel Towers - Android / Desktop Game
|
on: 2012-02-21 17:00:14
|
It's an onboard video card in my linux machine  I installed in on my Acer A500 tablet, it works great on it. My 5yo son likes it. A few questions though: When the people move, the appear to be "animated" so they aren't 1x3 pixel sprites are they? What does it mean when it says "slow down"? Did I manage to get a power up, or is it telling me I'm going too fast?
|
|
|
|
|
28
|
Games Center / Featured Games / Re: Pixel Towers - Android / Desktop Game
|
on: 2012-02-21 02:24:05
|
meh, new error: Not a directory: ../pixeltower-android/assets/gfx Exception in thread "LWJGL Application" java.lang.NullPointerException at com.thegreystudios.pixeltower.screen.SplashScreen.present(SplashScreen.java:86) at com.thegreystudios.pixeltower.Game.render(Game.java:38) at com.thegreystudios.pixeltower.PixelTower.render(PixelTower.java:26) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:163) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
|
|
|
|
|
29
|
Games Center / Featured Games / Re: Pixel Towers - Android / Desktop Game
|
on: 2012-02-21 02:08:35
|
Can't play in linux? java PixelTowers.1.0.4.jar Exception in thread "main" java.lang.NoClassDefFoundError: PixelTowers/1/0/4/jar Caused by: java.lang.ClassNotFoundException: PixelTowers.1.0.4.jar at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the main class: PixelTowers.1.0.4.jar. Program will exit.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|