Show Posts
|
|
Pages: [1] 2 3 ... 10
|
|
1
|
Games Center / Showcase / Storm2D
|
on: 2013-05-12 07:47:28
|
After 2 years of development I am able to release an alpha version of Storm2D.  Storm2D is a multiplayer 2D side-scroller inspired by Soldat and Liero. VideoCurrent features: -Multiplayer online using Quake III network model -Unique destructible polygon terrain -Completely Verlet physics based (Ragdolls, players, pickups, etc) -Ability to load Soldat maps -Custom profiles -Hugely customisable weapons, physics, etc -Scripted character classes, bonuses, AI, ... -Capture the flag and Deathmatch game modes Future features: -Vehicles, buildings -multiplayer map editor -campaign and missions -Many more battle game modes -Mod support Right now there are many bugs that need to be removed. This will be the focus for the next few weeks. If people could test the game and tell me whether or not it works on their operating system, that would be great. Linux 32/64 bit and Mac versions are UNTESTED. The linux 64 bit server runs fine (Is currently running on my 64 bit ubuntu VPS) but I haven't been able to test the clients as only have access to a windows PC at this time. Download the game here. NOTE: All content taken from Soldat is temporary and used with the expressed permission of Michal Marcinkowski, the creator of Soldat. If you have any issues, please email him at michal.marcinkowski<at>gmail.com.
|
|
|
|
|
2
|
Game Development / Newbie & Debugging Questions / Re: How to encrypt our code.
|
on: 2013-03-24 08:22:09
|
Try obfuscation + wrapping it in an EXE or converting it to EXE through tools like Excelsior JET.
You can't "encrypt" bytecode. There has to be something that will decrypt it to run it and that could be also broken. The reason you would want to protect bytecode is because it's easily reverse-engineered. Obfuscation allows for harder reverse-engineering and converting to native makes it even harder.
I do think it's useless though, code is cheap. Art is much more valuable and what people will want and *that* is what you should protect.
Code Isn't cheap  Imagine coding a game for 2 years, releasing it without it being obfuscated. Instantly anyone can decompile the class files into THE EXACT code you made (search jd-gui on google). They now know exactly how your code works, they can modify your game and produce their own version of it, in order to very easily hack/crack the game and distribute it over the internet. If code was cheap you wouldn't get programming jobs paying you over $60 an hour  I have been working on my game for over a year and a half. I don't even want to guess how many hours of frustration and hard work I put into it, I wouldn't want some random to have access to the code just like that. But that's just me. If you are making an open source game then its fine. Everyone who values the code they have written and don't want the general public to be able to read it should use proguard. Trying to find out what a large obfuscated program does IMO will be harder than coding it from scratch. jd-gui is also a useful tool to test if your program has been obfuscated correctly.
|
|
|
|
|
4
|
Game Development / Newbie & Debugging Questions / Re: Java reading file problem only occurs on some PC's
|
on: 2013-03-13 15:21:13
|
You might also look at Cortex Command. It seems to have some of the same things in it. But I've never played Soldat and am just basing things on the video of the game you posted. >.> I have played KAG though, and they're somewhat similar.
Yeah Cortex command is a great game too  I played that a lot for a while. I haven't played online with it though, just with some friends on a single PC.
|
|
|
|
|
6
|
Game Development / Newbie & Debugging Questions / Re: Java reading file problem only occurs on some PC's
|
on: 2013-03-13 12:03:29
|
Game looks ace btw. Soldat's one of my favourite games of all time. Cas  Thanks man! Same. I wish I could go back to the old Soldat days! I played that game almost every day for nearly 5 years. This is one of the reasons why I am making a Soldat clone. People have left the game but nothing has replaced it. There's still a heap of bugs and things I need to do and features to add, but if I can get some good artwork, etc I think this game could be a hit. Just need to keep at it!
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Re: Java reading file problem only occurs on some PC's
|
on: 2013-03-13 11:58:39
|
Try to specify the locale of the scanner to match the number format of the read files.
Omg! thanks!  That was the problem. I didn't even know about locales  you learn something new every day. 1 2 3 4 5 6 7 8 9 10 11
| Scanner scan = new Scanner("0.0"); System.out.println("Locale: US"); scan.useLocale(Locale.US); System.out.println("Has next float: " + scan.hasNextFloat()); System.out.println("Has next double: " + scan.hasNextDouble());
System.out.println("Locale: France"); scan.useLocale(Locale.FRANCE); System.out.println("Has next float: " + scan.hasNextFloat()); System.out.println("Has next double: " + scan.hasNextDouble()); |
Output: 1 2 3 4 5 6
| Locale: US Has next float: true Has next double: true Locale: France Has next float: false Has next double: false |
Now I just need to remember to never create a Scanner without setting the locale(I made a utility function, but creating Scanners is such a habit  )
|
|
|
|
|
8
|
Game Development / Newbie & Debugging Questions / Java reading file problem only occurs on some PC's
|
on: 2013-03-13 06:03:36
|
Hey, For the last year and a half or so I've been working on a Soldat clone, called Storm2D. ( http://storm2d.net) Having released an alpha version of the game, on my latest video ( http://www.youtube.com/watch?v=0Eb-4QJHHeQ) two people have posted that the game crashes at a specific point, both using Windows 7 (same as me). Annoyingly, the problem doesn't happen on my computer, nor 3+ other computers I tested the program on, so it is hard to debug. One of the users helpfully posted the crash log (exception stack trace) and it leads me to believe (although I could be wrong, as the location of the crash is not where the actual problem is) that my problem has something to do with the way I am reading files with the Java scanner. Note: I bundle the jre with my application so it isn't a problem with different versions of java. when reading through one of my (biped) files needed for the game, at the start of the line I check if the first 'token' in the line is a number. If it is a number, it means I need to read an extra two parameters at the start. I read the line a slightly different way (because the line contains different parameters). For some reason I think the first token is not being recognized as a number on their machines which means that the first two tokens aren't handled and the whole line is read wrongly. The code I use to check if the token is a number(note: any type of number, float,double, int etc) is below. Does this handle all cases? (apart from long, huge numbers won't occur) 1 2 3 4 5 6
| if (scan.hasNextFloat() || scan.hasNextInt()) { ... }
|
Alternatively I could use the below code and just use scanner.next() rather than using the other methods(hasNextFloat, etc), but I won't know if it works until one of the users that had the problem in the first place try it again. 1 2 3 4 5 6 7 8 9 10 11 12
| public static boolean isNumeric(String str) { try { double d = Double.parseDouble(str); } catch(NumberFormatException nfe) { return false; } return true; } |
Thanks, Roland
|
|
|
|
|
12
|
Java Game APIs & Engines / Java Sound & OpenAL / Slick util OpenAL get song length
|
on: 2012-12-09 05:52:38
|
Hi, I am trying to get the length of a song with OpenAL. The song streamed rather than fully loaded. I am using .ogg files. A java version of the below code just returns 0. 1 2 3 4 5 6 7 8 9 10 11 12 13
| ALfloat GetBufferLength(ALuint buffer) { ALint size, bits, channels, freq;
alGetBufferi(buffer, AL_SIZE, &size); alGetBufferi(buffer, AL_BITS, &bits); alGetBufferi(buffer, AL_CHANNELS, &channels); alGetBufferi(buffer, AL_FREQUENCY, &freq); if(alGetError() != AL_NO_ERROR) return -1.0f;
return (ALfloat)((ALuint)size/channels/(bits/8)) / (ALfloat)freq; } |
I think it's because the song is streaming? Is there any way to fix this? thanks, roland
|
|
|
|
|
14
|
Java Game APIs & Engines / Tools Discussion / Proguard include library warnings
|
on: 2012-11-11 07:37:10
|
|
Hey, I have a problem. I am trying to use proguard and I include quite a few libraries: rhino javascript, jbox2d, poly2tri, slf4j, lwjgl, etc.
When i try to obfuscate my jar, I have to add these dependencies. The problem is, they all have dependencies, which have dependencies, ..... It looks like I have to end up adding over 100 different libraries in, even though they aren't actually needed to run the unobfuscated jar file.
Is there an easier / better way to do this? thanks, roland
|
|
|
|
|
15
|
Game Development / Newbie & Debugging Questions / Re: Bundling JRE Windows/Linux/Mac
|
on: 2012-10-24 14:17:13
|
While we are waiting for someone to give us an answer  I've only ever done Windows myself but I need to switch to embedded VMs for both Mac and Linux as well. All ears here  Cas  So at the moment if you are on linux or mac you need to install java yourself before playing the game? do you have any estimate how much this decreased the likelyness of the average user wanting to try out one of your games? Also, if not bundling the JRE they need to add java as an environment variable 
|
|
|
|
|
17
|
Game Development / Newbie & Debugging Questions / Bundling JRE Windows/Linux/Mac
|
on: 2012-10-24 08:08:20
|
|
Hello, What is the best way to bundle a JRE with my application? I only have a windows computer at home so it is hard for me to test this. I have no idea even how to get the linux and mac JREs and then extract them onto my computer, so that I can put the jre folder inside my game directory.
Can someone help me out? Thanks, roland
|
|
|
|
|
18
|
Java Game APIs & Engines / OpenGL Development / Hiding mouse cursor
|
on: 2012-10-24 03:36:34
|
Hey, I have a problem. I might use 1
| Mouse.setGrabbed(true); |
which is fine, but in the case where I want to be able to use the mouse outside the window: 1 2
| Cursor emptyCursor = new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null); Mouse.setNativeCursor(emptyCursor); |
taken from http://lwjgl.org/forum/index.php?topic=594.0This doesn't actually completely hide the cursor. It creates a 1x1 BLACK pixel cursor. I have tried to create an int buffer that contains a single integer with no alpha (eg new Color(0,0,0,0).getRGB()), this doesn't work. Anyone have any ideas?
|
|
|
|
|
19
|
Game Development / Networking & Multiplayer / Re: Questions about TCP sending and packet size
|
on: 2012-09-05 08:58:57
|
I wrapped a class to read and write primitives over network, if you're intersted, it works like this: 1 2 3 4 5 6
| PomPackage p = new PomPackage(); p.insert(35); p.insert('c'); p.insert(new byte[30]); sendPackage(p); |
1 2 3 4
| int x = (Integer)p.pollQueue(); char c = (Character)p.pollQueue(); byte data[] = (byte[])p.pollQueue(); |
I might have reinvented the wheel but it works pretty nice, tell me if you're intersted. I actually made something very like this for my UDP library  Thanks for the offer though!
|
|
|
|
|
20
|
Game Development / Networking & Multiplayer / Re: Questions about TCP sending and packet size
|
on: 2012-09-05 08:52:20
|
I read up that the maximum packet size for ethernet is 1500 bytes, do I have to worry about this, or does TCP take care of it? eg. Should I write 1024 bytes at a time and flush after each?
Roland
TCP takes care of it. Just make sure you read all the bytes you're expecting before stopping reading. I recommend the approach I said in my last message: read an int (the size) then readFully(size). The first int will always be consistent, as well as the readFully (as long as your size is correct!), and with that you only need to flush once in the sender after the data is sent. Thanks  that works perfectly, woot no more corrupted packets  I can't actually use a short / char because my packets will be larger than 65536 bytes, but this is only from server to client. If the client is sending I'll use this precaution.
|
|
|
|
|
21
|
Game Development / Networking & Multiplayer / Re: Questions about TCP sending and packet size
|
on: 2012-09-05 02:39:36
|
Thanks for the replies. My old version was simply: 1 2 3 4 5 6
| private byte[] receiveData(int length) throws IOException { byte[] data = new byte[length]; is.read(data); return data; } |
1 2 3 4 5 6 7 8 9 10 11 12
| private void sendData(byte[] data) { try { os.write(data); os.flush(); } catch (IOException e) { e.printStackTrace(); } } |
It may have been useful to say that I am also using UDP on a different port. I know there are conflicts so I should try to minimize UDP sending while downloading data with TCP. (When the player joins the server, TCP is only used to download the server data, then UDP is used for everything else). Thanks for the information about flushing. I really want to make sure there is no chance of corruption, since TCP is supposed to be reliable... I read up that the maximum packet size for ethernet is 1500 bytes, do I have to worry about this, or does TCP take care of it? eg. Should I write 1024 bytes at a time and flush after each? Roland
|
|
|
|
|
22
|
Game Development / Networking & Multiplayer / Questions about TCP sending and packet size
|
on: 2012-09-04 12:58:38
|
Hello, I had a problem with TCP. My networking code works fine when I run the server and client on my pc, but when my friend tries to join the game, or I join his, the data gets corrupted and the received length is wrong when a 22kb packet is sent in one go. I changed it so I send the tcp data one byte at a time, flushing the output stream after each byte. I guess this is quite inefficient / slow? the main thing is that now it works. So, what is optimal? and right now, I am waiting in an infinite loop for the next byte, like so (because I know how many bytes are expected, that was sent earlier), this is bad right? is there a better way? (read() blocks anyway, but I had to put it in a loop because each time flush is called i get a -1 on the receiving end) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| private byte[] receiveData(int length) throws IOException { byte[] data = new byte[length]; int offset = 0; while (offset < length) { int len = 1; int result = -1; do { result = is.read(data, offset, len); } while(result == -1); offset += len; } return data; } |
Here's the server code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| private void sendData(byte[] data) { try { int offset = 0; while (offset < data.length) { int len = 1; os.write(data,offset, len); os.flush(); offset += len; } } catch (IOException e) { e.printStackTrace(); } } |
Thanks, roland
|
|
|
|
|
23
|
Game Development / Shared Code / Re: Pre-multiplied Alpha for drawing particles in one pass
|
on: 2012-08-21 11:12:57
|
Critical feature of using premult alpha: you must premultiply the alpha in all your graphics before you upload them to OpenGL! I do this at compile time but if you're lazy you can do it at runtime: 1 2
| BufferedImage bi = ImageIO.read(inputFile); bi.coerceData(true); |
Cas   thanks! so what are the image backgrounds supposed to look like? (eg. black or transparent or it doesn't matter?)
|
|
|
|
|
24
|
Game Development / Shared Code / Re: Pre-multiplied Alpha for drawing particles in one pass
|
on: 2012-08-20 10:18:29
|
Thanks Smiley that sounds interesting, any chance of a screenshot or something?  I just wanted to make something to help me get a better handle on making textures, and am only starting to realize how much is involved to make a tool like this useful! One thing I didn't realize until I just this hour, (when I made the display boxes double in size along the horizontal) is that the way I did scaling is kind of dubious. Maybe I should define my scaling in terms of a set number of pixels rather than as a proportion of the display area? But given that screen resolutions vary a lot, even that is kind of dubious as a measure. So, producing the equations as I do in the text fields below the sliders (they don't quite fit in the JTextFields visually) is maybe not so useful. Also, I suspect people don't use a translation very often. Right now it is monochromatic and alpha isn't involved. Your post and links are very helpful in working out how to handle this once I'm ready to try including color and transparency. Going back to the idea of adding vs lerp -- I think I still want to try that out. Right now, I am just taking a weighted average for the displayed values. But I was thinking I wanted to do something like this: specify a mapping from the noise function to a number range and then add the results in. For example, have one Simplex output mapped to values from -16 to 16, and ADD these in to get the final color value. It doesn't seem to me that there is a simple way to get the equivalent mathematical results using lerp. True? I haven't looked around to see if there are already tools that do these graphics manipulations with the goal of creating procedural code. Nor do I know if there is much interest in such. Most people would just use an artist to get design and create the needed tiles/textures, I assume. That's a good question. I think you should go with scaling in terms of 1.2x or something(So how it is now), but keep the image sizes the same and their dimensions correct (so they aren't stretched 2:1 sideways), and use horizontal+vertical scrollbars on each texture. Is the mapping for each individual pixel? Could you make the number (-16 -> 16) map to a RGB colour using another algorithm such as r = ((i +X * SOME_BIG_NUMBER) % SOME_SMALLER_NUMBER)/SOME_SMALLER_NUMBER g = ((i+Y * SOME_BIG_NUMBER2) % SOME_SMALLER_NUMBER2)/SOME_SMALLER_NUMBER2 b = ((i+Z * SOME_BIG_NUMBER3) % SOME_SMALLER_NUMBER3)/SOME_SMALLER_NUMBER3 where X Y Z are different numbers. I still don't really know what your doing so I may have just written something completely not what you want. If that's the case, just ignore it  Sorry I don't know much about noise functions, nor much about textures apart from the very basics and a few different types of blend modes. If you manage to make a good procedural texture maker that would be awesome! Right now I use Texture Maker Professional v3.0.3 ( http://www.texturemaker.com/screenshots.php) which has a lot of procedural options but its hard to make good ones (atleast for me it is) I'm glad my code will help you out later  This should be a more well known topic I think! It's important and I hadn't even heard about it until a few days ago 
|
|
|
|
|
25
|
Game Development / Shared Code / Re: Pre-multiplied Alpha for drawing particles in one pass
|
on: 2012-08-19 08:07:39
|
Some nice tips.
I happen to be writing a little tool for combining textures at the moment, and was just figuring out the importance of the distinction of addition vs interpolation. I implemented interpolation, but am now planning to give the addition option as well. So far, I'm able to do a simple scaling and translating in Simplex noise, and interpolate three such screens together. It's gui driven, and generates a text line for the Java Simplex 2D call that can be copied-and-pasted into a procedural routine.
Thanks  that sounds interesting, any chance of a screenshot or something?
|
|
|
|
|
26
|
Game Development / Shared Code / Pre-multiplied Alpha for drawing particles in one pass
|
on: 2012-08-19 06:31:21
|
Firstly, thanks to Orangy Tang for pointing this out to me. Tips on optimising particle drawing (Thanks to davedes) can be found here: http://www.java-gaming.org/topics/storing-adding-drawing-particles/27126/msg/242110/view.html#msg242110Here are some tutorials on pre-multiplied alpha: http://home.comcast.net/~tom_forsyth/blog.wiki.html#[[Premultiplied%20alpha]] http://blog.rarepebble.com/111/premultiplied-alpha-in-opengl/http://www.quasimondo.com/archives/000665.phpIt doesn't seem too complicated but you also need to have the right textures, otherwise it's not going to work. Firstly, in the code: Rather than having two blend modes that we use for drawing particles: Additive, for fire, etc: 1
| GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE); |
And Normal(or Lerp) for smoke: (I use this blendmode for drawing everything else, it should be re-set after drawing the particles) 1
| GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); |
Have just one: 1
| GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); |
Now, you have two different types of particles, smoke and fire. You need to keep track of these because they are drawn in slightly different ways. Firstly setting the colour: Additive(Fire): 1
| GL11.glColor4f(r*a,g*a,b*a,0); |
Normal "Lerp" (Smoke) 1
| GL11.glColor4f(r*a,g*a,b*a,a); |
The other part is the textures. Additive textures must have a black background. Normal/lerp textures have a transparent background. Here is a sample additive texture for fire:  Here is a sample lerp texture for smoke:  If you use an additive texture with a transparent background you will get something like this(BAD):  Final results:   If I have any of this wrong, please correct me! -roland
|
|
|
|
|
28
|
Java Game APIs & Engines / OpenGL Development / Re: Storing / Adding / Drawing particles
|
on: 2012-08-18 13:55:28
|
I actually only really want two blendmodes at this point: Additive, for fire, etc 1
| GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE); |
And another for smoke: 1
| GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); |
If there's a way to just use a single blend mode that will work for both I would like to know it  otherwise I will use two lists, thanks. I can't use point sprites because I want rotation as well 
|
|
|
|
|
30
|
Java Game APIs & Engines / OpenGL Development / Storing / Adding / Drawing particles
|
on: 2012-08-18 06:15:26
|
Hey, I am drawing about 5000 particles. There will probably be 10-20 different types of particles in there, each with different images. Since switching textures seems to take time, I think the best way is to draw each type 1 particle with the first texture, then each type 2 particle with the next texture, etc until I have drawn all the particles. I have come up with two different ways to do this, I am wondering which is better? or there is an even better way? 1. have a single list of particles, and loop through it N times where N is the number of different types of particles. This means if there are 100 particle types I will have to loop through all the particles 100 times when drawing. But adding particles will be fast. 2. have a Map<ParticleType, List<Particle>> but then whenever I add a new particle I have to find out which list it belongs to. Using the double-arraylist switching method talked about here http://www.java-gaming.org/index.php?topic=27016.0 by theagentd and princec means that each time I swap the lists I have to reinsert the list back into the hashmap after I swap it (I would use 2 Maps, one for the current and one for the next) Thanks, roland
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|