Show Posts
|
|
Pages: [1] 2
|
|
2
|
Game Development / Game Mechanics / Re: Braid-like time reversal
|
on: 2012-03-02 13:44:23
|
|
could reverse time while you have created snapshots of a few variables (jumping, falling, speed, etc) then reverse the process with the variables activating at the time they activated. Just an idea. I might attempt this at some point (:
|
|
|
|
|
5
|
Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics
|
on: 2012-02-12 22:07:01
|
*FACEPALM* Of course! @OP You're loading that image from another thread! You should do everything on the same thread as the rendering thread and after the GL Context has been initialized  Surprisingly I already thought of it but never did try it, I'll just make a trigger or something that I can set in that thread then activate in the other thread. Nice one mate (: EDIT: Wait don't know if that'll work because I tried getting graphics of a Image in render() and it makes the game freeze. So strange... :/
|
|
|
|
|
6
|
Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics
|
on: 2012-02-11 16:55:58
|
This is line 40 in GraphicsFactory: 1
| fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object; |
I have no idea how a NullPointer can be thrown there, unless this is an LWJGL bug where GLContext.getCapabilities() returns null. Exactly what I mean, the error is totally confusing and shouldn't happen its a pretty simple procedure I'm trying and I have tried several ways around which have also failed. I can't paste anymore code neither cause I ain't at home. Would really appreciate it if somebody could figure this out.  Peacee
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics
|
on: 2012-02-11 13:11:20
|
Just rolled out of bed so I could be wrong/late. Define the variable you'd like to use to connect a image to "Sprite". Define the image/path, than link it to that Sprite variable. Than render that Sprite variable after linking the Image to it. 1 2 3 4 5 6 7
| public BufferedImage Sprite; public ImageIcon player = new ImageIcon("path/to/file.png");
public void paint(Graphics g) { Sprite = player.getImage(); g.drawIage(Sprite, 20, 20, null); } |
Hope it helps some  Its slick not java 2d mate. And i'll edit my thread with sscce in a minute. edit; updated.
|
|
|
|
|
9
|
Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics
|
on: 2012-02-10 14:50:55
|
First of all I'd like to say that I'm a complete newbie. Perhaps that's why I find something odd in the next piece of code: 1 2 3 4 5 6 7 8 9 10 11 12
| try { Image image = null; try { image = new Image(256,256); } catch (SlickException se) {se.printStackTrace(); }
image.getScaledCopy(player.getIcon.getWidth(), player.getIcon.getHeight());
Graphics g = image.getGraphics(); Image pixel = null; |
You're not setting another Image with the return of getScaledCopy(). Does this method sets 'image' to it's scaled copy? Anyway I don't think it has something to do with your problem. But I do think that it might be a variable scope problem. Have you tried creating the 'image' outside the method and initializing it inside? Oh no that was an accident I forgot to put image = image.getScaledCopy(). Yeah the image I have tried that the image in first post is made in init(). Yet again I'm just not sure what's going on, should be simple.
|
|
|
|
|
10
|
Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics
|
on: 2012-02-10 13:37:36
|
Ooops, I forgot you are using Slick. I have never used it (except for the utils to load PNG textures). Some random things that probably wont work (sorry :-(): - Do you try to create the image AFTER this.getApp().start() is called?
- The init() method is of a class inherited from org.newdawn.slick.BasicGame? Although I don't think it's relevant for this error, you could append the @Override tag to it, so you get a warning if it doesn't override for some reason.
- If your class is inherited from *.BasicGame, do you call the super() constructor on your constructor?
Yeah I create after this.getApp().start() and the init method of that is not thats in Main which has the superclass BasicGame and it is calling Super(String). Really not sure, if I was in java2d this would be easy. But slick is awesome ¬.¬
|
|
|
|
|
15
|
Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics
|
on: 2012-02-10 00:02:55
|
Was just trying to create a blank Image eg new Image(256, 256) to draw graphics on and create a image. The image is throwing a null at the moment but the graphics also does. I don't get what's happening the principle is simple. I've tried numerous different ways, ImageBuffer, loading a actual Image it all seems to be obsolete.  Peace
|
|
|
|
|
16
|
Game Development / Newbie & Debugging Questions / Problem with Slick 2d Image / Graphics
|
on: 2012-02-09 23:40:06
|
Hey, trying to create a simple new Image, blank, then add the graphics altered from another image and replace it with the image just made. Sounds simple but when I've been trying to create a new image or even access any Images graphics its not been working, throwing a null error every time, real confused at this been wrecking my brain for past hour or two. EDIT: this is shader class with the problem in it: 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
| package org.background.worker;
import java.util.Iterator;
import javax.swing.SwingWorker;
import org.background.LightProcessor; import org.model.World; import org.model.emitters.Emitter; import org.model.emitters.Light; import org.model.player.Player; import org.newdawn.slick.Color; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image;
public class Shader extends SwingWorker<World, Void> {
private LightProcessor processor = null; public LightProcessor getProcessor() { return processor; }
public void setProcessor(LightProcessor processor) { this.processor = processor; }
public Shader(LightProcessor processor) { this.setProcessor(processor); }
@Override protected World doInBackground() throws Exception { if(processor.getWorld() == null) return null; World world = this.getProcessor().getWorld(); Player player = world.getPlayer(); if(player == null) return null; if(world.getLightEmitters().size() > 0) { for(Iterator<Emitter> it$ = world.getLightEmitters().descendingIterator(); it$.hasNext();) { Light l = (Light) it$.next(); if(l == null) continue; if(!l.getPosition().isWithin(player.getPosition(), (int)l.getRange())) continue; if(player.getIcon() == null) continue; try { Image image = null; image = world.getBlank(); if(image == null) continue; image = image.getScaledCopy(player.getIcon().getWidth(), player.getIcon().getHeight()); if(image == null) continue; Graphics g = image.getGraphics(); if(g == null) continue; Image pixel = null; for(int h = 0; h < player.getIcon().getHeight(); h++) { for(int w = 0; w < player.getIcon().getWidth(); w++) { pixel = player.getIcon().getSubImage(w, h, 1, 1); g.drawImage(pixel, w, h, Color.red); } } player.setIcon(image); } catch(Exception e) { e.printStackTrace(); } } } return world; } } |
In theory it should work but can't find the graphics here is the error: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
| java.lang.NullPointerException at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.init(GraphicsFactory.java:40) at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.createGraphics(GraphicsFactory.java:120) at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.getGraphicsForImage(GraphicsFactory.java:91) at org.newdawn.slick.Image.getGraphics(Image.java:397) at org.background.worker.Shader.doInBackground(Shader.java:62) at org.background.worker.Shader.doInBackground(Shader.java:1) at javax.swing.SwingWorker$1.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at javax.swing.SwingWorker.run(Unknown Source) at org.background.LightProcessor.run(LightProcessor.java:37) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) |
And here is where the Image 'blank' is set: 1 2 3 4 5 6 7 8 9 10 11 12 13
| public World(Main main) { this.setMain(main); this.setProcessor(new Processor(this)); this.setLightProcessor(new LightProcessor(this)); try { this.setBlank(new Image("./data/blank.png", false, Image.FILTER_LINEAR)); .... } catch(SlickException e) { e.printStackTrace(); } } |
The world is initialized in the init() method of Main extends BasicGame. Any ideas? Peace.
|
|
|
|
|
18
|
Games Center / Showcase / Re: 2D Action RPG and Platformer (Code named LeadCrystal)
|
on: 2012-02-09 16:50:18
|
Looks pretty damn good so far mate, good luck!
I've been wanting to make dynamic shadows when I make a new lighting system. Did you say you've been working on this 4 month?
Not exactly... I think I say that since our last tech video, it's been 4 months, and we've progressed a lot since then. The project itself is much older than that, roughly a year and four months. Although we took a 4 month hiatus at one point, and we didn't have openGL until last august, which blew open tons of doors in terms of what we could do. When we started out we knew basically nothing so we used Java2D, which hindered our capabilities a lot. Cool mate must have been a lot of effort i started using java2d nowadays I use slick and opengl, just finished my hill physics. I fancy doing dynamic lighting but it'll be a right effort.
|
|
|
|
|
23
|
Games Center / WIP games, tools & toy projects / Re: Unnamed SideScroller; Have a look. ;)
|
on: 2012-01-27 22:43:41
|
The tags on your youtube video Wall Kick (INXS Album) Kick Dance New Better Get Than Getting Rip Face Robbie Other Face (professional Wrestling) Side Professional Wrestling Christina Aguilera Dancing Match Championship Team Game Backyard World Each Title Extreme Dark Dance Music Arm Some Stuff Singing Each Other Other Side Tournament Basics Beautiful Game (retailer) Keeps I could make a comment, but I won't. Lol seemed too much of an effort writing in stuff so I just clicked the suggestions lol New video added Wall kicking been improved  Peace.
|
|
|
|
|
27
|
Games Center / WIP games, tools & toy projects / Super Mario Remake, started a-new.
|
on: 2012-01-22 16:59:55
|
Hill physics: Mario remake Hill physics.Started remaking this Side Scroller Super mario remake.This mario remake will include the level graphics from nearly all snes mario's TODO:- Pixel perfect collision (Done)
- Acceleration and deceleration walking & running (Done)
- Hill physics (Sliding down and forcing acceleration down) (Done)
- Jumping and falling (Done)
- Different types of objects (Spikes, moving platforms)
- Sliding down walls and wall jumping
- Items (Coins, powerups etc)
- Skybox background (Done)
OLD:Old video; Improved wall kick & more (New)Well I've been working on this for past few days; http://www.youtube.com/watch?v=0YUuF_lIgzIIts going to be a fairly hefty side scroller once it's finished, using background processes to deliver maximum potential I'm sure this project will go far. What do you think of the video? Pixel perfect slopes (:  250 Entities;  Structure and some settings;  Peace.
|
|
|
|
|
28
|
Games Center / Showcase / Re: Top down rpg development, in Slick.
|
on: 2011-12-19 00:12:54
|
Oh right well didn't know that, started working on 3d environment with LWJGL using Slick as well, it could be awesome if it turns out well. Might put src up here if I stop developing it probably. EDIT: Okay I catch your drift I'll make sure people know next time pal, cheers.  (Please note I used the model and texture loading from the Asteroids in the Slick package && the ship model and texture is from there)
|
|
|
|
|
29
|
Games Center / Showcase / Re: Top down rpg development, in Slick.
|
on: 2011-12-19 00:05:05
|
This smells like pumping your thread in the showcase-section (read the rules on that). Consider this your first warning. Continuing to do this will lead to having this thread removed from the showcase. It wasn't needless i waited over 5 days each or something like, but thanks for heads up. Won't happen again. I can't quite follow your reasoning... You didn't add any content to your topic, just shoving it into our faces again and again, yet you deem it not 'needless'. First time I added a few new images and last time I added latest video. I have been adding content man & it doesn't matter anyway, I know now. Thanks again for the warning.
|
|
|
|
|
30
|
Games Center / Showcase / Re: Top down rpg development, in Slick.
|
on: 2011-12-19 00:01:06
|
This smells like pumping your thread in the showcase-section (read the rules on that). Consider this your first warning. Continuing to do this will lead to having this thread removed from the showcase. It wasn't needless i waited over 5 days each or something like, but thanks for heads up. Won't happen again.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|