Show Posts
|
|
Pages: [1] 2 3 4
|
|
2
|
Game Development / Game Mechanics / Re: Translating between cartesian and Isometric coordinates
|
on: 2011-01-21 11:52:51
|
Hi, Glad that the forums are back  Yes, I realised that most of the processor heavy stuff actualy is constant, so I pre-calculate that, store it as a variable, and use it each time. This is WAYY quicker, obviously  I dont have my code with me at the moment, but I will post the method I'm now using along with some screens later this evening. What I'm going to work on next is getting a basic particle system going. The next problem I need to solve is automaticaly finding the center point of the base of a sprite.
|
|
|
|
|
3
|
Game Development / Game Mechanics / Translating between cartesian and Isometric coordinates
|
on: 2011-01-14 11:33:31
|
Morning all. my for-fun project at the moment is a basic isomorphic base building tower defense strategy game. I need to be able to translate between my easy to use 3D Cartesian world system to my 2D Isometric screen projection. I thought I would create a thread on this, to document my progress and get a bit of discussion going. UPDATE: My world cord system will use 3D XYZ coordinates. I need to convert this to the 2D XY cord system that the screen uses to draw. The goal is to be able to then draw my 3D world in 2D Isometric projection. I started by Wikipedia-ing that: http://en.wikipedia.org/wiki/Isometric_ProjectionThe first important point I noticed it that I've got the camera angles wrong on my sprite renders  After reading through the wiki article, i moved to this page that answers pretty much all my questions. From this I was able to sketch up the following function for transforming from world to screen cords. 1 2 3 4 5 6 7 8 9 10 11 12
| Vector2 cameraOffset;
float a = arctan(1/2); float s = 100f; Vector2 World2Screen(float X, float Y, float Z) { float screenX = cameraOffset.X + (X-Z)cos(a)s; float screenY = cameraOffset.Y + ((X+Z)sin(a)-Y)s; return new Vector2(screenX, screenY); } |
I've not had a chance to run this code yet, but any comments, suggestions and constructive crit' are welcome. Thanks for reading, have a good day, Matt
|
|
|
|
|
5
|
Java Game APIs & Engines / Engines, Libraries and Tools / Re: Sprite Alpha. What am I doing wrong?
|
on: 2011-01-14 01:35:27
|
I've tried fixing them in photoshop, with no luck. Sorry, I uploaded the image to a facebook gallery, which seems to have swapped it to a jpg. Here;  I need to re-work my rendering I think. The reason that I did it this way is because I want the ambient occlusion 'shadows' from the ground plain (also pink) so that once it's tranceparrent I get just hte shadows, and not the pink. However, now that I've had a think about it some more, I dont this that this would work as therea re gradients of pink that i would want to remove the pink from, just leaving the colored shadows. I get the shadows and AND render an alpha chanel, because the ground plain needs to have ) alpha to receive the shadows, so I think I need to figure out a way to do this. I've tryed re-rendering onto a white ground plane, but with similar problems. If there's a code way of doing it, it would be great That way I can have my cake and eat it. I think I may have just made this way to complicated for myself. Thanks for the help guys.
|
|
|
|
|
6
|
Java Game APIs & Engines / Engines, Libraries and Tools / Sprite Alpha. What am I doing wrong?
|
on: 2011-01-13 23:59:30
|
Hi all, Im taking a break from XNA (booo) Uni work to do some more Java Gaming. I'm trying to make a isomorphic turret-defence using Slick2D and I think that I may have just kneecapped myself while making my Sprites. I spent 2 days doing these, so I hope i'm wrong  Now, in XNA, and I was sure in Java2D, you can say that a color, say Color(255,45,255), is a chroma-key mask color, and anything with that will get removed. So, I went ahead and made a load of sprites like this:  Now that i've modeled and rendered all these things, I downloaded slick again and got going ... only to not be able to find a way of doing the above. I realy dont want to re-render all of these things  What am I doing wrong here? Thanks guys, Matt
|
|
|
|
|
7
|
Game Development / Game Mechanics / Re: How are Procedural Textures made?
|
on: 2010-10-21 17:36:11
|
Thanks for the links guys! I spent this morning reading about Perlin and Simplex noise, and I think that I may be able to use these (and modifications thereof) to make the type of textures we are looking for. When I start on the actual development of these, I'll create a thread with my notes. Genetica looks really cool  I wish I had the time and patience to get back into modeling/texturing. In a few weeks I will be beginning a 3DS Max course at Uni, and I will definitely have a play around with demo version of Genetica to see what it can do.
|
|
|
|
|
8
|
Game Development / Game Mechanics / How are Procedural Textures made?
|
on: 2010-10-21 00:09:03
|
Hi guys, This year at Uni my group's been tasked with creating a game to advertise how super-cool-fun the games and entertainment systems department is. What they're expecting is like a side-stroller or zelda clone something, but we've been given free reign to do whatever we like as long as its a 2D 'shooter' style thing. We've been discussing some ideas based around procedurally generated worlds, with the idea of having a 'massive game world' for the players to explore. There will be some aspect of questing (eg, go here, kill that, find this, save the npc, etc) on top of this. What I'm researching at the moment is how feasible it will be to use procedurally generated textures (turbulence, veins, noise, and such) as part of our level generation. For example, say we need a forest with loads of paths - i use a 'veins' type of texture (i think there's one in most 3D graphics packages) as the map for the tree density, so we get a load of trees with paths in between them. Does anyone have any experience of using this approach to generate levels? I have done some experiments with this ( see this post) in the past using bitmap images as my map. How exactly are procedurally generated textures actually generated? Are there a set of well known equations or is it more of an art? 
|
|
|
|
|
10
|
Discussions / General Discussions / Gaming Habits Research Mini-Project
|
on: 2010-10-16 13:40:55
|
Hi All, As part of our undergraduate project this year at university, we've been set a really vague brief to 'Make a Game'. We want to better understand what the 'average' gamer in 2010 is like, and work from there, so I've set up a quick, anonymous 20-questions quiz. If you could spend 2 minutes completing it we would be very grateful. When we have finished collecting results, I'll make them available here. The Quiz!Thanks for your time, Matt
|
|
|
|
|
11
|
Games Center / Showcase / Re: Bubble Squids
|
on: 2010-08-28 13:14:30
|
Hehe, it's strangely compelling to play. When I started I was thinking.. ok, its a bit simple, I'm not going to be playing this for more than a minute, and 10 minutes later I was still at it  Once I got my head around the scoring system, I was able to get into scoring more points per squid, and that made the game more interesting. Ditto on the time limit thing. While having a time limit adds pace, I think that it would be to frustrating for a kid to do. Unfortunately I have no kids available to test this on for you, but it did take me back to the old maths and spelling games on the BBC Basics at school. Nice job
|
|
|
|
|
13
|
Games Center / Archived Projects / Re: Gunslinger 2 - sci-fi action top down shooter
|
on: 2010-08-28 09:40:13
|
Hi, Just wanted to say that from the videos the graphics are nice and polished, and the gameplay looks good. However, I tried running it on my dad's old dell inspiron 1525 running Vista, and the webstart fails. That said, it is not my laptop, so my old man may have blocked/uninstalled JVM for all I know 
|
|
|
|
|
15
|
Game Development / Newbie & Debugging Questions / Mobile code editors - help me not escape from work!
|
on: 2010-08-16 12:04:56
|
|
mornin' all,
I'm sitting in the bar at work thinking that I do most of my best thinking while sitting in the bar or on the train or out in the wilderness wrestling bears, and never when I'm actualy sat at my desk.
what I'm thinking about right now is: what would it take to klein a basiccode editor that will run on my HTC (or the java enabled smart phone of your preference)?
is there an easy and convinient way to get thefile paths and class names from the classpath and display them as a tree?
what about code highlighting?is a smart phone man enough to run code-completion and scan for errors?
has all this been done before?
your thoughts, ladies and gentelmen.
|
|
|
|
|
17
|
Game Development / Newbie & Debugging Questions / Re: Quick! Is there a Mathematician in the house?!
|
on: 2010-08-06 20:24:06
|
Ahh, cool, that's actually a really useful thing to know  Cheers. I did want to go down the Excel rout with this (for the graphing functions), but I may just write a program that dumps out the CSV's instead... THis is getting further off topic, but has anyone found a really simple graphing package for java and swing? I cant remember which ones i've tried, but I've never found one that works, or is far too complicated and finiky to use for me to bother trying 
|
|
|
|
|
18
|
Game Development / Newbie & Debugging Questions / Re: Quick! Is there a Mathematician in the house?!
|
on: 2010-08-06 10:52:19
|
Alternatively, if you don't need the linear ramp: 1 2 3
| double highNumber = 500; double oddNumber = highNumber | 1; Math.pow(Math.sin(angle), oddNumber); |
I think this is what I need. I actually need to do this bit of code as an Excel formula rather than java code, to them save out as a CSV file and use with my program. I can sort that out though, its just the math that gets me  Thanks guys! EDIT: 1
| double oddNumber = highNumber | 1; |
what does this line actually do? I've not come across inclusive OR before. (and I'm not getting any negative values) EDITEDIT: http://support.microsoft.com/kb/q132686/ Microsoft has no need for your primitive BODMAS! Blah! 
|
|
|
|
|
19
|
Game Development / Newbie & Debugging Questions / Quick! Is there a Mathematician in the house?!
|
on: 2010-08-05 18:48:48
|
I've always wanted to say that... This is slightly off topic, but still part of my Java project work, so I thought there might be someone here that can help me. I'm working on a neural network project, and what i need to do is take the following sin wave (in black) and create the red line, which is the ideal output of the network.  Currently I've been doing this manually in Excel, because i have no idea how to calculate this. Basically, when the angle is at the 90 degree position, the output needs to be 1, and at the 270 degree position, it needs to be -1, and anywhere else it needs to be as close to zero as possible. I probably wouldn't be the first to say I'm terrible with Trig'  Thanks all, Matt
|
|
|
|
|
22
|
Game Development / Newbie & Debugging Questions / Re: Applet Image Loading
|
on: 2010-07-24 18:16:15
|
|
Ahh, that looks cool Zoto, I'll give it a go.
The method I've been using is to load everything into a HashTable at start up, instead of loading on demand, which is what your code does. Do you know if there is any advantage to either solution?
|
|
|
|
|
23
|
Game Development / Newbie & Debugging Questions / Re: Applet Image Loading
|
on: 2010-07-24 12:46:51
|
|
Code: public Image loadResource(String id, String path) { try { if(path == null || path.length() == 0) throw new SlickException("Image resource [" + id + "] has invalid path");
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Image image = null;
/* NTS: * Modifying this class to load resources from the classPath * so that it can be used within applets. * 22 July 2010, Matt */ InputStream str = classLoader.getResourceAsStream(path);
image = new Image(str, id, false);
System.out.println("Loaded Image "+ id + ": " + path); ResourceManager.getInstance().PutObject(id, image); // store the loaded image in a hashTable for later use. return image; }
catch( ... ) { ... }
}
Here is the stack trace i'm getting;
Code: Loaded Image IMAGE_GAMEWORKS_LOGO: assets/art/rbgwLogo.png Exception in thread "main" java.lang.ExceptionInInitializerError at slickgametemplate.RBGWIntroState.init(RBGWIntroState.java:56) at slickgametemplate.SlickGame.initStatesList(SlickGame.java:39) at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164) at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314) at slickgametemplate.Main.main(Main.java:33) Caused by: java.lang.NullPointerException at content.loaders.ImageLoader.loadResource(ImageLoader.java:47) at content.ResourceManager.loadImage(ResourceManager.java:211) at content.ResourceManager.loadImage(ResourceManager.java:206) at content.ResourceManager.loadResources(ResourceManager.java:181) at content.ResourceManager.loadResources(ResourceManager.java:126) at content.ResourceManager.<init>(ResourceManager.java:80) at content.ResourceManager.<clinit>(ResourceManager.java:46) ... 6 more Java Result: 1
I've run a few breakpoints, and it seems that the Image being created from the InputStream has zero dimensions (the actual .png is 640*480)
I've checked everything I can think of, but got nothing. Any ideas what is happening here?
Thanks, Matt
|
|
|
|
|
24
|
Games Center / Archived Projects / Re: JOURNAL: Space Fleet Combat (now less of a 2D Game Engine)
|
on: 2010-07-24 10:22:13
|
No great experiments today, just going back to updating my empty template game to use SLick2D's StateBasedGame, with a short animated introduction state and sound. After some discussion on the forums and some reading around, I'm re-writing my content loading code to use the ClassLoader class, and storing all my content in the classpath. My overall goal for today is to consolidate everything I have into something reusable. Until now I have been copy-pasting bits from other projects here and there as I need them. This has lead to the obvious problem of having 30 copies of the same class on my HDD, one of which is the RIGHT one  At the moment, my classpath looks like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| TemplateSlickGame (used to create a new game project in NetBeans) assets art (for storing images) sound (for storing sounds & music) effects (currently only for storing particle effects)
slickgametemplate Main (main class for the app) SlickGame (extends StateBasedGame) RBGWIntroState (extends GameState to show a splash screen)
rbgwLib (code library common to all my games) content ResourceManager (loads and indexes art, music, particle effects, etc) IResourceLoader (an interface for loading resources) loaders ImageLoader (loads images) SoundLoader (loads sounds/music) FontLoader (loads Slick Font types) ParticleLoader (loads particle systems) AnimationLoader (loads Slick Animations) TODO: Move the rest of my crappy-hacked code into this library :) |
Probably not allot of scope for screen shots today...
|
|
|
|
|
26
|
Game Development / Newbie & Debugging Questions / Re: Applet Image Loading
|
on: 2010-07-23 20:56:21
|
Thanks ryanm! Loading images this way seems to be working now, and I've set-up my game template project to include an assets.art, assets.data, assets.art.sound and assets.art.music class-path, and also a template resources.xml document to load in some default images. I've used this to move my template project over to using Slick's StateBasedGame class and added an Intro state that show's my (WIP) blog-site logo with a nice fade-in fade-out effect  I actually feel like I've got something done today.
|
|
|
|
|
27
|
Game Development / Newbie & Debugging Questions / Re: Applet Image Loading
|
on: 2010-07-23 17:31:13
|
|
ok, i'll have a read-up on those.
Would it be better to continue using my hash-tables to store my resources in memory, or to change them to using something like HashTable<String name, String path> and using getResource(path) each time I want to get a resource?
(I assume this would then either load the file from the classpath, or try findLoadedClass() first to get it from the cache, right?)
|
|
|
|
|
28
|
Game Development / Newbie & Debugging Questions / Re: Applet Image Loading
|
on: 2010-07-22 17:40:16
|
Hi, I've had a go at modifying my resource manager class to use ClassLoader (rather than fileIo). I'm having a lot of trouble understanding how this is meant to work. Does anyone know of any basic tutorials that cover loading files this way? Everything I've been able to find seems to only work with actual classes. Here's the code I have tried for reference: 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
| public class ResourceManager {
private static ResourceManager _instance = new ResourceManager(); private static ClassLoader classLoader;
private Map<String, Sound> soundMap; private Map<String, Image> imageMap; private Map<String, ResourceAnimationData> animationMap; private Map<String, String> textMap; private Map<String, ParticleSystem> particleMap;
private ResourceManager() { soundMap = new HashMap<String, Sound>(); imageMap = new HashMap<String, Image>(); animationMap = new HashMap<String, ResourceAnimationData>(); textMap = new HashMap<String, String>(); particleMap = new HashMap<String, ParticleSystem>();
classLoader = ClassLoader.getSystemClassLoader();
try { URL url = classLoader.getResource("assets/data/resources"); if(url != null) { File f = new File(url.getPath()); this.loadResources(new FileInputStream(f)); } else { throw new NullPointerException(); } } catch(SlickException e) { e.printStackTrace(); } catch(FileNotFoundException e) { e.printStackTrace(); } }
public final static ResourceManager getInstance(){ return _instance; }
public void loadResources(InputStream is) throws SlickException { loadResources(is, false); }
public void loadResources(InputStream is, boolean deferred) throws SlickException { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = docBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new SlickException("Could not load resources", e); }
Document doc = null;
try { doc = docBuilder.parse (is); } catch(SAXException e) { throw new SlickException("Could not load resources", e); } catch (IOException e) { throw new SlickException("Could not load resources", e); }
doc.getDocumentElement ().normalize ();
NodeList listResources = doc.getElementsByTagName("resource");
int totalResources = listResources.getLength();
if(deferred) { LoadingList.setDeferredLoading(true); }
for(int resourceIdx = 0; resourceIdx < totalResources; resourceIdx++) {
Node resourceNode = listResources.item(resourceIdx);
if(resourceNode.getNodeType() == Node.ELEMENT_NODE){ Element resourceElement = (Element)resourceNode;
String type = resourceElement.getAttribute("type");
if(type.equals("image")){ addElementAsImage(resourceElement); }else if(type.equals("sound")){ }else if(type.equals("text")){ }else if(type.equals("font")){
}else if(type.equals("animation")){ } else if(type.equals("particleSystem")){ addElementAsParticleSystem(resourceElement); } } } }
... loads of methods for getting the files from the XML nodes ... |
Where I'm having trouble is here: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| URL url = classLoader.getResource("assets/data/resources.xml"); if(url != null) { File f = new File(url.getPath()); this.loadResources(new FileInputStream(f)); } else { throw new NullPointerException(); } |
Which always throws the nullPopinterException with 'url' always returning null. This is all rater new to me, so thanks for being patient 
|
|
|
|
|
30
|
Game Development / Newbie & Debugging Questions / Applet Image Loading
|
on: 2010-07-21 18:25:58
|
What is the best way to load images and XML data to a java applet? What I have at the moment is an Slick2D Game applet. I have a content loader from an application project that takes an XML file containing links to the games separate image/sound/particles, etc that need to be loaded. Finally I have a directory called 'art' that contains the actual image files. On my server I have kept the same directory structure as the application version: MyApplet - data - resources.xml - art - image1.png - image2.png - image3.png - image4.png When running the applet, I get the following error: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| Exception in thread "Thread-14" java.lang.ExceptionInInitializerError at DecoGame_NixieClock.NixieClockGame.init(NixieClockGame.java:43) at org.newdawn.slick.AppletGameContainer$Container.initApplet(AppletGameContainer.java:272) at org.newdawn.slick.AppletGameContainer$ContainerPanel.initGL(AppletGameContainer.java:229) at org.newdawn.slick.AppletGameContainer$ContainerPanel.start(AppletGameContainer.java:216) at org.newdawn.slick.AppletGameContainer$1.run(AppletGameContainer.java:92) Caused by: java.security.AccessControlException: access denied (java.io.FilePermission data\resources.xml read) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at Content.ResourceManager.<init>(ResourceManager.java:50) at Content.ResourceManager.<clinit>(ResourceManager.java:33) ... 5 more |
If I'm right, this is because applets are not allowed to access the local file-system. Is there a method for loading data to an applet from the server? This is the layout of the XML file I use to store my content links: 1 2 3 4 5 6 7 8 9 10
| <?xml version="1.0" encoding="UTF-8"?> <resources> <!-- GAMEPLAY -->
<!-- GUI --> <resource type="image" id="IMAGE_1">art\image1.png</resource> <resource type="image" id="IMAGE_2">art\image2.png</resource> <resource type="image" id="IMAGE_3">art\image3.png</resource>
</resources> |
Would it just be a matter of changing these links to say ' www.mydomain.com/applet/art/image1.png' or is there a better way?
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|