Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
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 3 ... 15
1  Game Development / Newbie & Debugging Questions / Re: Simple Tilemap from Image file noob question :D [HELP NEEDED] on: 2013-05-25 03:00:13
I'd really want to help, but I cannot figure out how that 4x2 red + green image was rendered into what looks like grass and stone Huh

Wrong picture was uploaded my bad ^_^

Well thanks for the help guys, I was hoping to get a snippet / link reply (Thinking this is a common method like loading tiles from a text file)

I'm going to try loading tiles from a text file tonight :3
2  Game Development / Newbie & Debugging Questions / Re: Simple Tilemap from Image file noob question :D [HELP NEEDED] on: 2013-05-24 22:44:54
If somebody could direct me to a guide on how to load a tile map from a Image that would be great!!
3  Game Development / Newbie & Debugging Questions / Re: JFrame, JPanel, JLabel issues on: 2013-05-24 07:02:09
(You just had the order of things wrong)

It should go like:
1  
2  
3  
4  
5  
6  
7  
8  
9  
   public Main() {
      setTitle("PoQuest");
      setSize(w, h);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      add(World.jp);
      pack(); // Pack the frame after adding all the components.
     setVisible(true); // Finally, set the frame visible.
     setLocationRelativeTo(null); // Will center the frame after setVisible(true) is called.
  }


How it's 'usually' done:
1. Create the frame (Title, size, resizing etc..)
2. Add components to the frame (JPanel, JButton etc..)
3. Pack the frame.
4. Set the frame visible.
5. (Set the location relative to null after visible for it to center)

By the way, it's a good practice to call super("TITLE") in the constructor of a class that extends the JFrame.

It would also be a good idea to create a Instance of the World.Java class instead of just adding the JPanel 'jp' staticly.
(Prevent future errors like variables not getting instantiated)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public Main() {
// prior to creating the JFrame..
  World world_instance = new World();

// initialize the JFrame...

// add the jpanel to the JFrame
  add(world_instance.jp);

// pack the JFrame, setVisible etc..
}
4  Game Development / Newbie & Debugging Questions / Re: Simple Tilemap from Image file noob question :D on: 2013-05-24 05:53:50
I got it >...<

I wasn't scaling the texture * 32 Angry
1  
2  
3  
4  
5  
6  
7  
      for (int x = 0; x < mapImgW; x++) {
         for (int y = 0; y < mapImgH; y++) {
            if (tiles[x][y] == 1) {
               g2d.drawImage(image_tiles[2].getImage(), x * 32 + mapX, y * 32 + mapY, tileW, tileH, null);
            }
         }
      }

Never mind, the above works but I'm still having issues with reading the map data properly and rendering it properly.

At the moment my map .PNG file looks like (A simple 4x2 .PNG):
[R][G][R][G]
[G][R][G][R]
http://i41.tinypic.com/33ayoaw.png

And I cannot manage to:
Load the data properly, and store it in my tile array.
-or it's-
Rendering the data incorrectly.

Here is what is rendering at the moment (incorrect):
5  Game Development / Newbie & Debugging Questions / Re: Simple Tilemap from Image file noob question :D on: 2013-05-24 05:36:20
The way I'm reading it, you're loading an image and rendering all of the green pixels on to the screen... Do I understand your code right? Is that what's happening now?

At the moment yea ^_^, I'll add other colors after green (Grass Texture) is working.

If yes, what did you want to do again, if not that? Smiley

I haven't found a way to implement it lol, that's the point of this thread =D

I'd like some pseudo code or advice on how to implement:
Reading a Images pixels, if one's a certain color render a Texture on the map that corresponds to the pixels color.

I'm not familiar with ImageUtils.getPixelsFromBufferedImage() btw... where did you get that?

It's from a little 'toolkit' I made Smiley
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   /**
    * Scans the BufferedImage provided to obtain the pixel[] data.
    * @param imageToScan The BufferedImage to scan for pixels.
    * @return The pixel[] array.
    */

   public static int[] getPixelsFromBufferedImage(BufferedImage imageToScan) {
      final int width = imageToScan.getWidth(null), height = imageToScan.getHeight(null);
      final int[] rgbs = new int[width * height];
      imageToScan.getRGB(0, 0, width, height, rgbs, 0, width);
      return rgbs;
   }


Notes:
Tiles are 32x32.
6  Game Development / Newbie & Debugging Questions / [SOLVED] Simple Tilemap from Image file noob question :D on: 2013-05-24 05:07:58
Hello JGO, bringing forth a rather nooby question tonight but I'm in need of help Grin

Lets say I have a Image that's 2x2 and each pixel is colored green.

I want to scan the picture and detect if the pixels green. (completed)
I'd than like to render a tile which corresponds with the data in the image.

The problem I'm having is actually rendering on my map based off of the read data.

At the moment this is how I'm loading the map:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
   public void preInit(double currentPercentage) {
      if (!loaded) {
         /* ...... */
         /* Map Loading */
         int[] pixels;
         try {
            final BufferedImage img = ImageIO.read(new File("res/textures/terrain/map_1.png"));
            final int width = mapImgW = img.getWidth(null);
            final int height = mapImgH = img.getHeight(null);
            tiles = new int[width * height];
            pixels = ImageUtils.getPixelsFromBufferedImage(img); // Correctly obtains pixels[]
           final int green = -14503604; // Green ^_^
           for (int i = 0; i < pixels.length; i++) {
               if (pixels[i] == green) {
                  tiles[i] = 1; // Assign the tile type, 1 = green(grass)
              }
               //System.out.println("Number at slot " + i + " is: " + pixels[i]);
           }
         } catch (IOException e) {
            e.printStackTrace();
         }
         loaded = true;
      }
   }


If anybody could advise me on how I'd go about rendering the tiles please let me know ^_^, I've never done this before and I'm kinda stuck ATM ;o
7  Games Center / WIP games, tools & toy projects / Re: [WIP] 2d RPG with no name... on: 2013-05-23 23:31:49
Wow this looks great mate, I dig these types of games haha
8  Game Development / Newbie & Debugging Questions / Re: KeyListener on an Array (2D Dungeon Crawler) on: 2013-05-17 09:11:14
It looks like you did not add the KeyListener (key pressed / released methods) to the Frame.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
      /* erzeugt das Menüfenster mit zwei Buttons und einem Label */
      public static void Menufenster() {  
         
         // .....
       
         /* Eigenschaften des Menüfensters (Größe, Schließbar, mittig setzen,..) */

         // .....

         F.addKeyListener(new KeyListener() {
            public void keyTyped(java.awt.event.KeyEvent e) { /* do nothing */ }
            public void keyReleased(java.awt.event.KeyEvent e) { /* do nothing */ }

            public void keyPressed(java.awt.event.KeyEvent e) {
               if (e.getKeyCode() == KeyEvent.VK_LEFT) feld1[i][j] = feld1[i - 1][j];
               if (e.getKeyCode() == KeyEvent.VK_RIGHT) feld1[i][j] = feld1[i + 1][j];
               if (e.getKeyCode() == KeyEvent.VK_UP) feld1[i][j] = feld1[i][j - 1];
               if (e.getKeyCode() == KeyEvent.VK_DOWN) feld1[i][j] = feld1[i][j + 1];
            }

         }); // End KeyListener
       
         // .....
     }
9  Game Development / Newbie & Debugging Questions / Re: Text based combat system trial (Java) on: 2013-05-15 20:57:29
I wonder, how did you not know this before now?

Lol guys.

"Assume" = Ass + U + Me.

How that happened:
"Hmm, variables aren't being updated, lets just throw them in the while loop during my TRIAL."

This is a 100% random trial that's been scrapped numerous times lol, I really don't need code performance critique regarding a 1 second trial.

(Literally a 1 second test)

Thanks though ^_^
10  Game Development / Newbie & Debugging Questions / Re: Text based combat system trial (Java) on: 2013-05-15 11:41:09
Thanks alot roquen seems like what I need, only skimmed over it as it is 2:40AM Tongue
I'll check it out tomorrow.

In the meantime here's my attempt so far:
Only thing working so far is the accuracy / chance % to hit.
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 CombatTest() {
      int i = 0;
      double[] accuracyMarks = new double[100];

      while (i < 100) {
         /* Player */
         double combatLevel = 0;
         double attack = 99;
         double defence = 1;
         double strength = 1;
         double health = 10;
         double accuracy = 1;
         double weaponAccuracy = 1.0;
         
         /* Enemy */
         double enemyDefence = 77;
         double enemyHealth = 10;
         
         /* Formulas */
         combatLevel = getCombatLevel(new double[] { attack, defence, strength, health });
         attack = attack * (100 / enemyDefence);
         accuracy += attack * Math.random() ;
   
         if (accuracy > 100) { accuracy = 100; }
         accuracyMarks[i] = Math.floor(accuracy);
         
         int chance = (int) accuracyMarks[i++];

         System.out.println("Accuracy = "+chance+".");
      }
      debug(accuracyMarks);
   }


Snippet from the output:
(99 Attack Vs. 77 Defence)
Quote
Accuracy = 100.
Accuracy = 4.
Accuracy = 93.
Accuracy = 39.
Accuracy = 47.
Accuracy = 47.
Accuracy = 100.
Accuracy = 92.
Accuracy = 98.
Accuracy = 97.
Accuracy = 72.
Accuracy = 100.
Accuracy = 100.
Accuracy = 100.
Accuracy = 100.
Accuracy = 12.
Accuracy = 1.
Accuracy = 16.
Accuracy = 47.
Accuracy = 44.
Accuracy = 26.
Accuracy = 100.
Accuracy = 17.
Accuracy = 48.
Accuracy = 100.
Accuracy = 16.
Accuracy = 31.
Accuracy = 95.
Accuracy = 100.
Accuracy = 100.
Accuracy = 4.
Accuracy = 14.
Accuracy = 68.
Accuracy = 75.
Maximum accuracy: 100.0.
Minimum Accuracy: 1.0.
Most Common Accuracy: 100.0.

And this will be goodnight, looking forward to criticism on the above code ^_^
I know it's coming xD
11  Game Development / Newbie & Debugging Questions / Text based combat system trial (Java) on: 2013-05-15 07:30:12
Hey JGO ^_^, haven't been on for a while Cheesy (Few months i believe)
Nice to be back Roll Eyes

I (tonight) decided to try to make a fair combat system which will include:
  • Weapons (Accuracy Modifiers)
  • Level System (Attack, Strength, Defence, Health)
  • Simple Combat System (Melee)

I'll be attempting to add the following to the combat system (this is where I need a little help):
  • A chance to hit formula
  • A chance to block formula
  • A damage formula

To be honest I haven't gotten too far yet lol.

I've slowly been developing on it for the past half our or so, but I figured I'd ask for help before I begin furiously 'tweaking' with the percentages to in some UN-profound way Tongue

The reason why I'm posting this is I'd like to get some information / tips on how to go about calculating the accuracy percentage, the blocking chance and damage dealt etc.

Side information:
Accuracy (Tier/Level 1 weapons) = 1.0
All levels will be level 1 @ first (ATK/STR/DEF) and the health will be 10, all having 99 as maximum.

Any feedback would be great guys thanks ^_^
12  Games Center / WIP games, tools & toy projects / Re: Lunar Rescue on: 2013-03-08 02:20:26
That was fun, I love those type of games man.
I'll keep checking in on the progress ^_^
13  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-08 01:20:32
For those wondering why certain threads spiral out of control, I'll leave you with these words of wisdom:

The distribution of intelligence is fair, as everybody thinks they have more than enough.

I realized that may be one of my problems lol.
I tend to talk in a some what programming savvy way since JGO is programing related (As I assume many others do), maybe that's where the 'unintended sarcasm' appears.

Anyhow, returning to the thread.
Feedback's still welcome guys.
14  Java Game APIs & Engines / OpenGL Development / Re: Terrain gen on: 2013-03-08 01:12:16
Fog is making my terrain black

I don't know how you implemented the fog.

When I implemented fog into my 3D game I was using JMonkeyEngine.
So they had methods to lessen the thickness of the fog, change the color and distance of the fog etc.

Only thing I can think of at the moment is: you have no lights in the 3D scene.
(Why the terrain would be showing up black)

Or the fog is in a state I've never been able to see.
(Doesn't have a thickness level set, doesn't have a starting / ending distance set)

No biggie if you can't get the fog to work mate.
Just something I heard online, I can't back it up myself as I've done no benchmarking on it.
15  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-08 00:58:40
I'm sorry.  I didn't understand the post and then responded to what I thought it meant when I didn't know.  I didn't mean to ruin your thread at all.  I'm really sorry.

@Sammidysam:
Oh no you're fine mate.
Literally just about every legit thread I make someone accuses me of being a smart ass, or accuses me of involving 'indirect criticism'.
All I do is post source code, rate games, publish games and help newbies on JGO.

None is intended guys, It's the internet. Tongue
Sorry for any confusion Stare
16  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-08 00:50:39
Thanks sammidy.

Why does someone always have to start some shit on my threads Kiss Kiss
I said I was accepting code/algorithm criticism Pointing, I'll update my signature to inform people not to interpret me as an asshole I guess.

Either I am a smart ass.... or these guys just love getting that post count up:


What people have addressed as being a errors so far:
Unnecessary object creation.
Unnecessary stored computations.
Using a StringBuffer/StringBuilder instead of using byte[]-s.

Thanks guys, any more performance improvements / code criticism feel free to post them Cheesy
17  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-08 00:40:53
I believe he was saying that my questions were Socratic method and that you saying "unless you're being a smart ass" is patronizing those who use it (me, apparently).  He was not saying that your explanations weren't enough.
What I meant by unless you're being a smart ass was:
I didn't understand if your positive reply "Sammidysam" was filled with sarcasm etc, so i asked if it was.

I'm sorry, my reply was right below your reply I thought that was enough to signify it was @ you (Even responded to your remark).
Next time I'll add @Username: before addressing someone with a remark so people don't get confused XD
My baaad.

18  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-08 00:21:18
EDIT: @pjt33:

By the way, do you patronise everyone who tries to help you using the Socratic method?

Quote
The Socratic method (also known as method of elenchus, elenctic method, Socratic irony, or Socratic debate), named after the classical Greek philosopher Socrates, is a form of inquiry and debate between individuals with opposing viewpoints based on asking and answering questions to stimulate critical thinking and to illuminate ideas. It is a dialectical method, often involving an oppositional discussion in which the defense of one point of view is pitted against the defense of another; one participant may lead another to contradict himself in some way, thus strengthening the inquirer's own point

I don't really understand you mate.

It seems like you didn't understand what I was posting.
So I posted some code, that didn't help. Undecided
So I posted the whole code, that didn't help. Kiss
So I posted a in depth explanation. Roll Eyes

And I get accused of patronizing lolz. Stare

I'm sorry man, I wasn't trying to be-little you if that's how you took it.
You didn't seem to understand it how the program was coming up with its computations... so I attempted to explain it to you.
19  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-08 00:12:06
I'd like to say.... persecutioncomplex persecutioncomplex persecutioncomplex
serious optimization going on

@Sammidysam:
I love optimizations and algorithms.
Thanks for the feedback man, unless you're being a smart ass...
Makes me feel good to get some positive feedback regarding something I programmed Smiley

(I've never used python so I can't compare the two performance wyse)
20  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-07 23:47:19
@VeaR:
Thanks for the feedback mate, this program was literally thought up overnight.
If you can find a version like mine where the recursion is literally hand programmed and it works, let me know XD
Regarding unnecessary object creation and transferring to byte[]-s instead of using a String Buffer thanks.
That's the type of feedback I was hoping to get Smiley

@pjt33:

I've written enumerations of various combinatorial structures. One useful question to ask yourself is: can I define a canonical order such that there's a straightforward next() method? In this case, the canonical order is fairly straightforward, so the question is: given "prabkqdtxczz" how would I create the next string, "prabkqdtxdaa"?

I explained the algorithm mate:
#1: Start with: prabkqdtxczz
#2: Next up is: prabkqdtxdaa
#3: After that is: prabkqdtxdab
#4: After that is: prabkqdtxdac
etc.

Here's a somewhat in depth explanation:
On #1 it will detect the z in the last slot.
It will treat that z as the last slot in the alphabet array.
If it is the last slot in the alphabet[] array (which it is) it will -1 in the password index (move back one slot), change the z to the beginning element of the alphabet[] array.
Next it will detect the z 1 slot before the slot we just changed from z to a.
Since the second to last slot we're dealing with here is also a z.. basically repeat the process we performed for the last z.
(Change the z to a, -1 in the password index, process it from a-z)

Hope it makes sense mate, it's a algorithm.
Kind of hard to explain them :/

Program one, or run one of the C# implementations i translated to Java and you will see how it comes up with its computations.
(You'll have to implement printing out the current computation as it's not added in the examples above)

Here's the first version of this I came up with overnight, this one involves no StringBuilders:
http://pastebin.com/Mm2LLUn4 (V0.1)
21  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-07 23:35:58
Well, I ran across a C# implementation of brute forcing with 'recursion'.
Ran some benchmarking before I went to bed and the results came back: recursion IS faster than no recursion.

Console output between recursion method and no recursion:
Quote
-------------------------------------------------------------------------------
possible: 11,881,376
---- beginning recursion ----
Recursion Solved: ZOOSK.
Recursion Completed: 11,680,407
Recurion Took: 1,946ms.
---- beginning no recursion ----
No Recursion Solved: ZOOSK.
No Recurion Completed: 11,680,407
No Recurion Took: 11,669ms.
-------------------------------------------------------------------------------

Recursion C# implementation translated to Java:
(Word 'zoosk' takes 1,420ms to 2,000ms)
1  
2  
3  
4  
5  
protected final void recursion(String pwd, int pos) {
   if (pos < passLength) {
      for (char ch : charTable) recursion(pwd + ch, pos + 1);
   }
}


No Recursion C# implementation translated to Java:
(Word 'zoosk' takes 8,400ms to 12,000ms)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
protected final void noRecursion(int possible) {
   int done = 0;
   for(int i = 0; i < possible; i++){
      String theWord = "";
      int val = i;
      for(int j = 0; j < passLength; j++){
         int ch= val % chars.length;
         theWord = chars[ch] + theWord;
         val = val / chars.length;
      }
      done++;
   }


My implementation of this which was literally 'thought out line by line' is just a few hundred milliseconds slower than the C# recursion.
Mind you mine involves no recursion. Tongue

I found the C# implementations for brute forcing on some college PDF.
I'll be doing some more benchmarking on the C# recursion implementation translated to java Vs. my current implementation of long for loops today Smiley

I was stunned to find that PDF!
Than see that my 264 lines of code (Processes any password up to 11 slots) could be wrapped into 6 lines of code with something called 'recursion', and it handles unlimited password lengths LOL

I've never really messed with recursion before Tongue
22  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-07 09:29:59
What on Earth are you actually trying to do?
1  
2  
3  
4  
5  
      case 2:
         for (a = 0; a < target_query_types.length; a++)
            for (ab = 0; ab < target_query_types.length; ab++) {
               COMPUTATED_DATA[a] = (new StringBuilder(String.valueOf(appendLetter(a)))).append(appendLetter(ab)).toString();
               if (password.equals(COMPUTATED_DATA[a])) {

You build a string, store it in an array for no obvious reason, and then compare it to another string. What does this accomplish?

Hey thanks, there's no need to store the computation if it isn't going to return true with the computation needed, discard it and keep moving Grin Grin

I don't know if you've programmed one of these before lol.
If you haven't programmed one without recursion (I have no idea how I thought about programming this, just figured id go aaa, aab, aac and hey it worked!) you'll find yourself doing it like I'm doing at first. (No salt / no hash)
Enter a password, text your algorithm.

If I wanted to implement hashing and salting etc I could, I'm actually deciding to do something with this project so It's version 0.4 at the moment.

Developing Version 0.5 right now:
http://oi45.tinypic.com/2e68twk.jpg
-
http://oi50.tinypic.com/15rxnyt.jpg
(Major performance fixes, using custom swing workers and cache mapping, major database updates (lists etc))
What on earth am I trying to do?

lol, my version turned out around 23 times faster than the guy who posted his version of it in java with recursion.
Everywhere I read, recursions usually the first and best option.
I'm sorry, half the time when I'm writing code I don't understand what I'm writing, there's a complex chunk of machine code that needs to be written XD and I actually figured this one out so.. I'm happy.

Maybe the code's just not comprehend-able due to the unnecessary object creation / checking etc.
Sorry for the long reply Tongue

Here's the output if you want to see it:
(Brute forced the word 'test')
http://filebin.ca/ZM7u3fGQzZA/dump.txt (1.92MB Pure text)
23  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-06 01:00:09
That's great man thanks, I only had commons of 2012 XD
I need to figure out how to literally 'Load A Dictionary' efficiently.
Don't want to wait 30+ minutes to read the .txt file >..<

Off topic to the post but, any tips for how I should handle my dictionary?
Dictionary.txt file composed of one word per line.

Should I shoot for file shrinking?
Definitely be upgrading to a byte_buffer.
Any feedback would be great thanks.

EDIT:
Looks like I'll be adding a 'common frequency' slider/meter for loading common passwords XD
I thought it said 1,000 commons! 10,000 damn [appreciated].
And it's ordered by high to low frequency.... Me likey LOL
24  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-05 23:21:38
DISREGARD THE ERROR RELATING TO COMPUTATION CALCULATION BELOW [Calculations are correct]

Well, I've got multiple arrays for that type of stuff XD.
(Sorry to turn this into a code snippet thread)

I'm currently trying to achieve calculating the total computations/combinations for the 26 letter (lowercase alphabet) array[] first.
After I can calculate that properly I'll create / adapt methods to calculate the total based off of the target_array[]s length. (See code below)

Here's what I have at the moment, hoping these arrays will prove useful for someone who's not wanting to hand write them.
I googled to find my first premade 'Alphabet array' than made the other arrays based off of it.
1  
2  
3  
4  
5  
6  
7  
   public static final String[] TARGET_ALL_NUMBERS = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
   public static final String[] TARGET_ALL_LC_LETTERS = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
   public static final String[] TARGET_ALL_UC_LETTERS = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
   public static final String[] TARGET_ALL_LC_LETTERS_AND_NUMBERS = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
   public static final String[] TARGET_ALL_UC_LETTERS_AND_NUMBERS = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
   public static final String[] TARGET_ALL_UPPER_AND_LOWER_CASE_LETTERS = { "A", "a", "B", "b", "C", "c", "D", "d", "E", "e", "F", "f", "G", "g", "H", "h", "I", "i", "J", "j", "K", "k", "L", "l", "M", "m", "N", "n", "O", "o", "P", "p", "Q", "q", "R", "r", "S", "s", "T", "t", "U", "u", "V", "v", "W", "w", "X", "x", "Y", "y", "Z", "z" };
   public static final String[] TARGET_ALL_UC_LC_AND_NUMBERS = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "a", "B", "b", "C", "c", "D", "d", "E", "e", "F", "f", "G", "g", "H", "h", "I", "i", "J", "j", "K", "k", "L", "l", "M", "m", "N", "n", "O", "o", "P", "p", "Q", "q", "R", "r", "S", "s", "T", "t", "U", "u", "V", "v", "W", "w", "X", "x", "Y", "y", "Z", "z" };


But, I meant as far as my computations calculation is it correct?

It doesn't seem to be correct according to: calc.opensecurityresearch.com
It's saying a 6 letter password only using lowercase letters could take 321,272,406 computations.
Where as my estimated total (calculate with the method seen 2 posts above) said: 308,915,776.

1  
for each slot(computations *= target_array.length);
25  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-05 23:04:40
DISREGARD THE ERROR RELATING TO COMPUTATION CALCULATION BELOW [Calculations are correct]

My total computations calculation seems to be a little bit off. (13 Million off sometimes)
I was wondering...
How would I go about calculating the total possible computations / combinations?
Each slot can be up to 26 different letters so here's may attempt:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
protected int getEstimatedComputations(final int targets_total_slots) {
   // 26 is = to length of the alphabet[] array.
  // a = 1 slot = 26 computations.
  // aa = 2 slots = (26 * 26) computations.
  // aaa = 3 slots = (26 * 26 * 26) computations.
  int computations = 1;
   // for each slot, the computations is *= 26 as seen above.
  for (int i = 0; i < targets_total_slots; i++) {
      computations *= 26;
   }
   return computations;
}

Does that look correct?
26  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-05 22:46:01
Yay, I guess I'm doing ok!
Brute forced the work 'breakm' in 6 seconds Pointing
(With the algorithm seen in the opening post)

Quote
[Dictionary]: Initializing Resources...
---------------------------------------------------------------------------------------------------------------------------
[Dictionary]: Loading Words And Definitions, Please Wait...
[Dictionary]: (This might take a while, dictionarys are dumped!)
[Dictionary]: Finished Loading Words And Definitions! (took: 0ms.)
[Dictionary]: 466 Definitions Dumped!
[Dictionary]: Loading Common Passwords, Please Wait...
[Dictionary]: Finished Loading Password Dump! (took: 15ms.)
[Dictionary]: 402 Passwords Dumped!
---------------------------------------------------------------------------------------------------------------------------
[TargetPassword]: Checking Common Passwords, Please Wait...
[TargetPassword]: Word's Not A Common Password...
[TargetPassword]: Checking Common Words, Please Wait...
[TargetPassword]: Word's Not In The Dictionary...
---------------------------------------------------------------------------------------------------------------------------
[Brute Forcer]: Launching exhaustive key search for: breakm
[TargetPassword]: Query Type: Lowercase_Letters
[TargetPassword]: Target Length: 6
[Brute Forcer]: Total Possible Combinations: 308,915,776.
---------------------------------------------------------------------------------------------------------------------------
[Brute Forcer]: Started!
Computations per second: 458,001
Computations per second: 4,149,018
Computations per second: 3,728,822
Computations per second: 3,546,560
Computations per second: 4,357,433
[TargetPassword]: Pass Cracked: breakm
[Brute Forcer]: Elapsed Time: 6 seconds.
[Brute Forcer]: Total Computations: 3,480,711.

IGNORE THIS: Because I changed my {code}{/code} to {quote}{/quote}, I have to put this text here to compensate for the 'over 90% of my text = a quote' denial.
27  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-05 22:11:05
Damn, right on mate.
Thanks for the feedback, I'll look into the links you provided XD
You already translated it, right on.

Today I'll be doing major benchmarking on my version of the brute forcer Smiley
I'll benchmark yours VS mine also to see if recursion is the transformation I need.
28  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-05 10:15:58
If you're good with optimization or you just want to see a rather long switch statement. (Basis of this post)
Seeing this should give you a idea for the type of optimizations I need Grin

Here it is:
EDIT: Updated the code, changed it from the 'if, else' statement to the 'switch' statement (Still the same algorithm).
[Didn't want to spam the opening post]
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  
      /* 11 SLOTS FOR PASSWORD */
      case 11:
         for (a = 0; a < target_query_types.length; a++)
            for (ab = 0; ab < target_query_types.length; ab++)
               for (abc = 0; abc < target_query_types.length; abc++)
                  for (abcd = 0; abcd < target_query_types.length; abcd++)
                     for (abcde = 0; abcde < target_query_types.length; abcde++)
                        for (abcdef = 0; abcdef < target_query_types.length; abcdef++)
                           for (abcdefg = 0; abcdefg < target_query_types.length; abcdefg++)
                              for (abcdefgh = 0; abcdefgh < target_query_types.length; abcdefgh++)
                                 for (abcdefghi = 0; abcdefghi < target_query_types.length; abcdefghi++)
                                    for (abcdefghijk = 0; abcdefghijk < target_query_types.length; abcdefghijk++) {
                                       // TODO: Benchmark Between:
                                      // (var += "ab") VS. ((StringBuilder)var.append("ab"))
                                      COMPUTATED_DATA[a] = (new StringBuilder(
                                             String.valueOf(appendLetter(a))))
                                             .append(appendLetter(ab))
                                             .append(appendLetter(abc))
                                             .append(appendLetter(abcd))
                                             .append(appendLetter(abcde))
                                             .append(appendLetter(abcdef))
                                             .append(appendLetter(abcdefg))
                                             .append(appendLetter(abcdefgh))
                                             .append(appendLetter(abcdefghi))
                                             .append(appendLetter(abcdefghij))
                                             .append(appendLetter(abcdefghijk))
                                             .toString();
                                       if (password
                                             .equals(COMPUTATED_DATA[a])) {
                                          return pass_cracked(password);
                                       }
                                       debug(COMPUTATED_DATA[a]);
                                    }
         break;
34 Lines later
Hi there.
29  Java Game APIs & Engines / OpenGL Development / Re: Terrain gen on: 2013-03-05 10:11:44
Just recently learned this:
Adding fog can prevent such a rendering 'strain' (Less to render right?)
30  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-05 10:09:14
Thanks Roquen.
Totally bizarre, some passwords can take up to 1.4+ Million years to brute force LOL.
Pages: [1] 2 3 ... 15
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (147 views)
2013-05-17 21:29:12

alaslipknot (154 views)
2013-05-16 21:24:48

gouessej (185 views)
2013-05-16 00:53:38

gouessej (179 views)
2013-05-16 00:17:58

theagentd (189 views)
2013-05-15 15:01:13

theagentd (174 views)
2013-05-15 15:00:54

StreetDoggy (217 views)
2013-05-14 15:56:26

kutucuk (242 views)
2013-05-12 17:10:36

kutucuk (240 views)
2013-05-12 15:36:09

UnluckyDevil (246 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.306 seconds with 20 queries.