Show Posts
|
|
Pages: [1] 2
|
|
1
|
Game Development / Performance Tuning / Re: Limited Palettes
|
on: 2013-04-07 02:05:00
|
|
HeroesGraveDev is correct, he said "unless you use a different format". You can tell in what format an image will be stored in graphics memory, when you load it with glTexImage2D for example (google it and you'll find all the color formats listed).
OpenGL fixed pipeline does have support for palettes and color indices (never used it though, and I dunno how do it with shaders either), but it's rarely used, because nowadays it's not worth the hassle. I doubt LibGDX uses it, it probably just tells OpenGL to store all pixels in graphics memory as 16, 24 or 32bit, without using color indices, to keep things simple. You'd have to code directly with OpenGL to use its palette capabilities.
Just work in 32bit color depth, that way: - you have all the colors you want - you lose no performance, and almost nothing in terms of memory - you have alpha - you don't have to worry about anything, it'll work (tm)
Limit your palette on the artistic side, when you create your images/sprites, NOT on the technical side, which just brings more troubles than benefits.
|
|
|
|
|
2
|
Game Development / Performance Tuning / Re: Limited Palettes
|
on: 2013-04-07 01:20:52
|
|
Yeah, except from the memory savings, you won't gain much (if any) performance, as today's cards and architectures are tuned for 32-bit colors. And the memory savings will be negligible if you use pixel art. A 32x32 sprite costs nothing, even at 32-bit color depth:
32pixels x 32pixels x 1byte = 1kb for 8-bit (256 colors) VS 32pixels x 32pixels x 4bytes = 4kb for 32-bit (true colors + alpha).
So I'd say you'll always be safe with pixel art and OpenGL. Correctly using sprite sheets will have a lot more impact.
|
|
|
|
|
3
|
Game Development / Newbie & Debugging Questions / Re: Correct way to use Random.class
|
on: 2013-04-03 02:32:00
|
learn stuff properly
You're doing the worst thing for a programmer: applying patterns without knowing why, or just to feel smarter. Patterns may solve problems (sometimes), but on the other hand they make code more complex and abstract (for sure!), therefore more buggy. You should concentrate on the KISS principle at all times: Keep It Simple Stupid. If you don't need a random seed NOW, then don't bother with them. Keep your code as simple and straightforward as you can, because it'll always be too complex as some point, and always sooner than we'd like. But if you know FOR SURE you'll need seeds, then yes, you may need a singleton, though I hate them. I prefer to keep an object around (your random nb generator) instead. Singletons are simply global state hidden behind a trendy name. And global state will eat you alive without you noticing ! (<= that's why singletons are evil)
|
|
|
|
|
6
|
Games Center / Showcase / Re: Starshock, a retro-esque arcade shooter
|
on: 2013-03-03 20:59:45
|
Looks pretty neat  !! I love the look of it. If I may, the graphics are only missing emissive/shadeless textures, like neons and fluorescent lights to make it look more futuristic. Think Dark Forces' graphics, which were (and still are) amazing.
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Re: libGDX - It's so large?
|
on: 2013-02-28 01:24:29
|
Furthermore I hate taxes anyway D:
Taxes take a chunk out of your monthly gain, but without them, your government couldn't afford to invest in health care, roads, pensions, and a whole lot of other services and infrastructure that you use. Without taxes, you would have to pay a lot of money for various insurances, even more than you already do. I consider taxes the least evil alternative there is. I used to believe that, but more and more I think my wage is cut in half (France, I confirm) not for the good of the community, but to re-fill the banks so they can invest like crazy and make even bigger profits while we pay their debts.
|
|
|
|
|
9
|
Java Game APIs & Engines / JavaFX / Re: JavaFX 3d API and OpenGL
|
on: 2013-02-23 13:54:49
|
|
I'm not sure I can follow what these guys are talking about, but it seems we're going to have to write OSL/Decora/Pixel Bender code, then it'll be automagically translated into GLSL / HLSL ? Well, why not... but although it'd make it easier (higher level) we could potentially be losing a lot of control if we need precise results, since we'd be relying on the underlying OSL/Decora/Pixel Bender-compatible renderer.
|
|
|
|
|
10
|
Java Game APIs & Engines / JavaFX / Re: JavaFX 3d API and OpenGL
|
on: 2013-02-23 09:47:18
|
Please can you share your source code? I need something working with the fixed pipeline too. Maybe I could help you a little bit but I will start using JavaFX only when it works with OpenJDK.
Here it is. It's a JavaFX app, that displays a red triangle on a black background using JOGL 2 rc11 (the only needed lib). The drawing is done in a hidden GLCanvas, then using glReadPixels copied into a WritableImage. You may have to click the "redraw" button to see the result at the beginning. 2 downsides: - The GLCanvas is inside a JFrame, which must be shown then hidden, otherwise all OpenGL calls will be ignored. So you can see the JFrame flashing when the app starts, which is a bit annoying. - it's very slow, it takes on average 11ms on my fairly good laptop (i7, gtx660m) mostly the call to glReadPixels I suppose 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
| package todel;
import com.jogamp.common.nio.Buffers; import java.nio.ByteBuffer; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.ImageView; import javafx.scene.image.PixelFormat; import javafx.scene.image.WritableImage; import javafx.scene.layout.FlowPane; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javafx.stage.WindowEvent; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; import javax.swing.JFrame;
public class Todel extends Application {
static int width = 512; static int height = 480; static ByteBuffer byteBuffer;
@Override public void start(Stage primaryStage) { final WritableImage writableImage = new WritableImage(640, 480); final PixelFormat<ByteBuffer> pf = PixelFormat.getByteRgbInstance();
final JFrame win = new JFrame("Swing"); win.setSize(width, height); win.setLocationRelativeTo(null);
GLProfile glProfile = GLProfile.getDefault(); GLCapabilities glCapabilities = new GLCapabilities(glProfile); final GLCanvas glcanvas = new GLCanvas(glCapabilities); glcanvas.addGLEventListener(new GLEventListener() { @Override public void init(GLAutoDrawable glad) { GL2 gl = (GL2) glad.getContext().getGL(); gl.glClearColor(.1f, .1f, .1f, .1f); }
@Override public void dispose(GLAutoDrawable glad) { }
@Override public void display(GLAutoDrawable glad) { long startTime = System.currentTimeMillis(); GL2 gl = (GL2) glad.getContext().getGL(); gl.glColor4f(1, 0, 0, 1); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); gl.glBegin(GL2.GL_TRIANGLES); gl.glVertex2f(0, 0); gl.glVertex2f(1, 0); gl.glVertex2f(0, 1); gl.glEnd();
gl.glReadBuffer(GL2.GL_FRONT); width = glcanvas.getWidth(); height = glcanvas.getHeight(); if (byteBuffer == null) { byteBuffer = Buffers.newDirectByteBuffer(width * height * 3); }
gl.glReadPixels(0, 0, width, height, GL2.GL_RGB, GL2.GL_UNSIGNED_BYTE, byteBuffer);
Thread t = new Thread(new Runnable() { @Override public void run() { writableImage.getPixelWriter().setPixels(0, 0, width, height, pf, byteBuffer, width * 3); } }); t.start(); System.out.println("Displayed in " + (System.currentTimeMillis() - startTime) + " ms"); }
@Override public void reshape(GLAutoDrawable glad, int i, int i1, int i2, int i3) { } }); win.getContentPane().add(glcanvas); win.setVisible(true); win.setVisible(false); win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Button btn = new Button(); btn.setText("Reraw"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { glcanvas.display(); } });
ImageView imgView = new ImageView(writableImage);
Pane root = new FlowPane(); root.getChildren().add(btn); root.getChildren().add(imgView);
Scene scene = new Scene(root, 800, 600);
primaryStage.setTitle("JavaFX"); primaryStage.setScene(scene); primaryStage.show(); primaryStage.toFront(); primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent t) { win.dispose(); } });
}
public static void main(String[] args) { launch(args); } } |
I have spent a lot of time in improving the environment (the APIs) required for my own project using JOGL during 6 years. Why not sharing your findings? It would be better than nothing.
There may be a misunderstanding here. I have no finding to share, I'm enjoying JOGL so far. What I meant is: all my time must be devoted to wrapping my project, which is very late already You're right but what do you mainly use in JavaFX? Personally, I'm interested in the charting API and a bit in CSS.
I need JavaFX 1) to do almost exactly what spasi did in his "Dope" project here http://www.java-gaming.org/topics/tool-dope/27389/view.html. A node-based interface. In the meantime I'm using the Netbeans Visual library, but I find it clunky. I'll definitely have to dump it at some point 2) CSS GUI skinning. Swing + Nimbus is ok, but I'd prefer something more expressive. 3) potentially the animation framework, and integrated browser, but later The neat thing with JavaFX is that it's part of Java, so (hopefully) very well supported. I try to use as few libs as possible. Why would you provide your own JRE ?
|
|
|
|
|
12
|
Game Development / Newbie & Debugging Questions / Re: Interface Programming Newbie
|
on: 2013-02-22 10:29:06
|
|
With Netbeans, the easiest is the built-in Swing GUI editor. Can't get any faster than that making GUIs in Java.
JavaFX is less straightforward: you need SceneBuilder (external app), then back in Netbeans mess with an XML file, then mess again with a controller (java class). But you get the shiny new features of JavaFX.
|
|
|
|
|
14
|
Discussions / General Discussions / Re: JDK: upcoming features
|
on: 2013-02-22 10:22:12
|
|
About javascript being popular server-side, I suppose it's the perceived "advantage" that you can quickly code the first 1000-5000 lines of code. Beyond that, you need more experienced programmers.
With java, you hit that limit much much later, but it takes a bit more work to setup things.
Also it seems javascript on the server is "cool" because it's new/unusual.
I don't really see what javascript on the JVM is useful for. If I ever need a scripting language, I'd use groovy.
|
|
|
|
|
15
|
Java Game APIs & Engines / JavaFX / Re: JavaFX 3d API and OpenGL
|
on: 2013-02-21 22:59:52
|
|
Yep I saw spasi's technique. I succeeded with glReadPixels and WritableImage. It's slow, but fixed pipeline must work in my case. Didn't try with FBOs.
I can't be of much help, I have zero knowledge of JOGL/LWJGL's inner working, and have my hands already more than dirty with a project using JOGL. I'll wait for what could be done when Quantum, Prism and Glass go open source, if they ever do...
In the meantime as you said there are workarounds: for me the easiest will be to mix JavaFX with Swing+JOGL.
|
|
|
|
|
16
|
Java Game APIs & Engines / JavaFX / Re: JavaFX 3d API and OpenGL
|
on: 2013-02-21 13:15:00
|
Looks like Java3D all over again.
Yep. Can't people learn from History ? Not always it seems... Scenegraphs are great for simple tools & basic 3D and sucks for everything else. So it depends on the target audience. But OMG, Phong...are you kidding me? Cookie cutter materials? So 80s/90s. Get with the shader program (yuck, yuck) baby. I'm too lazy to try to dig-up and look at the source to see if there's a sane low level exposed...if not it's pretty worthless.
I hope LWJGL/JOGL can benefit somehow. spasi ? Julien ? Save us with a good news please 
|
|
|
|
|
18
|
Java Game APIs & Engines / JavaFX / Re: JavaFX 3d API and OpenGL
|
on: 2013-02-21 06:51:42
|
|
It seems they're wrapping it with high level concepts, basically they're making a scenegraph. Porting "low level" JOGL/LWJGL code to it will be more difficult, and we're losing a lot of control. And what if we don't need a scenegraph at all, or using our own already...
<rant> Is it me, or people at Sun/Oracle are so obsessed with object-ville they can't stop wrapping things into objects ? That's something I hate in the java ecosystem: this tendency to over wrap things into other things until we can't see the whole picture anymore. </rant>
|
|
|
|
|
21
|
Game Development / Game Play & Game Design / Re: Pixel art?
|
on: 2013-02-13 01:33:39
|
|
I use GIMP.
Contrarily to what is usually said, GIMP is easy to use for pixel art: 1) use the pencil tool 2) with a 1 pixel brush. Done. Plus you have all of GIMP's powerful features ready, would you need them.
Tried few others software specialized in pixel art, never liked them that much. For me the decisive feature of GIMP is complete freedom with keyboard shortcuts. They can be customized, so I can really enter into "the flow" because they totally suit me.
In the end, the tool doesn't matter much, it's how comfortable and productive you are with it. I tend to use as few tools as possible, so I become really productive with them.
|
|
|
|
|
22
|
Java Game APIs & Engines / JavaFX / Re: JOGL in JavaFX
|
on: 2013-01-14 01:03:28
|
|
Is it possible and realistic to do offscreen rendering with JOGL / LWJGL, then switch the result image to JavaFX ?
What approach would be better ? (I don't need state of the art graphics, I'm using the fixed pipeline. Rendering should be as fast as possible though) I've seen terms such as pbuffers and FBOs... ??
|
|
|
|
|
24
|
Games Center / WIP games, tools & toy projects / Re: Japanese learning game
|
on: 2012-10-03 00:52:14
|
[warning] There's nothing new online yet[/warning] Here is an old screenshot. The new version has also a graph of probabilities of appearance of each character  Coming along nicely. We can now practice all the hiraganas, katakanas and 2136 official jouyou kanjis, complete with on, kun readings, plus their main English meaning. The user can choose which ones to practice. It works really nicely for me. My kanji retaining rate increased noticeably when learning new ones. It's now in my toolbox: the perfect companion to anki. I think I'll sell this little thing for a small fee, like $15 or $20. With a free version of course, where the user will be able to practice the hiragana, katakana, and kanji grade 1. I'll post version 1.0 soon, I have to finish the last tweaks.
|
|
|
|
|
25
|
Discussions / General Discussions / Re: Plan out or Dive In?
|
on: 2012-09-27 13:56:28
|
Plan and prototype game desing but don't waste your time to plan code that well. It's allways end up totally different than original plan anyway. When you see full picture you can redesign and refactor code lot faster. Most of the game code is throw away stuff anyway so why bother with it longer than needed. Experience will make the code better not planning.
Can't agree more !
|
|
|
|
|
26
|
Discussions / General Discussions / Re: Scripting languages / DSLs?
|
on: 2012-09-20 23:51:08
|
Yes, Java blurs the line between compiled code and interpreted code. So in that case yes, "dynamic compilation" can be used if performance matters  Thanks Java ! Though, as you pointed out, I can't see a practical example, but I'm sure plenty of people need it for good reason...
|
|
|
|
|
28
|
Discussions / Miscellaneous Topics / Re: The Opus audio codec
|
on: 2012-09-20 05:16:09
|
It doesn't seem to add anything useful for us beyond what Ogg Vorbis already supplies. Cas  Agreed. I don't see why Vorbis should not be used for bitrates other than 128kbs ... ? And I bet Opus will be one more exotic format. Mp3 is still there, despite awesome alternatives (vorbis and aac) being available for years, why would Opus change that ? It seems the quality / space ratio is now irrelevant with the compression of mp3/vorbis/aac, given the storage space of even the smallest device, so Opus can't fight on this front.
|
|
|
|
|
29
|
Discussions / Miscellaneous Topics / Re: Old Video Games
|
on: 2012-09-20 04:59:12
|
|
The difficulty was also right IMO in the 1994-2000 games.
Before that you had to have the reflexes of a ninja to have the smallest chance with shoot'em ups and platformers. Or to become a bookworm with RPGs, keeping your own notes of everything in the game world.
After 2000, even gran'ma could finish your game. No more challenge. Just sit back, follow the scripted line and enjoy the show with your 3d glasses... yuck. There are specialized things for that, it's called movies.
Fortunately for me, enough awesome games were produced in 1994-2000 to fill the rest of my gamer's life. There are so many I still want to play.
Indie games tend to catch up, but are still not up to that golden age's standard. They're generally lacking in content and overall polish: all the boring stuff for us developers. I'm not blaming anyone though. Simply can't expect the same result from a team of only 1 or 2 persons with limited means.
|
|
|
|
|
30
|
Games Center / WIP games, tools & toy projects / Re: [Tool] DOPE
|
on: 2012-09-20 01:39:42
|
|
Nice! I need to use a node system like this one in a current project of mine.
Is it plain JavaFX, or did you use a library for handling the visual aspect of the node system ? Do you have experience with doing the same, but in java 6 ?
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|