Show Posts
|
|
Pages: [1]
|
|
1
|
Games Center / Showcase / IMBARINTH - LD26 Jam Entry
|
on: 2013-05-02 15:06:02
|
Hi all. I wan't to present our entry for the Ludum Dare 26 Jam Compo. IMBARINTH is a simple maze solving puzzle with shifting tiles, that make the whole thing a bit more complicated. Ludum Dare Entry Page: http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=14127Play it online: http://32k.eu/ld26/The game concept is pretty simple. You are in a maze. You have to reach the goal. Rows or columns in the level may be shifted away from new tiles. Don't fall off the board. You can use the arrow keys or ASWD to control the player dot, use R for retry (during the game or in the retry menu). In the main menu you can press C to start challenge mode and S to start seed mode. If you play the web version and the sound is out of sync, refresh your browser, as the preloading sometimes messes with the syncing. For me (and one of the other developers), it was the first time using libgdx. It was really fun and we had some good help from our dev lead, who has already some experience in building apps/games in libgdx. We all three coded a good part of the whole thing. I also did the music and some placeholder sprites (that were removed during development. I'm really not the art guy and my graphics were simple "programmer art" XD you can see them in my timelapse). I also made a second track for the game, but in the end we simply forgot to add a switch between those two tracks. So only my first song got into the game  The whole thing runs on desktop, web and we are currently improving some of the code to get it running on android too (it actually runs on android, but the background effects and particle systems currently are to heavy to let it run smoothly). If you're interested in the source code, you can find it on github: https://github.com/brookman/Ludum-Dare-26/ We're not really proud of our code base, but we had to sacrifice some best practices to get the game finished  But maybe you can learn something from it (I definitely learned a lot about LibGDX during this weekend). I hope you enjoy our game as much as we do. A video of the gameplay can be found here: http://www.youtube.com/v/tBujv4enmoQ?version=3&hl=en_US&start=My timelapse: http://www.youtube.com/v/DvvclvJWHrs?version=3&hl=en_US&start=More Screenshots:  
|
|
|
|
|
3
|
Discussions / General Discussions / Re: custom font
|
on: 2012-07-31 09:46:20
|
Usually you have the font present in one color, that is blended into another one when needed. I don't know what tool set you use, so I cannot give you direct advice on how you can do it. Generally your font renderer (or loader) takes care of the font color. Slick2d for example has two classes (AngelcodeFont and UnicodeFont) to handle font rendering. AngelcodeFont works with a pregenerated image and definition file (generated with a tool like hiero or the TWL font creator). UnicodeFont does basically the same, but it takes a *.ttf file as input and the images for the glyphs are generated directly in memory (so UnicodeFont takes a bit longer to load). Basically you instantiate a version of the font. Version in this context means that you apply settings like color, style (bold or italic), a font size etc. For each font and font style, you can keep an instance. I think you can apply an outline effect with the unicode font. On the font class, you have a method "getEffects" to retrieve the active effects (at least I think thats what it does). => http://slick.cokeandcode.com/javadoc/org/newdawn/slick/UnicodeFont.htmlThere you can add a new OutlineEffect => http://slick.cokeandcode.com/javadoc/org/newdawn/slick/font/effects/OutlineEffect.htmlIf you wan't to have a better (or more suitable) explanation, you would have to provide more infos about what you work with (java2d, lwjgl, slick, jogl etc.) Hi guy
I'm not your guy, friend! I'm not your friend, buddy!
|
|
|
|
|
5
|
Game Development / Newbie & Debugging Questions / Re: More items renamed in inventory.
|
on: 2012-07-30 16:16:06
|
|
You're welcome...
@davedes: I'm curious about your JSON remark. Could you please be a bit more specific? Is there a class or a library, that you can work with JSON object without much serialization/deserialization overhead? I really love json, but it always seemed to much to me to always serialize/deserialize the json string.
|
|
|
|
|
6
|
Game Development / Newbie & Debugging Questions / Re: More items renamed in inventory.
|
on: 2012-07-30 15:56:38
|
You would still have to copy the strings, otherwise you again just copy the reference to the same string. 1 2 3 4 5 6 7 8 9
| public void setProperties(HashMap<String, String> properties) { this.properties.clear(); for(String key : properties) { String prop = properties.get(key); this.properties.put(key, prop == null || "".equals(prop) ? "" : new String(prop)); } } |
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Re: More items renamed in inventory.
|
on: 2012-07-30 15:49:39
|
Sorry, I had to read your code multiple times to fully understand, what you do with the properties... In my opinion those two lines are the source of the problem: 1 2
| item.setProperties(sourceItem.getProperties()); item.setPropertiesValue(sourceItem.getPropertiesValue()); |
You would need to change the setProperties method to something like this: 1 2 3 4 5 6 7 8 9 10
| public void setProperties(String[] properties) { this.properties = new String[properties.length]; for(int x = 0; x < properties.length; x++) { String prop = properties[x]; this.properties[x] = prop == null || "".equals(prop) ? "" : new String(prop); } } |
|
|
|
|
|
8
|
Game Development / Newbie & Debugging Questions / Re: More items renamed in inventory.
|
on: 2012-07-30 15:42:44
|
|
I can't see the code, where you copy the properties but it looks like you do not copy the properties themselves. When you create a copy of your base item, make sure that you also make copies of the properties... If you just do something like "copy.name = source.name;", the reference will be copied (means both item classes share the same string, means that if you change the string in copy, the string in source will be changed too).
[edit] Also, maybe try using a HashMap<String, String> for your property collection instead of the two arrays. You can make your code significantly easier that way. [/edit]
|
|
|
|
|
9
|
Game Development / Newbie & Debugging Questions / Re: More items renamed in inventory.
|
on: 2012-07-30 15:17:05
|
|
I tend to do two different classes. One for the definition of an item and one for its instance. A definition exists only once in a global manager. When you create an item (for example in a drop), you create an instance, that refers to the definition. All properties, that are fixed (basic name, description, weight, base price etc.) for an item are stored in the definition object. The instance class contains properties like location (either location on the map, or the inventory of the owner), instance name (overrides the definition name), instance id, effects, charge (for magic items) or the price you payed to buy the item at a shop.
I'm not entirely sure about the effects. In my opinion they belong to the definition, but the instance should provide an option to override them. Like that you could create one "Health potion" and give it different effects (strong potion, weak potion etc). I think in the end it depends on the complexity of your game, how you implement this.
|
|
|
|
|
10
|
Game Development / Shared Code / Re: Java Quadtree Implementation
|
on: 2012-07-13 16:25:07
|
What is the Random import used for?  Looks nice from first sight but I think there are some minor issues with your approach. [Edit] Because i always switch the words in my text and I think it was written quite unclear I declared a short terminology and use it in my explanation: Tree: The tree itself which stores the root node and config. Node: A node defines an area and can have 4 sub nodes. Item: The effective item, that is stored in the tree. [/Edit] Your items are only stored in one node but as I see it rectangles sometimes can be children of multple nodes. This could result in problems. For example imagine the root node has a size of 256x256 units. This is subdivided into 4 128x128 pixel unit sized nodes. When you have an item, that has a size 128x128 (could also be any other size) and it has the location 127, 127, it will fall into the north west / topLeft node, despite the most part of the item lays in the bottom right (and some in the bottom left and top right nodes). If you want to fix this, you would need to insert items in every child node (let the node decide, if the item intersects the node), when you insert into children. One important thing that is missing is rebalancing. You do not want to recreate the tree every update cycle. There needs to be some logic to update the tree, otherwise it can only be used for static objects, that don't move at all. If you want, I can post my implementation of the quad tree, but it isn't really elegant, commented or anything like that. But take a look at this: http://www.jotschi.de/?p=530This guy has created a simple (abstract) quad tree and a point and a rect based implementation of it and shared the code on git hub. Look into the rect based implementation to see how he handles it. Unfortunately he also doesn't do rebalancing.
|
|
|
|
|
11
|
Game Development / Newbie & Debugging Questions / Re: Really strange problem
|
on: 2012-07-10 18:04:42
|
A library is not automatically "lighter" just because it comes bundled with the JDK. JAXB uses Xalan, which is a big heavy DOM implementation, so going with it just because it comes bundled with the JDK is penny-wise pound-foolish.
Yeah ,you are right. Sorry, I mixed up some things... I was thinking of the package size (the distributable game) and not of the memory usage of the library...
|
|
|
|
|
12
|
Game Development / Newbie & Debugging Questions / Re: Really strange problem
|
on: 2012-07-10 17:56:52
|
|
Sometimes there is the need to persist an object for later use (a save game would be a nice example). The process ,that takes the java object and creates a representation of it (may be xml ,pure bytes or even a custom text format) is called serialization. The opposite is, when you have a representation ,that should be loaded as object. This is called deserialization.
Basically ,what you do is deserializing by hand.
|
|
|
|
|
13
|
Game Development / Newbie & Debugging Questions / Re: Really strange problem
|
on: 2012-07-10 16:56:24
|
|
Yeah, I understand that and thats also something that concerns me. but serialization is key feature, that I use very strongly in my projects and I just don't have time to reinvent the wheel, when there is a suitable, well tested solution ready to use... i checked the jars... xstream and xppp (xstream uses the xppp library) are around 550 kb.
but you could still use JAXB, which should be part of the java default library (i don't know how this is really called... im quite new to java and still not used to the terminology)... you do not need any external libraries for jaxb...
|
|
|
|
|
14
|
Game Development / Newbie & Debugging Questions / Re: Really strange problem
|
on: 2012-07-10 16:33:54
|
I made a little example, how you could handle serialization automatically with xstream  Basically you have a bit more code (you need to set aliases for classes, register classes in xstream etc.) but it is really worth the time, as you do not have fight against those manual serialization issues. I use it in my project and all xml files consumed by my game are generated from the code... I have a model generator class, that (programmatically) creates all the game xml files. If I change something in the class it could break the model, so you have to fix that. When your model is changed, you can run the model generator and all game xml files are updated. Like this I don't have to care about the version of the xml file, as it always should be the newest version, when generation has been done. You can find xstream here ( http://xstream.codehaus.org/ ) and I can really encourage you to do the two minute tutorial... Code and xml output of my example => http://pastebin.com/JKyxRG6FShort explanation about the example: The main method is in the XSTest class... The main method first generates a model in code and then saves it to a file... In a second step, this file is loaded and deserialized by xstream and the items in the store are printed out. The console output from the test program is: 1 2 3 4 5 6
| Generated xml 'c:\temp\items.xml': [...] Weapon (1): Short sword, type: swords, attack sheet: data/sprites/swordattack.png Weapon (2): Bastard sword, type: swords, attack sheet: data/sprites/swordattack.png Weapon (3): Long sword, type: swords, attack sheet: data/sprites/swordattack.png Armor (4): Studded leather armor, type: Chest, armor value: 20 |
|
|
|
|
|
15
|
Game Development / Newbie & Debugging Questions / Re: Really strange problem
|
on: 2012-07-10 15:59:15
|
|
You're welcome...
Ahaha.. I should have spotted that one XD
Btw. ever thought of serializing and deserializing objects directly with a framework? It can save you alot of headaches... I'm using xstream, but you could be working also with another library like jaxb. When you set it up correctly you can generate human readable (and editable) xml, but do not have to care about the serialization itself.
|
|
|
|
|
16
|
Game Development / Newbie & Debugging Questions / Re: Really strange problem
|
on: 2012-07-10 15:45:50
|
|
Sorry, removed my post as I noticed its irelevance XD
Currently I can't see whats causing the problem. You have to find out, which call to getTagValue causes to fail and than analyze that case... Do you work with eclipse? Then you can set a breakpoint, when you right click on the left hand side of the code window. When you start the programm with "Debug As" (or by pressin F11), the programm is started in debug mode.
Its best you set the break point in the loadImages method (looking at the call stack, it seems that that is the root method described in your first post) and then step over every call with F6. If you find the call that causes the problem, you can debug again and then step into that method by pressing F5 instead of F6. Then you should be able to check the variables...
Or improve error handling and validation (see edit in my last post).
|
|
|
|
|
17
|
Game Development / Newbie & Debugging Questions / Re: Really strange problem
|
on: 2012-07-10 15:28:10
|
This means that the parameter you passed is not null... you could add some more checks: 1 2 3 4 5 6 7
| ... NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes(); if(nlList == null) throw new Exception("nlList is null"); Node nValue = (Node) nlList.item(0); if(nValue == null) throw new Exception("nValue is null"); return nValue.getNodeValue(); ... |
like this you can isolate the problem. You still have to find out why the object is null, but you should be able to find out which one it was. [edit] also this line could be problematic: 1
| NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes(); |
You access the item directly without checking if it is available... I don't have eclipse ready here, but i think you should change that part into something like that 1 2 3
| NodeList list = eElement.getElementsByTagName(sTag); if(list.getLength() <= 0) throw new Exception("No node found"); NodeList nlList = list.item(0).getChildNodes(); |
[/edit]
|
|
|
|
|
18
|
Game Development / Newbie & Debugging Questions / Re: Really strange problem
|
on: 2012-07-10 11:57:34
|
You could put a try catch in the getNodeValue method, that encloses the code... If it fails print out the parameters that lead to to the problem... Something like this: 1 2 3 4 5 6 7 8 9 10 11 12 13
| public String getTagValue(String sTag, Element eElement) { try{ NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes(); Node nValue = (Node) nlList.item(0); return nValue.getNodeValue(); } catch(Exception ex) { System.out.println(string.Format("getTagValue failed for sTag '%s'%s", sTag, eElement == null ? " (eElement is null)" : "")); ex.printStackTrace(); throw ex; } } |
I'm not sure if the code is valid, as I have no running eclipse here 
|
|
|
|
|
20
|
Game Development / Newbie & Debugging Questions / Re: Bullets target players last position?
|
on: 2012-04-18 17:55:29
|
I think you are confusing some things here... If you want that the bullet keeps on flying on the initial line, you either have to save the angle or the x and y speed, when you instance your bullet. When you don't want the bullets to be able to change direction or speed, you can precalculate x and y speed and just update with those values. this is the update method in one of my prototypes: 1 2 3 4 5
| public void updateDistance(int d) { xd = (float) (-Math.sin((r*Math.PI / 180)) * ys * d); yd = (float) (Math.cos((r*Math.PI / 180)) * ys * d); } |
the parameter d is the time delta in milliseconds since last update. ys defines the speed r is the rotation (float from 0-360, where 0 is pointing to the top/north) xd and yd are the traveled distance in this frame. if you want to precalculate, you would have to remove the "* d" from both formulas and then apply the delta during update. I hope this helps. there may be a better solution (there most certainly is, as I'm not really that strong in math). one additional thing you need is the angle. i calculate the angle (r := radius) like this 1 2 3 4 5 6 7 8
| public static float getAngle(float x0, float y0, float x1, float y1) { float f1 = (float)Math.toDegrees( Math.atan2( y0-y1, x0-x1 ) ); f1+=270; while ( f1 > 360 ) f1-=360; while ( f1 < 0 ) f1+=360; return f1; } |
Simply use the bullet spawn coordinates for x0 and y0 and the current player coordinates for x1 and y1.
|
|
|
|
|
22
|
Game Development / Shared Code / Re: Kryo: Fast, efficient Java serialization
|
on: 2012-04-18 09:15:17
|
Thanks for your reply. As I am quiet unexperienced with network programming, I thought there must be a reason for that constraint.  So what you say is that I have to serialize my data into one big stream and then split the stream in peaces that fit the buffersize and send it chunk by chunk? Maybe I could write a module to send and receive byte blocks and puts them together for further processing, when all chunks have been transmitted correctly. This blocking sounds a bit like an issue to me, or at least something, I should keep in mind. What buffer size do you recommend to use, so the blocking won't be an issue? I will have to tweak it anyway, but would be nice to know what others are using here. In my scenario, there would be one server and most likely not more then 8 clients. Most of the big data parts would be transmitted during setup of the game party, so in there it doesn't matter that much, if a connection gets blocked for a while (as long as it is not dropped). During the game, there will be transmitted most likely player events, world updates, chat messages etc.
|
|
|
|
|
23
|
Game Development / Shared Code / Re: Kryo: Fast, efficient Java serialization
|
on: 2012-04-17 16:53:56
|
I used kryonet for a small prototype (a networked snake) and its really easy to use. Only thing that bugged me was that you couldn't configure a dynamic buffer size. this led to some problems, as most messages I serialized were pretty small, but some on the other hand were pretty big (i wanted to add the possibility to transfer new maps and tilesets from server to client. I ended up not implementing the sharing functionality because I didn't want to set the buffer size to a very high value for all messages). I think the part with the buffer size lies in Kryo itself and not in kryonet... Can the buffer size now be made dynamic? or can you propose a workaroun for this problem? Apart from that I really liked working with kryo / kryonet, because it is very easy to learn and you can concentrate on other stuff than serialization or networking. Thanks man 
|
|
|
|
|
24
|
Game Development / Newbie & Debugging Questions / Re: Level tree method?
|
on: 2012-04-15 12:53:12
|
You could apply the singleton pattern, when you wan't to have exactly one instance of the class... I use something like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| class LevelLoader { private static LevelLoader levelLoader;
public static LevelLoader get() { if(levelLoader == null) levelLoader = new LevelLoader(); return levelLoader; }
private LevelLoader() { } } |
with the private constructor, you make sure that the class cannot be constructed anywhere else. Then If you want to use the loader, you simply call LevelLoader.get() to get the instance. You could also add some initialization code into the if block in the get method, so the loader is initialized with the correct parameters... hope that helps
|
|
|
|
|
25
|
Game Development / Game Play & Game Design / Re: Making 2D games creepy?
|
on: 2012-04-15 12:42:24
|
Maybe you should find some games, that do exactly that and then analyze how the game achieves the creepiness. I think "Lone Survivor" did a really great job in creating a creepy atmosphere. There are multiple things that help to build up the creepy feeling. An important part (as already pointed out by others) is using the right sounds. Another thing that really does a good job are the backflashes in the game. Often you don't really know what happened and land in a situation where you have to react quick, which makes the feeling more intense. A gameplay mechanic, that also enforces this is the flashlight. You can only light up in one direction, so you don't know whats happening behind you. Most importantly, its the whole presentation, that gives a great atmosphere. Give it a shot (I think there's also an online demo of it, if you want to take just a peek). I think that if you want to have a place or environment that's creepy, you also need one that is safe. Constantly being presented with a creepy environment somehow loses its intensity as you become used to the situation. You have to establish safe places and scenes, so the creepy ones really can dish out. One thing that really scared the shit out of me was in resident evil 1 or 2 (can't remember, its so long ago  ) in the police station. You come by a corridor, that has a hole in the wall, that is blocked by some planks. The first time you walk by this planks you are (at least I was XD) very cautious, as the setup looks like something has to jump out of the wall... But nothing happened. Later in the game you have to walk past that hole again. I had memorized that nothing has happend here and so I walked past the planks, just to be grabbed by some ugly tentacles, that came out of the wall. I screamed, because I really wasn't expecting it XD Because of this little event, I was always somewhat alerted because I never knew, if I am really safe. I know, its not from a 2d game, but you could apply the concept in your game too. A last thought about the consequences. Knowing that an encounter with a specific creature means your certain death surely is an issue to the player. But not knowing the consequences at all can also build up some tension.
|
|
|
|
|
26
|
Game Development / Game Play & Game Design / Re: Music + Sound Effects!
|
on: 2011-08-17 14:13:27
|
@counterp I think the the license of the samples depends on the sample itself. You have to check it . And it doesn't mean, that you have to pay for music. There is plenty of creative common music out in the wild. Some things may be restricted for non commercial use, but even if that is the case, you still can write to the composer / producer and ask for permission. I mean both parties can benefit from such a collaboration. You get your soundtrack and the producer / composer gets credits for his songs in your game... What music do you need or what type of game is is you're making? I make music myself (mostly psy trance / goa), but maybe I could try to compose some tracks for you (or there maybe already a song of mine which would be good for your game, although I doubt that  ). At the moment, I simply lack the time, so if you could give me some hints in direction I could try to do something in the next months. Don't know if I find the time but it's something I always wanted to try.
|
|
|
|
|
27
|
Game Development / Game Play & Game Design / Re: Music + Sound Effects!
|
on: 2011-08-17 12:00:36
|
Making music is a big world and if you're new to it it may be best, if you look for someone, that creates your desired soundtrack. First of all you should make a concept, what role music and sound fx are playing in your game. Maybe think of a melodie or a main concept, that will be associated with your game. Then think of, what different types of music you need. Take an rpg as an example. There you could have different type and styles of music, depending on your current situation. When the player character is in a fight, it might be appropriate to bring threatening, nerveuse music, that gives the player a hint, that something bad is about to happen  When the player is in a tavern, the music might imitate the happy and drunken mood of the tavern. If you are exploring ancient ruins, a slow and mystical soundtrack might be more appropriate. I find FallOut: Las Vegas has a good example of well used sound fx and music. Early in the game, you have to get some roots, that grow near a cementery. The music in this area is very quiet and mysterious and sometimes, when you get near some graves, it seems that there are voices mixed to the music, that gives the whole thing a "ghosty" touch. allthough nothing bad happened at the graveyard, I always became a special tense feeling, when I was near the yard... about the soundeffects: buy a microphone or a pocket recording device and try to find nice sounds. Experiment with materials, go to your kitchen, use your appliances at home, ride with the bus and record your ride, beat your frying pan with your mobile phone  . try to blend out the things you are doing but instead try to imagine, what those sounds could be. be creative. sometimes reversing a sample or applying some effects to it can give it the right touch. it can be helpful, when you already now what sounds you need. for example, when you need foot step sounds for different materials, write down all the materials you need and then try to find something, that sounds the way, like you think it should sound. walking with high heels on a wooden floor could be imitated by knocking a lighter to a wooden table. Important thing here is, in my opinion, that you have alternatives. Nothing is more boring, than hearing the one single footstep sound over and over again. Make multiple takes and implement it in your game, that the used sounds vary. I hope this can give you some ideas to start with.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|