BlackSunStudios

Members
  • Content count

    52
  • Joined

  • Last visited

Community Reputation

102 Neutral

About BlackSunStudios

  • Rank
    Member
  1. Generating downhill ski slopes for a 2d game

    I would help you if i had more points in "Science" and "Repair" ;)
  2. Any Good Java3D tutorials anywhere?

    Hey guys. Ive been programming in java with Java3D API. its really good! Ive managed to make terrain, show.obj,player movement, lights and object movement. I was wandering if anyone knew of any good java3D tutorials anywhere? ive read the api tutorial but it isnt really my kind of style.
  3. Hey guys. I need help in installing DirectX for Visual C#. I have the sdk installed into vista but it wont work in Visual. I have the include folder but all the files are .h files and they dont work with visual c# for some reason. Help?
  4. Help Again with wire coding (java)

    Sorry guys need some help again. Im writing a "sequel" to a game ive made called Extron. Ive written the first classes of code. At the moment im running into a obstacle, Wire. Basically, I need help coding the wire of the game. I want the wire to be based on a boolean powered. I want it to be very fast and responsive but i have literally no idea how to code this. I have an idea of how it would work but i have no idea how to code it. The complete code of the game so far (the game is using slick2d): [code]package Main; import org.newdawn.slick.*; import Main.Components.*; public class Main extends BasicGame { static int width = 1280; static int height = 800; int tilesize = 5; int xtiles = (width/tilesize); int ytiles = (height/tilesize); int Keyset = 0; Tile[][] tile; public Main() { super("CompTron"); } public void render(GameContainer arg0, Graphics g) throws SlickException { switch(Keyset){ case 0: g.setColor(Color.white); g.drawString("Wire", 10, 10); break; case 1: g.setColor(Color.white); g.drawString("BaseComponent", 10, 10); break; } for(int x = 0; x < xtiles; x++){ for(int y = 0; y < ytiles; y++){ if(tile[x][y].type != Type.base ){ tile[x][y].Draw(g); } } } } public void init(GameContainer arg0) throws SlickException { tile = new Tile[xtiles][ytiles]; for(int i = 0, x = 0;i < xtiles; i++, x += tilesize){ for(int b = 0, y = 0; b < ytiles; b++, y += tilesize){ tile[i][b] = new Tile(x,y); } } } public void update(GameContainer gc, int arg1) throws SlickException { for(int i = 0; i < xtiles; i++){ for(int b = 0; b < ytiles; b++){ if(tile[i][b].type != Type.base){ try{ tile[i][b].Interact(tile[i][b - 1], tile[i][b + 1], tile[i - 1][b], tile[i + 1][b]); }catch(Exception e){} } } } Input in = gc.getInput(); if(in.isKeyDown(in.KEY_ESCAPE)){ System.exit(0); } if(in.isKeyDown(in.KEY_1)){ Keyset = 0; } if(in.isKeyDown(in.KEY_2)){ Keyset = 1; } if(in.isMouseButtonDown(in.MOUSE_LEFT_BUTTON)){ for(int i = 0;i < xtiles; i++){ for(int b = 0; b < ytiles; b++){ if(tile[i][b].occupied == false){ if(tile[i][b].x > in.getMouseX() - 5){ if(tile[i][b].x < in.getMouseX()){ if(tile[i][b].y > in.getMouseY() - 5){ if(tile[i][b].y < in.getMouseY()){ switch(Keyset){ case 0: tile[i][b] = new Wire(tile[i][b].getX(), tile[i][b].getY()); break; case 1: tile[i][b] = new BaseComponent(tile[i][b].getX(), tile[i][b].getY()); break; } } } } } } } } } if(in.isMouseButtonDown(in.MOUSE_RIGHT_BUTTON)){ for(int i = 0;i < xtiles; i++){ for(int b = 0; b < ytiles; b++){ if(tile[i][b].x > in.getMouseX() - 5){ if(tile[i][b].x < in.getMouseX()){ if(tile[i][b].y > in.getMouseY() - 5){ if(tile[i][b].y < in.getMouseY()){ tile[i][b].setType(Type.base); tile[i][b].setOccupied(false); } } } } } } } } public static void main(String[] args) throws SlickException { AppGameContainer app = new AppGameContainer(new Main()); app.setDisplayMode(width,height, true); app.setShowFPS(false); app.start(); } } [/code] [code]package Main; import org.newdawn.slick.Graphics; public class Tile { int x; int y; int xsize; String license = ""; int ysize; Type type = Type.base; boolean occupied = false; boolean powered = false; int source; public Tile(int x, int y){ this.x = x; this.y = y; xsize = 5; ysize = 5; } public void Draw(Graphics g){} public void Interact(Tile up,Tile down, Tile left, Tile right){} public void Init(){} public int getX(){ return x; } public int getY(){ return y; } public int getXsize(){ return xsize; } public int getYsize(){ return ysize; } public void setX(int x){ this.x = x; } public void setY(int y){ this.y = y; } public void setXsize(int xsize){ this.xsize = xsize; } public void setYsize(int ysize){ this.ysize = ysize; } public void setType(Type type){ this.type = type; } public void setOccupied(boolean occupied){ this.occupied = occupied; } public void Update(){} public void setLicense(String license){ this.license = license; } public String getLicense(){ return license; } public boolean getPowered(){ return powered; } public void setPowered(boolean powered){ this.powered = powered; } public int getSource(){ return source; } public void setSource(int source){ this.source = source; } } [/code] [code]package Main; public enum Type { base, tile } [/code] [code]package Main.Components; import org.newdawn.slick.*; import Main.*; public class BaseComponent extends Component{ public BaseComponent(int x, int y) { super(x, y); setType(Type.tile); setLicense("BaseComponent"); } public void Draw(Graphics g) { g.setColor(Color.gray); g.fillRect(getX(), getY(), getXsize(), getYsize()); } public void Update() { } public void Interact(Tile up,Tile down, Tile left, Tile right) { } public void Init() { } }[/code] [code]package Main.Components; import Main.*; public abstract class Component extends Tile { public Component(int x, int y) { super(x, y); } Tile[] in = new Tile[100]; Tile[] out = new Tile[100]; public void setIn(Tile input, int inputnum){ in[inputnum] = input; } public void setOut(Tile output, int outputnum){ out[outputnum] = output; } } [/code] [code]package Main.Components; import org.newdawn.slick.*; import Main.Tile; import Main.Type; public class Wire extends Tile { public Wire(int x, int y){ super(x,y); setType(Type.tile); Init(); setOccupied(true); setLicense("Wire"); } public void Interact(Tile up,Tile down, Tile left, Tile right) { if(up.getLicense() == "BaseComponent" || down.getLicense() == "BaseComponent" || left.getLicense() == "BaseComponent" || right.getLicense() == "BaseComponent" ){ this.setPowered(true); this.setSource(1); if(up.getLicense() == "Wire"){ up.setSource(1); } if(down.getLicense() == "Wire"){ down.setSource(1); } if(left.getLicense() == "Wire"){ left.setSource(1); } if(right.getLicense() == "Wire"){ right.setSource(1); } }else{setSource(0);} if(this.getLicense() == "Wire" && this.getSource() > 0){ if(up.getPowered() == true){ this.setPowered(true); } if(down.getPowered() == true){ this.setPowered(true); } if(left.getPowered() == true){ this.setPowered(true); } if(right.getPowered() == true){ this.setPowered(true); } } if(up.getLicense() == "Wire"){ } if(down.getLicense() == "Wire"){} if(left.getLicense() == "Wire"){} if(right.getLicense() == "Wire"){} } public void Init() { } public void Update() { // TODO Auto-generated method stub } public void Draw(Graphics g) { if(getPowered() == true){ g.setColor(Color.red); g.fillRect(getX(), getY(), getXsize(), getYsize() ); }else{ g.setColor(new Color(100,0,0)); g.fillRect(getX(), getY(), getXsize(), getYsize() ); } } } [/code] The reason i have a component class is because i want some components to have multiple inputs. Thanks in advance!
  5. Help With A Game Re-development Problem? (java)

    [quote name='BCullis' timestamp='1319593295' post='4877002'] So you're saying that once power has been applied to a wire (and propagated to all nearby wires, since it seems wires check their power by polling all immediate neighbors), if you remove the power source your wires continue to think they're powered since they keep noticing their neighbor thinks it is powered? Sounds like you need to change the way you're checking for power flow. As alternate possibilities, you could track the number of power sources (like reference counting) that reach a particular wire tile, or change the way your wires respond to a power source being turned off, like: when source is powered off -check all wires that connect to this power source -if this is their only power source -- turn them off -else -- reduce their source count by 1 [/quote] Thanks! The bit about the neighbour wires was about someone else who posted an answer.
  6. Help With A Game Re-development Problem? (java)

    [quote name='ApochPiQ' timestamp='1319578123' post='4876924'] [code]boolean powered = false; if (top.powered) powered = true; else if (bottom.powered) powered = true; else if (left.powered) powered = true; else if (right.powered) powered = true;[/code] Alternatively: [code]boolean powered = (top.powered || bottom.powered || left.powered || right.powered);[/code] The second uses a [i]Boolean Or[/i] to see if the wire should have power or not; if any of the four connected pieces are powered, it will be true, otherwise it will be false. [/quote] But when a wire above is powered and the power source is turned off then the wire will still be powered if there are 2 or more wires connected to it :/
  7. Hey guys BlackSun again! I have developed a game called EXTRON its basically a game in which you have electronic components (that i made up) but it has a flaw :/ The way wire works. Its tile based so it has 4 tiles next to it. This is how I want the wire to work: if a power source is hooked up to a wire then it is powered if not then it is off. how it works now: if top.power > 0 then this.power += top.power/4 then for left, right and bottom. this is a very bad way i know. I would much rather like it to be not based on power integers but based on booleans. When i tried using a boolean it stayed on when the power source was not there. If you have any answers than please tell me for i am slightly desperate. If i did not mke anything clear here then please ask me. Also: if you want to download the game and see how it works then visit my blog neutronbombstudios.tumblr.co.uk(.com) if you know any programs that already have this and source code then please tell me Thanks in advance
  8. EXTRON 2.0: 3D(in theory) electronic logic component simulator.

    [quote name='Waterlimon' timestamp='1318348788' post='4871481'] [quote name='Black Sun' timestamp='1318347141' post='4871469'] [quote name='Waterlimon' timestamp='1318275395' post='4871171'] You should make the grid less visible so it would look nicer. Also a led component might be nice, it would make a transparent circle of light about 2 cells wide [/quote] aha good idea im goind to put componets of 3*3 size. I'll see how the game looks without the grid or with it less visible and if it looks good ill do it ;) [/quote] I think the grid is needed if you want to place the components in a specific way, though if you make it a lot less visible, you could add a horizontal and a vertical line crossing at where the cursor is, to help place components to the right places. It would be annoying tho if you dont need it so it could be an option or appear when you press a key... [/quote] hmm yeah. Ive dont a lot of updating today so i probably wont do that till thursday or something. Ive made it so you can use 3*3 blocks, made saving ,loading and ive put a binary adder in also. I'll probably get round to uploading it tonight.
  9. EXTRON 2.0: 3D(in theory) electronic logic component simulator.

    [quote name='Waterlimon' timestamp='1318275395' post='4871171'] You should make the grid less visible so it would look nicer. Also a led component might be nice, it would make a transparent circle of light about 2 cells wide [/quote] aha good idea im goind to put componets of 3*3 size. I'll see how the game looks without the grid or with it less visible and if it looks good ill do it ;)
  10. Hello this is a game ive been making called extron. A little intro: Extron is an electronic logic simulatior with a small variety of logic gates and enough space to potentially build a small cpu. It has layers with sendable power if you need more space than the initial space on the 1st layer. I recommend this game to people who like electronics and thoes who like redstone in minecraft because this is inspired by redstone Intstructions in the readme file. Video for proof (older version) : [url="http://www.youtube.com/watch?v=NNSdG7SxHec"]http://www.youtube.c...h?v=NNSdG7SxHec[/url] Links: Game: http://www.mediafire.com/?19yppdgwg89u99f Blog: [url="http://www.neutronbombstudios.tumblr.com/"]http://www.neutronbo...ios.tumblr.com/[/url]
  11. Elements - PowderGame Clone - Java

    Hey guys im here to introduce [size="7"]ELEMENTS![/size] [size="2"]Elements is a client version of the popular web game PowderGame(dust). I decided to make it so i could just learn Slick and do something fun in the proccess. Things that Elements has but PowderGame Doesnt: Elements has a heat feature which can change a particles state eg: water into steam, oil into gas, ice into water. Heat passes through particles as they touch. Elements is FULLSCREEN (slickversion) Elements has a Heat, Cool feature. Elements is OFFLINE. things that PowderGame has that Elements Doesnt: PowderGame has more Particle Types. PowderGame has a map sharing feature. PowderGame has a better and faster way of doing collision etc. There are two versions of Elements 1. Slick2D version: the slick2d version is fullscreen, has better writing graphics and has the DRAG feature. the slick2d version is slower(considerably) and you have to use the right mouse button to use heat/cool. 2 JavaAWT/SWING version: Faster, Non- fullscreen, smaller size file(12kb). I would recomend the AWT version but if you want a fullscreen i would go for SLICK2D version Links: Slick2D Version: Adf.ly: [/size][url="http://adf.ly/2xTI8"]http://adf.ly/2xWzX[/url] AWT/SWING Version: Adf.ly: [url="http://adf.ly/2xOLV"]http://adf.ly/2xOLV[/url][size="2"] mediafire links are on my blog : neutronbombstudios.tumblr.com Thanks for your time. [/size]
  12. Hey guys need a favor here( Slick2d, lwjgl jar packing)

    OMG thank you so much !!! :D
  13. Hey guys. I have a game which i am very proud of. I want to send it to people so they can see it and i want to freely redistribute it also. The problem i have here is.... How do i make a .jar that uses lwjgl.jar and slick.jar... i have a folder called lib which i put the jars and natives that i use in (apart from the actual game jar) how do i run the game via .jar that uses external jars? ive tried fatjar and i get errors about the main class even though ive put the main class. I really apreciate this because if i get this to work im going to make a web portfolio and put my game on.. info about the game: it uses import org.newdawn.slick2d.*; its a clone of powder game but in my version when you heat things they change into different things. Thanks in advance
  14. SOLVED:Circle Cellular automata mating bug

    FIXED: sorry ive fixed it now changed the active thingy to fertile instead. Works fine sorry
  15. Hey guys im trying to make a cellular automation with circles that move across the screen but ive come up with a nasty bug. Heres the Source code (im using slick 2d) [code] import java.util.Random; import org.newdawn.slick.*; public class MainClass extends BasicGame{ Cell[] cell; int cellList = 1; int maxCells = 9999999; public void render(GameContainer arg0, Graphics g) throws SlickException { if(cellList > 1){ for(int i = 1; i < cellList; i++){ cell[i].Render(g); } } } public void init(GameContainer gc) throws SlickException { cell = new Cell[maxCells]; } public void update(GameContainer gc, int delta) throws SlickException { Input input = gc.getInput(); if(input.isKeyDown(input.KEY_ESCAPE)){ System.exit(0); } if(input.isKeyDown(input.KEY_SPACE)){ Random a = new Random(); int b = a.nextInt(1280); Random d = new Random(); int c = a.nextInt(800); cell[cellList] = new Cell(b,c,10,1,1,1000,Color.white); cellList++; } if(cellList > 1){ for(int i = 1; i < cellList; i++){ if(cell[i].active == true){ cell[i].AgeCheck(); cell[i].Move(); for(int b = 1; b < cellList;b++){ if(i==b){ break; } if(cell[i].Collision(cell[b]) == true){ cell[i].speedx =- cell[i].speedx; cell[i].speedy =- cell[i].speedy; cell[b].speedx =- cell[b].speedx; cell[b].speedy =- cell[b].speedy; if(cell[i].Gender != cell[b].Gender){ try{ cell[cellList] = new Cell(cell[i].x - cell[i].radius,cell[i].y ,cell[i].radius,cell[i].speedx,cell[i].speedy,cell[i].lifespan,cell[i].color); cellList++; cell[i].Destroy(); }catch(ArrayIndexOutOfBoundsException e){System.out.println("Out of bounds");} } else{ cell[b].Destroy(); } } } } } } } public MainClass(){ super("Cellz"); } public static void main(String[] args) throws SlickException{ AppGameContainer game = new AppGameContainer(new MainClass()); game.setDisplayMode(1280, 800, true); game.start(); } } [/code] [code]import java.util.Random; import org.newdawn.slick.*; public class Cell { float x,y,radius,speedx,speedy,life,lifespan; Color color; boolean active; int collidetimes = 0; boolean Gender; public void Render(Graphics g){ g.setColor(color); g.fillOval(x, y, radius, radius); } public void AgeCheck(){ life++; if(life > lifespan){ Destroy(); } } public void Destroy(){ if(active == true){ x = 0; y = 0; radius = 0; speedx = 0; speedy = 0; life = 0; lifespan = 0; color = null; active = false; System.out.println("Destroy"); } } public void Move(){ x += speedx; y += speedy; if(x > 1280){ speedx =- speedx; } if(x < 0 ){ speedx =- speedx; } if(y > 800){ speedy =- speedy; } if(y < 0){ speedy =- speedy; } } public boolean Collision(Cell c){ float xd = x - c.x; float yd = y - c.y; float sumRadius = radius + c.radius; float sqrRadius = sumRadius + sumRadius; float distSqr = (xd * xd) + (yd * yd); if (distSqr <= sqrRadius) { collidetimes ++; return true; }else {return false; } } public Cell(float x, float y, float radius, float speedx,float speedy, float lifespan, Color color){ this.x = x; this.y = y; this.radius = radius; this.speedx = speedx; this.speedy = speedy; this.life = 0; this.lifespan = lifespan; this.color = color; active = true; Random gender = new Random(); int a = gender.nextInt(2); if(a == 0){ Gender = false; }else{Gender = true;} } } [/code] So what i want to happen is when two cells that hit eachother that are a different gender a new cell is made. At the start its all well apart from when 3 cells die. when a cell dies its position is moved to 0 and all variables are set to false and such. the program only checks collision if a cell is active(boolean) and when a cell dies its active boolean is set to false. The program freezes and stops responding. I made it so when a new cell is born its x and y coordinates are printed on the screen: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 That times by alot! now i know what the problem is( the dead cells are mating eww) but i dont know how to fix it. i tried to fix it by making it so it checks collision only if active but its still bugging out. Thanks in advance