Show Posts
|
|
Pages: [1]
|
|
2
|
Games Center / Archived Projects / Re: Pathfinder
|
on: 2009-12-04 01:12:13
|
I really, really appreciate you sharing that.
np, it's a just a demo  Your Javascript page showed the path found in 74 MS on a comparable map with 30 rows x 50 cols.
interesting, it obviously depends on browser and computer itself. on my old laptop, (ubuntu + firefox) it's around 10-15 MS. 12 MS not bad, but i still think it can be better this is a java application running same demo. run it a few times to give JVM a chance to warm up. it runs 0-3 MS on my machine. the jar also contains the source code except AStar itself, which is JKilavuz's generic AStar implementationr a f t
|
|
|
|
|
3
|
Games Center / Archived Projects / Re: Pathfinder
|
on: 2009-12-02 09:57:12
|
3 milliseconds is good but it could be better. on such a tiny grid, the result should be almost instantaneous. have a look at this pathfinder. it's in JavaScript but does almast equally well in small portions of grid. in chrome it runs even faster. chrome's JS engine perform really good btw..
|
|
|
|
|
5
|
Game Development / Shared Code / Re: PureSwing
|
on: 2009-11-30 05:53:08
|
I've tried porting Karga to PureSwing (with default Desktop). Most went quite smootly below are some issues i've faced (some important some not) * ImageIcon(url) waits indefinetely if given url is an animated gif * JDesktopPane does not correctly stack (render and dispatch mouse events) components * JLabel doesn't support multilines (separated with \n) * JFrame.pack() does not take window decorations (title bar, borders) into account * JFrame.setDefaultCloseOperation(CloseOperation.EXIT_ON_CLOSE) does not work * switching to another window and coming back results in losing keyboard focus. we even can not regain it by clicking * pressing Tab does not iterate over focusable components and some opinions: * re-adding JOptionPane.showInternalXXDialog makes sense to show the dialogs embedded in same window * re-adding basic HTML support can make sense (JEditorPane, JTextPane, html in JLabel) they are very handy to create multi color/line/format texts. and below is a test case: import java.awt.Color; import java.awt.Dimension; import java.awt.Rectangle;
import cz.advel.pureswing.CloseOperation; import cz.advel.pureswing.EventQueue; import cz.advel.pureswing.JDesktopPane; import cz.advel.pureswing.JFrame; import cz.advel.pureswing.JPanel; import cz.advel.pureswing.JTextField; import cz.advel.pureswing.event.MouseAdapter; import cz.advel.pureswing.event.MouseEvent;
public class MultiLayer { public static final Integer BACKGROUND_LAYER = new Integer(10); public static final Integer HELPERS_LAYER = new Integer(30); public static void main(String[] args) { JDesktopPane desktop = new JDesktopPane(); desktop.setPreferredSize(new Dimension(800, 600)); JPanel backgroundPanel = new JPanel(); backgroundPanel.setBackground(Color.LIGHT_GRAY); desktop.add(backgroundPanel, BACKGROUND_LAYER); // this should be centered in frame but is not backgroundPanel.setBounds(new Rectangle(50, 50, 700, 500)); backgroundPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { System.out.println("mouse clicked on background"); } }); // this text field should be rendered on top of background but is not JTextField textField = new JTextField(); desktop.add(textField, HELPERS_LAYER); textField.setBounds(0, 50, 200, 20); textField.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { System.out.println("mouse clicked on textField"); } }); JFrame frame = new JFrame("PureSwing - test"); frame.setDefaultCloseOperation(CloseOperation.EXIT_ON_CLOSE); frame.add(desktop); frame.pack(); frame.setVisible(true); EventQueue.runLoop(); } }
hope this helps, r a f t
|
|
|
|
|
8
|
Game Development / Shared Code / Re: PureSwing
|
on: 2009-11-27 05:53:19
|
this is a great and very promising project, the one i'm looking for quite a while  i have a 3d virtual world application with a complicated Swing GUI rendered with jPCT's software renderer. i had been looking for ways to port it to OpenGL. now it seems i've found the solution  however i'm having difficulty running Modern3D demo. below is the exception. any ideas why this happens ? this is a ubuntu 8.04 on a toshiba sattelite laptop with an onboard intel chipset. i got the same exception at Win XP on a similar toshiba laptop. SlickDemo runs ok although layout is a bit garbaged (texts does not fit into components) i've also posted the problem to LWJGL forum1 2 3 4 5 6
| Exception in thread "main" java.lang.IllegalStateException: Function is not supported at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:64) at org.lwjgl.opengl.EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.java:170) at cz.advel.modern3d.opengl.LWJGLContext.flush(LWJGLContext.java:175) at cz.advel.modern3d.opengl.LWJGLContext.<init>(LWJGLContext.java:93) at cz.advel.pureswing.test.Modern3DDemo.main(Modern3DDemo.java:82) |
|
|
|
|
|
9
|
Game Development / Artificial Intelligence / Re: Multiple pathfinders and memory usage
|
on: 2008-03-21 18:35:45
|
cant you try the solution I told about there ? http://www.java-gaming.org/forums/index.php?topic=17924.0I mean using a temporal dimension ? as if you were using a 3D array rather than a 2d Array with third dimendion representing turn/time, one unit can only be in one 2d pos for a given 3d/temporal index this way you do not have to make parrallel path search. but just a 3 dimension path finder once an unit find a path, this path is stamped as occupied than you find for unit two, than unit three, etc... you are talking about cooperative pathfinding. but as described in that paper, if you only add a 3rd dimension as time to your search space and use same heuristic as before, you will run into performance issues (possibly not noticable for small maps) you need some other heuristic like that true distance heuristic feeded by reverse A* search. in that case I argue that it's simple to implement
|
|
|
|
|
10
|
Game Development / Artificial Intelligence / Re: Multiple pathfinders and memory usage
|
on: 2008-03-21 17:09:51
|
it has been months since you posted this, but here is my 2 cents.. - However, it is only possible to execute one pathfinding operation at a time on the same set of nodes. This is because I use the nodes, define values in them, like if the node is "visited", the "parent" node, and the costs (estimated and totalfromstart). i do the same in my A* implementation too. that's a good thing for performance IMHO. How can I have more than 1 pathfinding thread searching in the same set of data (nodes) at the same time without duplicating all the nodes for each pathfinder?
my short answer is dont  why do you need spreading pathfinding amoung multiple threads ? more threads wont give you any more cpu time. they're mostly useful to parallelize blocking operations like i/o. it's true you can benefit from dual-core cpu's by spawning a thread for pathfinding but even in that case one pathfinding thread will be enough. just queue the pathfind requests in that thread but, if you really really want to spawn a thread for each pathfind request, you need to decouple A* information from your nodes: that is, move f, g, h and parent fields from node to another class (say NodeAData) and some how lookup for them. if each of your nodes has a unique id, you may put them into a HashMap or so (and face the lookup performance issues  ). or assigning an id to each pathfind request, and allow your nodes to hold more than one NodeAData maybe another option. this will reduce the lookup time, but you will need to clean them later hope this helps, r a f t
|
|
|
|
|
11
|
Game Development / Artificial Intelligence / Re: jKılavuz - a guide in the polygon soup
|
on: 2007-10-02 00:31:31
|
I'm really impressed with the API you got there, and it seems you target it at the professionals on your website with those licenses. thank you Riven, i'm glad you liked it  and yes i aim for professionals although jKilavuz has a limited freeware option Get rid of that - not only the text, just fix it. If you're pointing out the downsides to potential customers that might just be about to spend that $1000, you're really are making it hard for yourself. you may have point here. indeed there is nothing to fix. most possibly such a version break will never occur, i have serial version id's set , in case of a data structure change a conversion is almost always possible etc. what i was trying to say was like a disclaimer. there is a minimal chance that this may happen, but if it happens dont blame me then.. just like the statement in almost all licenses: we dont accept any responsibility if you get harmed by this product
|
|
|
|
|
13
|
Game Development / Artificial Intelligence / Re: Pathfinding in buildings
|
on: 2007-10-01 20:12:58
|
You dont need better pathfinding, you need a better search space. exactly agree. indeed that's what jKilavuz aims for. it's designed with the purpose of collecting pathfind data from arbitrary geometry. from it's tutorial: There are numerous good algorithms for determining a path given a connectivity graph. The actual problem is creating a connectivity graph which correctly represents the enviroment. For simple 2D games the connectivity graph was a side affect of the tiling system used to create the map. For 3D games, especially those constructed from arbitrary geometry, no such simple solution exists. jKılavuz is meant to solve this problem.regards, r a f t
|
|
|
|
|
14
|
Game Development / Artificial Intelligence / jKılavuz - a guide in the polygon soup
|
on: 2007-06-13 16:47:05
|
Hello, I'm proud to announce the first public release of jKılavuz: the first and only available path engine for Java. jKılavuz consists of an extensible set of tools for collecting pathfind data and finding and executing paths. Despite the complexness of subject it is designed for ease of use. jKılavuz is written in Java 5 and is pure Java. jKılavuz can work on almost arbitrary geometry. To collect pathfind data, it flood fills over surface starting from a set of points on ground. This way a kind of 2d grid in 3d space is created which can take us up or down slopes, across bridges and over and under overpasses. The process also takes care of jumping over obstacles and gaps. The default implementation uses jPCT's collision detection system but a custom implementation may be plugged. Later this massive information is collapsed into sectors and portals which are then converted into a very compact form to use in runtime. All the process is automized although users can intervene. Custom portals can be defined for elevators, teleporters etc. Pathfinding is performed among sectors and hence can be considered as a hierarchical approach. This makes it quite fast and efficient even for very large maps. jKılavuz provides the necessary methods to actually execute the found path. It provides a clean and uniform interface to iterate over paths over time. The iterator is suitable for both fixed and delta time approach. Paths can be merged and customized in certain ways. Users can still create their own executable paths by using Lego like path segments. More can be found on http://www.jkilavuz.comHere is a web start demo where jKilavuz is applied to a Quake level. Move the camera around and click anywhere on the map. If the clicked point is reachable, markers will be placed on the corners of the path and the avatar will follow them. Press F to follow avatar and return back to free camera mode again. Although very unlikely if avatar stucks press R to reset to starting position. Use arrow keys, A, Z, S, X to move the camera around, Control to strafe, V to visualize path finding sectors. Here is a shot from demo. Top view with sectors visualized  And this is how our grid looks like. Notice how the found path goes upstairs passing over itself. You can see the cells (the small circles), transitions between cells and sectors and portals here r a f t
|
|
|
|
|
16
|
Discussions / Community & Volunteer Projects / Re: aptal karga / 3d chat
|
on: 2005-08-10 09:05:43
|
hello, i'm re-organizing terrain structure, including: * an xml based terrain configuration as usual * allowing max instance and reference clones (via max script) to decrease memory usage * a simple LoD (level of detail) implementation * switching between nodes is more like games now, simply walk to door * changed to way balloons pop up i used a transition area for LoD to minimize pop effect. i.e. only after the transition area is passed the object is replaced with a different mesh following diagram demonstrates the transition area in LoD system (1, 2 are different LoD levels and the arrows indicates movement direction) 1 2
| ---- LoD (1) --->| (1) |---- (2) --> <--- LoD (1) ----| (2) |<--- (2) --- |
below image shows an extreme sample demonstrating LoD running. that is a huge map (1km x 1km in human scale) consists of 10x10 tiles each has 1000 polygons. that maps loads in a couple of minutes on my box and doesnt fit into a 256mb jvm. but runs fast enough  the new look of avatar panel. those transparent panels are addictive on me with no doubt  r a f t
|
|
|
|
|
17
|
Java Game APIs & Engines / Java 2D / Re: BufferStrategy and Swing Components
|
on: 2005-08-01 21:34:10
|
BTW.: Is it possible to have completly transparent components (swing/lightweight) without the anoying lightgrey background?
you must put something behind that transparent component or what will it show ? or if you mean, you want to see your desktop through that transparent components, you can manually (i dont know how or if possible ?) grap the desktop image that lies behind your frame and put it behind your components r a f t
|
|
|
|
|
18
|
Java Game APIs & Engines / Java 2D / Re: BufferStrategy and Swing Components
|
on: 2005-08-01 21:27:15
|
II'm working on a basic JFrame extension that uses active rendering via BufferStrategy. I have overridden the RepaintManager with a null version and setIgnoreRepaint(true) for all Swing components. Rather than painting directly on the JFrame, I want to paint onto a JPanel that I am placing inside the frame, so that I can take advantage of the LayoutManagers. I've got the basic framework up and running, but the performance seems awful. I've placed a JPanel inside the frame, and a JLabel inside the panel that I am displaying the fps on. When the window is maximized (1280x1024), the fastest framerate I get is around 140. This seems ridiculous for such a simple setup, since I can play Quake3 at over 200fps on this machine (yes, I know Q3 uses OpenGL, but still..).
The two factors that seem to change performance the most are... 1. The number of buffers in the BufferStrategy. Basicly, the more buffers I use, the slower the framerate. double buffering gives 140fps, while single buffering gives 170fps. Triple buffering runs at 105fps.
2. Use of getLayeredPane().paintComponents(g) vs paintComponents(g). Using the layeredPane's paintComponent method is about 30fps faster than using the JFrame paintComponent method, but it causes the layout to be shifted up and to the left, which defeats the entire purpose of the layout managers.
Any suggestions would be greatly appreciated.
seems as BufferStrategy is aimed to be used with awt (native-heavy weight) components. for instance there seems to be no way to get a BufferStrategy for a JPanel. you can get one for a JFrame but besides it is a swing component, it has a native peer too i'm doing something similar to yours with layout managers but i dont use a BufferStrategy. i simply depend on swing's paint routines in 'regular way' using a BufferStategy and then blitting other components on top of it seems as a good idea. but be prepared for 'weird symptoms' especially when your gui gets complicated since you are hacking swing in some way and seems as swing doesnt like it ;-) for your shifted layout, make sure you make that paintComponent call in awt-thread. this maybe makes no sense at first glance but i've seen many strange things that are fixed by simply making the call in awt-thread you may also want to have a look at the topic http://192.18.37.44/forums/index.php?topic=10242.0good luck r a f t
|
|
|
|
|
19
|
Java Game APIs & Engines / Java 2D / Re: active rendering and swing
|
on: 2005-07-26 03:00:31
|
If you're using 1.4 or later, the BufferStratergy class lets you have manual control over a Canvas or Window's display surface, including when it gets swapped to screen. Easiest way to do active rendering.
i use java5. i cant use Canvas since i use other swing components over my graphics component. if you mix awt and swing components in a JLayeredPane, awt components simply hide swing ones independent of their layers (heavy vs light-weigt) similarly i cant use BufferStrategy since there seems no way (or i couldnt find yet) to get a BufferStrategy for a swing component, except top level containers. i dont want to draw to JFrame's surface but to a JPanel's as i need layering described above r a f t
|
|
|
|
|
20
|
Java Game APIs & Engines / Java 2D / Re: active rendering and swing
|
on: 2005-07-26 02:51:37
|
In order to do active rendering u must get Graphics of desired component with getGraphics() method. I used to do this only with frames, but panels can do fine i think. Then u use normal drawing procs and it will apear on the screan instantly(actively rendered). Note that u should do double buffering.
sorry for late answer. some how forum engine didnt notify me  if you do rendering over what getGraphics() return, then you loose swing layout features. compile and run the following sample. the JLabel over the custom graphics component always remains there, without flicker. then run it the other way with getGraphics, JLabel will dissapper or flicker note this is a basic sample so calling paintImmediately either in AWT-Thread or not does not matter that much. in a more complicated gui, swing simply gets out of sync. that part shows up here etc 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
| import java.awt.*; import javax.swing.*;
public class Active extends JPanel { public void run() { while (true) { paintImmediately(getBounds()); try { Thread.sleep(10); } catch (Exception e) {} } } protected void paintComponent(Graphics g) { render(g); } int textPosition = 0; void render(Graphics g) { Dimension size = getSize(); g.setColor(Color.ORANGE); g.fillRect(0, 0, size.width, size.height); textPosition += 3; textPosition = (textPosition > size.width) ? 0 : textPosition; g.setColor(Color.RED); g.drawString("moving string", textPosition, textPosition); } public static void main(String[] args) throws Exception { JFrame frame = new JFrame("active rendering test"); JLayeredPane layeredPanel = new JLayeredPane();
Active active = new Active(); layeredPanel.add(active, JLayeredPane.DEFAULT_LAYER); active.setBounds(0, 0, 400, 400); JLabel label = new JLabel("a long long label"); layeredPanel.add(label, JLayeredPane.DRAG_LAYER); label.setBounds(0, 0, 200, 40); layeredPanel.setPreferredSize(new Dimension(400, 400)); frame.add(layeredPanel); frame.pack(); frame.setVisible(true); active.run(); } } |
r a f thave a look at my application at www.aptalkarga.com you will see a deep hierarchy of semi-transparent components (even a JLayeredPane in a JLayeredPane) where all depend on swing layout managers edit: updated the link
|
|
|
|
|
21
|
Java Game APIs & Engines / Java 2D / active rendering and swing
|
on: 2005-07-23 19:39:35
|
hi, what is the correct way of active rendering in swing ? such an animation loop doesnt cause the component (a custom JPanel) to be repainted immediately ? 1 2 3 4 5
| while(running) { component.repaint(); } |
repaint(0) wont help either since loop will continue running and repaint(0) requests will coalesce if component.repaint() is replaced with 1
| component.paintImmediately(component.getBounds()); |
this also fails since animation loop doesnt run in AWT-Thread's context. If we run these in AWT-Thread then we block the AWT-Thread and cause AWT and Swing events not to be dispatched. i looked for a method to dispatch all waiting AWT events and return but couldnt find. well, infact running this loop in another thread will succesfully and actively draw the component but that way we lack swing layout features. to be precise, i use the component at bottom of a JLayeredPane and there are other components on top of that. since we call component.paintImmediately() in another thread swing gets out of sync and those other components disappear or flicker the only solution i can think of is to use: 1 2 3 4 5
| SwingUtilities.invokeAndWait(new Runnable() { public void run() { component.paintImmediately(component.getBounds()); } }); |
instead of component.repaint(). but this is error-prone and one can easily fall into deadlock trap (as i did  ), and worse enough it is too expensive because of context switching so what is the solution ? thx r a f t
|
|
|
|
|
22
|
Discussions / Community & Volunteer Projects / Re: aptal karga / 3d chat
|
on: 2005-07-23 18:58:48
|
hi there, it has been a long time since my last post and i did a lot in that time. now there is texture based dressing, mesh based accesories, 2d talking balloons, sky box, registration and more in karga. and i'm still looking for sponsors and 3d artists.. r a f t
|
|
|
|
|
24
|
Discussions / Community & Volunteer Projects / aptal karga / 3d chat
|
on: 2005-04-25 17:56:41
|
hi there, i am developing a 3d chat system where users will move around, see each other, change their appearance and hopefully dance, kiss etc each other at later phases one may find an early prototype at www.aptalkarga.com i am developing it on my own and seeking sponsors and/or modellers/animators. if interested, you may always contact me at my site thx r a f t
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|