Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (428)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Game Development / Game Mechanics / Re: Attempting to separate UPS and FPS, with implemented FPS cap on: 2013-10-27 17:24:20
   Is there nobody with any advice then? I'm still not having any luck myself. Just a link to an explanation or example would be nice. Again, thanks in advance.
2  Game Development / Game Mechanics / Attempting to separate UPS and FPS, with implemented FPS cap on: 2013-10-26 19:44:50
   Hello! I've been wrestling with this small task I've been trying to overcome. I want to be able to ask the player/user what FPS he wants to limit to, and to use that. I can unlock the FPS to go as fast as it can go, or to be locked at the current UPS (Ideally, 60). The problem is, I have no idea how to do anything separate (I.E. 30, 90, 120 FPS). I've looked over tutorials, tricks, tips, and some other articles on this website, and am still uncertain as to how I would apply it to my current game loop.
   Now, I'm not sure if this should be in the "Newbie/Debugging" or here, but regardless, here's my current run loop (Pastebin + direct copy): http://pastebin.com/UX5HifrL

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  
// Run Method
  boolean isRunning = false;
   // Variables for the FPS and UPS counter
  private int ticks = 0;
   private int frames = 0;
   private int FPS = 0;
   private int UPS = 0;
   public double delta = 0;
   // Used in the "run" method to limit the frame rate to the UPS
  private boolean limitFrameRate = true;
   private boolean shouldRender;

   public synchronized void run() {
      long lastTime = System.nanoTime();
      double nsPerTick = 1000000000D / 60D;

      long lastTimer = System.currentTimeMillis();
      delta = 0D;

      while (isRunning) {
         long now = System.nanoTime();
         delta += (now - lastTime) / nsPerTick;
         lastTime = now;

         // If you want to limit frame rate, shouldRender = false
        shouldRender = false;

         // If the time between ticks = 1, then various things (shouldRender = true, keeps FPS locked at UPS)
        while (delta >= 1) {
            ticks++;
            tick();
            delta -= 1;
            shouldRender = true;
         }

         if (!limitFrameRate && ticks > 0)
            shouldRender = true;

         // If you should render, render!
        if (shouldRender) {
            frames++;
            render();
         }

         // Reset stuff every second for the new "FPS" and "UPS"
        if (System.currentTimeMillis() - lastTimer >= 1000) {
            lastTimer += 1000;
            FPS = frames;
            UPS = ticks;
            frames = 0;
            ticks = 0;
         }
      }
      stop();
   }


   I hesitate using "Thread.sleep", mostly because I don't want to break the functionality of my run loop as-is. I've been functioning on the render method being called either every tick/update, or just running all the time regardless. I guess that my question/request would be: What would be the code, or the process, to having varying FPS caps. Also, any other tips as to optimizing/using my game loop are very much appreciated. Thanks in advance!

Much obliged,
Ryan
3  Game Development / Newbie & Debugging Questions / Re: Sightlines in a Tile-Based Strategy Game (Fog of War) on: 2013-09-14 04:54:28
   Quick update: I figured it out. I was trying to fit it inside of a single for (int i = 0) loop. What I should've been doing is a nested loop for both x and y, separately.
1  
2  
3  
4  
5  
6  
7  
8  
9  
public void seeTiles(Tile tiles[][]) {
      for (int x = -viewRange; x <= viewRange; x++) {
         for (int y = -viewRange; y <= viewRange; y++) {
            if(game.getLevel().tiles[tileX + x][tileY + y] != null){
               game.getLevel().tiles[tileX + x][tileY + y].setCanBeSeen(true);
            }
         }
      }
   }

   A quick snippet from my "Entity" class. I found a separate algorithm/technique that can give a diamond-shape if I wanted. Anyways, just wanted to say that the thread can be closed.

   P.S. Link to the diamond-method can be found here: http://www.java2s.com/Tutorial/Java/0080__Statement-Control/PrintoutaDiamond.htm. Just change the "System.out.print" to the tiles that you want changed.
4  Game Development / Newbie & Debugging Questions / Sightlines in a Tile-Based Strategy Game (Fog of War) on: 2013-09-13 20:23:02
   Hello. I've been working on a side project of mine, tile-based (Easiest thing ever, right?) strategy game. I have given each "unit" a method to "see" tiles, based on a "viewRange" integer. The way that I have it set up right now is that in my "Tile" class, if a tile is not within the view range of any units, it just defaults to a gray "Fog of War" tile. Otherwise, it draws the actual tile image (Grass, Mountain, whatever).

   Anyways, I'm having difficulty setting up a loop that will take care of this automatically, and can be applied as-is without hard-coding anything specific to each "unit" type. The unit I'm experimenting with is a "scanProbe", that can has a 5-tile viewRange. My current method is to have a for loop, starting at -viewRange (To start the value of viewRange to the left/above unit), and adding 1 for every iteration. I'm then setting "tile[unitTileX + i][unitTileY + i].canBeSeen = true;". Github for more in-depth study is here: https://github.com/RyanMB97/TileBasedStrategy. Classes worth mentioning are: "Level", "Tile", "Entity", and "ScanProbe".

   A quick thanks in advance for whoever can help me solve this. Also, seems worth mentioning, but could anyone tell me how to get either a block-like view area, or a diamond-like view area? Thanks again!

P.S.: Almost forgot that a picture would probably be useful:
5  Game Development / Newbie & Debugging Questions / Re: Require aid refining a "Game Of Life"-esque project (Dead entities on the edges) on: 2013-08-23 20:17:31
   I can somewhat understand what you mean, but how would I go about implementing this? I already swapped the entities around to the 100x100 grid idea, and creating them this way. I loop from 0 to 99, which makes sense.

   The part of your reply that I don't quite understand is how I would go about changing my program from the "inconsistent" state that you mentioned. It might just be that I'm not seeing it clearly, or I'm just not looking closely enough. My current thoughts are looping the "viewSurroundingEntities" outside of the "Entity.tick" method, so that all the entities know their neighbors, and then switch the IDs depending separately. Is this what you mean?

   Anyways, thanks for the response, hopefully I can sort this out eventually.

   P.S. That Hysteresis looks interesting, and I can get a general idea of what it means, but I don't see where it can be applied to the project. I think it would fit into my "thresholdOfConversion" in the Entity class, but whatever.

   Edit: Pushed changes to Github
6  Game Development / Newbie & Debugging Questions / Require aid refining a "Game Of Life"-esque project (Dead entities on the edges) on: 2013-08-23 18:42:28
   So, I started out this project trying to get some sort of RTS similarity, but it shifting half-way through from having AI hunt each other down, to just switching IDs back and forth based on neighboring "entities" (Similar to tiles). Some problems that I have are mostly that the "entities" around the edges don't change state, regardless of whether they are surrounded by opposite-ID'd entities. This may have something to do with my using a tile system to create them, and the edges are nulls.

   Anyways, I need help just refining this thing. It's just a mini side project for my spare time, but I can't seem to grasp this one thing. My project on Github is here: https://github.com/RyanMB97/Mini-RTS. Namely, the "EntityBehaviors" class, with a little bit of entanglement with the actual "Entity" class, which is used when creating them. They're generated in the "Game" class, and rendered and ticked like normal object/tiles would in any other game/project.

   This is getting rather long, but thanks in advance for help, it is much appreciated! Also, before I forget, the reason for the "Thread.sleep(500)" is so that I can watch the changes gradually.
7  Game Development / Networking & Multiplayer / Re: Network Error with my Multiplayer Pong (First Attempt) on: 2013-06-08 15:33:39
I know about the NPE and everything, but there isn't any obvious reason for it to appear. It runs perfectly fine when using localhost during Eclipse debug-runs, but as soon as I try to connect from anywhere that's not localhost, or another computer, it throws the errors. I'm currently using Eclipse, and it doesn't give any warning or pointers to anything. Usually, asking for help is my last resort, so I'm really stuck on this one part. I double checked the way that the inputstream you mentioned is made, I it looks/seems fine to me. You wouldn't happen to have any ideas, would you?
8  Game Development / Networking & Multiplayer / Network Error with my Multiplayer Pong (First Attempt) on: 2013-06-08 15:19:50
Hello! This is my first attempt at creating an "online" game. I've created a chat client, which is actually quite easy compared to game networking. Anyways, I'm pulling some odd errors that I have no idea how to fix. Here's a Github of the project I created:
https://github.com/RyanMB97/MultiplayerPong
I also have some images:
Server Error: As can be seen, the program itself works, but the networking throws an error while listening for the client

Client Error: Program doesn't work at all, and I'm not sure why...


The "Server" is being run on my own desktop computer, and the "Client" is being run on my brother's laptop. We are connected via a WiFi signal to the router, so I wasn't sure which IP to connect to. We've been using my external, which has the port (7777) forwarded that we're using. Thanks in advance for and and all help!
9  Game Development / Newbie & Debugging Questions / Re: Need Help with Server/Client Connections (Connecting over Internet) on: 2013-05-26 19:52:24
I fixed it. Turned out that it was indeed a routing issue. I had my same friend I was trying to connect to fix it. Also, as you suggested deathpat, I also got a static IP while I was at it. Thanks for the help and everything! Much appreciated.

Very Much Thankful,
-Ryan Mitrun

P.S. I'll certainly look into it, death. Thanks for the info!
10  Game Development / Newbie & Debugging Questions / Re: Need Help with Server/Client Connections (Connecting over Internet) on: 2013-05-26 19:12:25
I haven't tried forwarding the port, but I'll definitely try that next. Already tested via normal internet connections, and Hamachi (Internet-based LAN), so that might be the issue. Here's the stack-trace:
Quote
Exception in thread "main" java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.connect0(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.Connect(Unknown Source)
at java.net.Socket.Connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at Client.handShake(Client.java:21)
at Client.main(Client.java:40)

Again, the problem line is 21. I have no idea what the rest means other that that it has something to do with the socket (Obviously). I'll try forwarding the port and see if that works. In the mean-time, any other suggestions are appreciated!

Thankfully,
-Ryan Mitrun

Modification 1: Not sure what you mean about hosting behind a router, but I'm just running it as an Executable Jar via a Batch file.
11  Game Development / Newbie & Debugging Questions / [Fixed] Need Help with Server/Client Connections (Connecting over Internet) on: 2013-05-26 17:27:16
Hello! I've recently been looking into clients and the like, and was trying to test it out with one of my friends over the internet (Because it tested fine over localhost). The weird thing is that crashes whenever he goes to enter the IP to connect to (Mine). It listens on port 7777, and here's the code. I have the server and client separate, so they have different github URLs. Here they are:

Server: https://github.com/RyanMB97/ServerStuff/
Client: https://github.com/RyanMB97/ClientStuff

According to the error message my friend sent me, it was somehow related to line 21 in Client, where I create the Socket. Any and all help is appreciated, and thanked in advance!

Thankfully,
-Ryan Mitrun

P.S. Close-Up of problem line(s):
1  
2  
3  
4  
5  
System.out.print("Enter the IP of the server you are connecting to: "); // Ask for the IP
String socketInput = input.nextLine(); // Set the socket IP to whatever they set

System.out.println("Connecting..."); // Connecting to server
socket = new Socket(socketInput, 7777); // Create a socket, connected to the server


P.P.S. The issue was port-forwarding. I just adjusted my router accordingly. Thanks for the help and suggestions anyways!
12  Game Development / Newbie & Debugging Questions / Re: Movement is acting a bit odd on: 2013-05-15 21:27:59
Sorry for the later response, just got home from a trip. Anyways, They don't vary by that much. It might just be a graphical component or just myself. Here are some read-outs:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
2.000003600087018 Up
2.000027040088614 Up
2.0000108401326906 Right
2.0000342801343614 Right
2.000021600135952 Right
2.0000198801734625 Down
2.0000072001750118 Down
2.0000306401766097 Down
2.000009040234559 Left
2.0000324802362086 Left


This is using the speed * delta stuff, hence the variety. It's not super-important, so I'm not stressing. But I'd prefer to get this out of the way, and I have no idea how to go about doing so. Again, thanks in advance.
13  Game Development / Newbie & Debugging Questions / Movement is acting a bit odd on: 2013-05-14 19:36:02
Hello! I haven't used this forum that much besides browsing, but I find myself in a bit of a spot here. In a game I'm working on, the character moves around according to "Speed * game.delta", which is what it's supposed to be. The problem (and this is mostly a preference thing) is that when my character moves either up or left, he goes slightly faster than right or down, but it might just be appearances. I was just hoping that someone might be able to help me out here.

Github to Code: https://github.com/RyanMB97/Acreage
Classes that might be at fault:
Tiles themselves (DirtTile, GrassTile, StoneTile, etc) in respective classes
Player movement (Player class)
How the level is drawn/updated (Level class)
My own coding style?

Code Itself:
From the "Player" class
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  
public void tick(Game game) {
      this.game = game;
      bounding.setBounds(x, y, width, height);
      speed = 2 * game.delta;

      worldEdgeCollision();

      movement();
   }

   private void movement() {

      if (game.input.left.down && canLeft) {
         game.xOffset -= speed;
         directionFacing = 2;
         System.out.println(speed);
      }
      if (game.input.right.down && canRight) {
         game.xOffset += speed;
         directionFacing = 3;
         System.out.println(speed);
      }
      if (game.input.up.down && canUp) {
         game.yOffset -= speed;
         directionFacing = 1;
         System.out.println(speed);
      }
      if (game.input.down.down && canDown) {
         game.yOffset += speed;
         directionFacing = 0;
         System.out.println(speed);
      }
   }


How I Render Tiles in "Level" class
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public void renderLevel(Graphics g) {
      // Tile loops
     for (int y = 0; y < game.worldHeight; y++) {
         for (int x = 0; x < game.worldWidth; x++) {
            if (tileArray[x][y].x >= game.player.x - (game.getWidth() / 2) - 32 && tileArray[x][y].x <= game.player.x + (game.getWidth() / 2) + 32 & tileArray[x][y].y >= game.player.y - (game.getHeight() / 2) - 32 && tileArray[x][y].y <= game.player.y + (game.getHeight() / 2) + 32) {
               tileArray[x][y].render(g);
            }
         }
      } // End loops
  } // End render


The rendering method itself is a bit odd, since I tossed it together on the spot. In brief explanation, it doesn't render tiles that are off of the viewable screen, plus 1 more for more seamless viewing while moving.

An example of a tile being drawn, "DirtTile" class
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
public void tick(Game game) {
      this.game = game;

      x = oX - game.xOffset; // Current x after movement, Offset, etc
     y = oY - game.yOffset; // Current y after movement, Offset, etc
     bounding = new Rectangle(x, y, size, size);
      bounding.setBounds(x, y, size, size);
   }

   public void render(Graphics g) {
      g.drawImage(game.res.tiles[tileID], x, y, game);

      if (game.showGrid) { // If the player wants to draw grids
        g.setColor(Color.WHITE); // White color
        g.drawRect(x, y, size - 1, size - 1); // Draw a border around tile
     }

      if (showBorders) { // If it is allowed to show borders
        g.setColor(Color.BLACK); // White color
        g.drawRect(x, y, size - 1, size - 1); // Draw a border around image
     }
   }


Sorry if the thread is a bit long, but this is really bothering me. Also, any advice or information to anything not of this topic is much appreciated. Thanks in advance for any and all responses!
14  Games Center / WIP games, tools & toy projects / Re: My First Game, "Spaceshooter" -Abandoned- on: 2013-03-28 03:54:30
Well, when you put it that way, I feel sort of crumby. Guess that I can pull it back into production for a day or 2 of my school vacation and patch it up to play-ability. I'd hate seeing myself as a "Well, if you do it EXACTLY like this", but then having no good examples of my own. Would be slightly hypocritical... Anyways, thanks for the "motivation" (Read: kick to the behind). Will release a "Finished" version sometime in the next 2 days to provide myself closure.
15  Games Center / WIP games, tools & toy projects / Re: My First Game, "Spaceshooter" Abandoned! Sorry! on: 2013-03-28 03:34:59
Game fell through. I just couldn't think of ways to get it further based upon my limited experience. Also, I accidentally asked for a conversion! Ignore it! I thought it was something like "Would you like to move it somewhere", then I could ask for it to be moved to archive or something like that. Again, sorry!

Anyways, game is abandoned. Hopefully, at some point in the future, I can restart the entire thing. But now, it is done with. Anyone that wishes to use the code, images, or whatever, feel free to use the github link and stuff if that's even possible. Hopefully my next project is more successful!

-Ryan
Newbie!
16  Game Development / Newbie & Debugging Questions / Re: What have been/are your learning techniques? on: 2013-03-28 03:15:40
- Why did you want to start programming? (What was your motivation?) -> I started programming in Java (First language!) because of Minecraft (Probably the most commonly used reason/inspiration) back when it was 1.6 Beta or something. Obviously, once I learned that I couldn't make a Minecraft clone in 10 seconds, I dropped it for a bit. but I eventually came back and worked my way up.

- Why did you choose to begin with the language you begun with? And if applicable, why are you using the language you are using now? -> Sorta answered that in the last one. I chose Java because of Minecraft, and afterwards because it was (To me), really simple and I was already in a Java state of mind.

- How long ago did you get started? And where are you at now? -> Started back towards MC Beta 1.6, so give or take a year or 2 (I have a HORRIBLE sense of time!). I am currently up to the state where I can make a sort-of Mario clone (With physics and stuff!)! This is counting my on-off periods of inactivity (Of which I am currently in Limbo, and out of ideas, my worst enemy).

- What learning methods did you employ personally to help you develop your skills in programming? -> Here's my primary reason for replying. My way of learning is very odd (As far as I can tell from my class mates and stuff). Other people, far as I know (Very limited, Go social life!), learn by connections, visualizations, and generally having an idea of what it does. When I learn something new, I take a while after learning a rather large chunk, and actively think on what it can do. I could summarize it as, well, stripping it to it's base form and knowing EXACTLY what it can do. This is in contrast to tutorials that have a very specific goal, and don't generalize, like "This method lets me create a rotation around the player!", but not the general principle behind it.

- What advice could you give to other programmers who might be feeling a little lost in what direction to take? -> I was SO lost, up until the past stretch of time. What you want to do is settle into a sort of... niche? Find something comfortable, camp in it a bit, and stretch it to it's full potential, then move on. This way you have a SOLID background of fall-back options if you ever get stuck. The pyramids wouldn't work upside-down, now would they? You need a strong foundation and support.

- Is there anything you believe should be a "Rite of Passage" for programmers (such as the need to create hello world, or a snake program, etc etc). -> In my brief and personal belief about programming and it's "Rite of Passage" is that there is none. There are milestones and personal achievements. Nothing else matters, really. Everything is all personal. If you like a game, and are proud of it, then you have made a "good" game (In your belief). This obviously doesn't carry over to other people. Now, I think I've not answered the question. On the topic of "Rites of Passages", I personally have made several, for lack of terms, milestones. 1)Text-Game, 2)GUI Game (Buttons, text boxes, etc. No graphics), 3)2D Simple, as in controlling a person, graphics (Non-interactive tiles, top-down are simple!), etc 4) 2D Semi-Complex, by which I mean several different things happening at once. AI, Player, Bullets, Graphics, Sound, etc 5) Not determined! This is how I rate myself. I make a game of whatever "section" I am on, and go from there. I share with friends, ask for input, and program it to my liking. Anything else is moot, because if you aren't motivated to finish a "finished" project, then nothing will budge and it's done, because you like it as-is.

In general, programming (or coding) is what you make of it. If you are motivated, you can do pretty much anything with the right tools and experience (Plus advice, of course!). I believe that Edison is a perfect example in this case, "I have not failed 1000 times, but simply found out 1000 ways that it doesn't work." This occurs plenty of times in programming, where you're just throwing hands in the air and wondering why you even started this. Motivation, advice, and experience helps you power through this.

Now, I could probably turn this into an essay, but I hope that I've explained myself adequately and hope that I haven't missed something insanely obvious, or over-did anything. I'm still pretty self-conscious of these sorts of things, being such a wonderful social butterfly [/sarcasm].

-Ryan
Newbie!
17  Games Center / WIP games, tools & toy projects / Re: My First Game, "Spaceshooter" on: 2013-03-08 23:03:30
Oh, I didn't know that! I just that that the delta worked for the entirety of the program. I saw your post and was like, "Don't I have that in my run method?". But what your saying is that I should have, instead of i.e. "x += movespeed", I should change it to "x += movespeed * Game.delta" or somesuch? Also, thanks for the feedback and code scanning for me Cheesy!
18  Games Center / WIP games, tools & toy projects / Re: My First Game! on: 2013-03-08 21:43:52
Hooray, got more stuff! Mostly front-end and pretty, but the code is being pretty lazy and disorganized (Not me, of course. It's the codes fault!) So, I'll give you the links and info and stuff:

Sendspace Download Link V1.2(Alpha): http://www.sendspace.com/file/bq8b5o

Update-Log:
V1.2 (Alpha) [3/8/2013]:
-Added a "Laser Bolt", deals 2 damage to enemies
-Added enemy health
-Limited Torpedos (1-shot kills, 5 total, 1 shot per second limiter)
-Enemy ship graphics
Todo:
-Add a UI besides the "Debug"
-User Options/Settings?
-Levels/Stages
-Clean and Organize code, big mess that it is.

As usual, ideas, opinions, and feedback is much appreciated. I also commit all of my "Versions" and major changes to Github, which the link is the first post. Also, quick question, how do you think I should go about doing a store/UI? Opinions appreciated!
Modify: Another question, any tips on how I'd turn this into a browser applet? Either I suck at Google, or I'm picking the wrong links =/
19  Games Center / WIP games, tools & toy projects / Re: My First Game! on: 2013-03-06 02:40:09
Thanks for the feedback! Also, I wanted to thank specifically your suggestions and that your points are very good. I will start with saying that I should probably have not uploaded that picture in particular, it is slightly misleading. I've also got to ask, but did I forget to add the "readme" to the folder? I thought that I had written one up real quick and tossed that in with it. But anyways, if you wanted to see the "debug" info, it's F3. Hope I'm not going on too long, but thanks for the feedback. We certainly have a few things planned (If even for such a small game), and I hope that we manage to finish it to the point that we want it to be!
20  Games Center / WIP games, tools & toy projects / My First Game, "Spaceshooter" on: 2013-03-06 02:10:20
Hello! I'm Ryan, and I've been working on my first "game" over the past weekend. After countless "projects" started, and forgotten along the highway, I've decided to scrap any and all ideas of being super-fancy, and I've settled into a sort of "Space Invader" sort of game. Very simple, just me and a friend or 2 working on a small project.

Anyways, onto the actual game! I've titled it, quite elegantly, I might add, SpaceShooter! It was officially started Friday, March 1st, 2013. I just thought I'd do it myself over the weekend, almost like a personal game-jam. But my graphics sucked, my code was patchwork at best (Still is, actually!), and I didn't like it one bit. So, I rang up some friends on Skype, and got cracking. It was pretty much done by Sunday, but then we (Skype friends and I) got a fresh wave of ideas. So, I bring you, V1.0, the not-quite-Alpha version!

Links
Github (For the paranoid): https://github.com/RyanMB97/SideScroller.git
Sendspace Download Link V1.0(InDev): http://www.sendspace.com/file/fdw674
Sendspace Download Link V1.1(Alpha): http://www.sendspace.com/file/4nd9v5
Sendspace Download Link V1.2(Alpha): http://www.sendspace.com/file/bq8b5o

Realized that I never got around to creating a list of what we plan on doing! Here goes...
  • More Graphics (For enemies)
  • Background music (Self-created) of the 8-bit kind
  • Another/More weapon(s)
  • Upgrades (Later on, after game is more polished, think "Beta")
  • Sound effects in general
This is obviously not the complete list of ideas, or the final one. Hopefully we can manage to get most of these added. Open to suggestions!

Update-Log:
V1.2 (Alpha) [3/8/2013]:
-Added a "Laser Bolt", deals 2 damage to enemies
-Added enemy health
-Limited Torpedos (1-shot kills, 5 total, 1 shot per second limiter)
-Enemy ship graphics
Todo:
-Add a UI besides the "Debug"
-User Options/Settings?
-Levels/Stages
-Clean and Organize code, big mess that it is.

Ideas, Opinions, and General feedback is much appreciated!
Important
There is a "Readme" file inside with controls and info, read it Tongue!

Changed the Image [10:52PM 3/5/2013] [3:37PM 3/8/2013]
21  Game Development / Newbie & Debugging Questions / Re: Need some minor help in fixing/implementing some code! on: 2013-03-03 14:19:32
JESTERRRRRR, you are amazing! Thanks for pointing that out, I feel like an idiot now for not realizing that Tongue. Thanks to everyone else who responded, I'm sure that if Jester hadn't posted, I'd have been able to do it with one of your methods. Thanks a bunch Cheesy.
22  Game Development / Newbie & Debugging Questions / Re: Need some minor help in fixing/implementing some code! on: 2013-03-03 01:40:54
That's not the issue. Both the mobs and "bullets" are moving 1 pixel per tick, tied into the main game loop. I can clearly see the bullets going through the mobs, but not colliding. The bullet is physically inside of the mob, and it's not destroying itself. The strange thing is that some of the mobs DO destroy themselves, while the bullet just skips through others.
23  Game Development / Newbie & Debugging Questions / Re: Need some minor help in fixing/implementing some code! on: 2013-03-03 01:33:53
Right, sorry! My main problem is getting the collision to work. For some reason, the bullets will collide with 1 or 2 of the mobs, but not the others. The thing is, it should be checking against every single last one of the mobs/bullets for collisions. Here's the spot in focus:

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  
Iterator<Bullet> bulletIterator = bulletList.iterator();
      Iterator<Mob> mobIterator = mobList.iterator();

      while (bulletIterator.hasNext()) {
         Bullet bullet = bulletIterator.next();
         bullet.tick();
         if (!bullet.living) {
            bulletIterator.remove();
         }
      }

      while (mobIterator.hasNext()) {
         Mob mob = mobIterator.next();
         mob.tick();
         if (!mob.living) {
            mobIterator.remove();
         }
      }

      bulletIterator = bulletList.iterator(); // Re-creates the bullet iterator after removing dead bullets
     mobIterator = mobList.iterator();// Re-creates the mob iterator after removing dead mob

      while (bulletIterator.hasNext()) {
         Bullet bullet = bulletIterator.next();
         while (mobIterator.hasNext()) {
            Mob mob = mobIterator.next();

            if (bullet.intersects(mob)) {
               mob.living = bullet.living = false;
               System.out.println("Intersection!");
            }

            if (!mob.living) {
               mobIterator.remove();
            }
         }
         if (!bullet.living) {
            bulletIterator.remove();
         }
      }


Like I said, it's only colliding with some of the mobs that appear, and going completely through other mobs when it should be "Destroying" them.
24  Game Development / Newbie & Debugging Questions / Need some minor help in fixing/implementing some code! on: 2013-03-03 01:27:52
Hello! I'm relatively new to the Java scene, but I've studied most of the important stuff, how it works, etc. This is my first "Game", as in with animations/sprites/what have you. I'm having a bit of trouble implementing my "kill mobs" style.

In brief, I have a "bullet" arraylist (of bullet objects, obviously), and a mob arraylist. In my "tick" method, I have iterators that are ticking and checking for collisions. The ticking works, but the collision doesn't. Me and one of my friends have been puzzling over this the past day or 2, and we're no closer to finding out what's wrong. So, I thought of asking you guys for help!

Here's the github link: https://github.com/RyanMB97/SideScroller.git and thanks in advance Cheesy
P.S. The problem is in the "tick" method of "Game".
25  Game Development / Shared Code / Re: Just a 2D Beginners code for sharing on: 2012-03-27 01:33:07
Oh, really? No wonder it was screwing with me during test-driving. I knew  I had to toss it back to 0 for the next row. Time for experimentation Evil
26  Game Development / Shared Code / Just a 2D Beginners code for sharing on: 2012-03-27 01:29:21
Hello! I know I'm new and have only a few posts, but I wanted to be more active and post more, so I think i'll post some of my beginner/nub code! I've been coding in Java(General) for ~2 Months, and only beginning to get into 2D stuff more recently (Past 2 weeks or so). I've been following some 2D animating/coding tutorials, but they just don't make sense until I find some way to simplify and understand them. I like my code for reflecting simplicity. This will probably change though. Without further ado, here it is!

Finding you Character (The most simple, focused AI I know of)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
public void findCharacter() {
      int xChar = 0; // The x Position for the Character (Used when comparing changes/data for the zombie to follow)
     int yChar = 0; // The y Position for the character (Used when comparing changes/data for the zombie to follow)

      int xZombie = 0; // The x Position for the Zombie/Enemy (Used when painting the image/rectangle)
     int yZombie = 0; // The y Position for the Zombie/Enemy (Used when painting the image/rectangle)

      int moveSpeed = 1; // How fast to move towards character (Pixels)

      if (xZombie < xChar) {
         xZombie += moveSpeed;
      }
      if (xZombie > xChar) {
         xZombie -= moveSpeed;
      }
      if (yZombie < yChar) {
         yZombie += moveSpeed;
      }
      if (yZombie < yChar) {
         yZombie += moveSpeed;
      }
   }


There's also my Tile-Setter system Tongue
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
public void TileSystem() {

      int Width = 640;
      int Height = 480;
     
      int x = 0;
      int y = 0;

      int tileSize = 32; // How large the tiles are
     int rowTiles = 25; // How many tiles to put into a row (Width / tileSize)
     int columnTiles = 20; // How many tiles/rows to put into a column (Height / tileSize)

      for (x = 0; x < Width; x += tileSize) { //
        for (y = 0; y < Height; y += tileSize) { //
           x = 0;
         }
      }
     
      System.out.println("X: " + x + "Y: " + y);

   }

//Note: I had to re-write this off the top of my head, since I didn't feel like going across the room to grab my flash-drive which I keep all of my good Java Tid-Bits on. I think I screwed up somewhere Tongue

After-Post #1 - Screwed up the tile-rendering thing. It's an infinity loop. I'll try to fix it while still working and then pastah back.

Just some beginner's code! Hope I can develop a better organizational skill and also the ability to actually write this stuff better. 2D Animation is fun until you actually try to make it Tongue
27  Java Game APIs & Engines / Java 2D / Re: Painting problem & Creating more than 1 "enemy" on: 2012-03-23 23:54:47
Thanks for your help! I got most of the stuff fixed. Now I just have to look up a few bits and pieces. Thanks again Tongue
28  Java Game APIs & Engines / Java 2D / Re: Painting problem & Creating more than 1 "enemy" on: 2012-03-23 23:28:04
Okay! I just want to say first that I don't know how to go about creating the ZombiesArray. Is there any chance you have an example for me to study? Also, here's my code in Pastebin: http://pastebin.com/7cnJ4Xf7. Thanks in advance for help Cheesy
29  Java Game APIs & Engines / Java 2D / Painting problem & Creating more than 1 "enemy" -Fixed/Answered- on: 2012-03-23 22:07:32
Hello! First off, I got this problem. I am currently using a drawLine to create a "laser". I have an "anchor-point" set up in the middle of my character (at the moment a box). Whenever I click, it shoots and when I release it goes back to the middle. However, if I move, it still points to my previous location from when I released the button. Here's the code:

This was intended as a stop-gap to see if I could fix it.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public void Shooting() {
      while (!SHOT) {
         xLaserDest = xLaserAnchor;
         yLaserDest = yLaserAnchor;
      }
      while (SHOT) {
         xLaserDest = xCoordinate;
         yLaserDest = yCoordinate;
      }
   }

My MouseListener stuff:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
class Mouse extends MouseAdapter {
      @Override
      public void mousePressed(MouseEvent e) {
         int xCoordinate = e.getX();
         int yCoordinate = e.getY();
         xMouse = xCoordinate;
         yMouse = yCoordinate;

         xLaserDest = xMouse;
         yLaserDest = yMouse;

         SHOT = true;
      }

      @Override
      public void mouseReleased(MouseEvent e) {
         xLaserDest = xChar + 16;
         yLaserDest = yChar + 16;

         SHOT = false;

      }
   }


My "run" method:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public void run() {
      try {
         while (true) {
            FPS.tick();
            move();
            zom.FindCharacter();
            Thread.sleep(10);
         }
      } catch (Exception e) {
         System.out.println("Error");
      }

   }

and finally my "Paint" and "PaintComponent" methods:
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  
public void paint(Graphics g) {
      dbImage = createImage(getWidth(), getHeight());
      dbg = dbImage.getGraphics();
      paintComponent(dbg);
      g.drawImage(dbImage, 0, 0, this);

   }

   public void paintComponent(Graphics g) {

      xLaserAnchor = xChar + 16;
      yLaserAnchor = yChar + 16;

      g.drawImage(backImage, 0, 0, this);
      g.drawImage(charImage, xChar, yChar, this);
      g.drawImage(zombieImage, zom.xZombie, zom.yZombie, this);

      g.setColor(Color.YELLOW);
      g.setFont(font2);
      g.drawString(Controls, 90, 40);

      g.drawString("MoveSpeed: " + moveSpeed, 480, 40);

      g.setColor(Color.YELLOW);
      g.setFont(font);
      g.drawString("FPS: " + FPS.FPS, 5, 40);

      g.setColor(Color.YELLOW);
      g.drawLine(xLaserAnchor, yLaserAnchor, xLaserDest, yLaserDest);

      repaint();
   }


Another thing I want to do is create more than 1 "Zombie". I do not know how to do this at my current level, and Google hasn't helped much on this issue. If you could help me out here, I'd be eternally grateful Cheesy. Please don't hesitate to ask for my entire source-code, I really want to get this thing working Tongue

-Java Newbie,
Ryan
30  Game Development / Newbie & Debugging Questions / Re: Problem with creating multiple "Zombies" on: 2012-03-20 03:03:01
Thanks for the nudge. I think I got the right idea. Thanks!
Pages: [1] 2
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (79 views)
2014-04-15 18:08:23

BurntPizza (70 views)
2014-04-15 03:46:01

UprightPath (82 views)
2014-04-14 17:39:50

UprightPath (66 views)
2014-04-14 17:35:47

Porlus (82 views)
2014-04-14 15:48:38

tom_mai78101 (106 views)
2014-04-10 04:04:31

BurntPizza (166 views)
2014-04-08 23:06:04

tom_mai78101 (262 views)
2014-04-05 13:34:39

trollwarrior1 (212 views)
2014-04-04 12:06:45

CJLetsGame (221 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!