Friday, April 26, 2013

How I achieved my 5 year goal in 1 year!

One year and two months ago I posted on my blog that I had a goal to become a programmer here.

Today I am proud to announce that I am officially calling it as an achieved goal: I have definitely learned how to program at this point!

My list of applications is very nice but I have also accomplished another goal that I really didn't get in to which was my 5 year goal.

My 5 Year goal was a piggyback goal for my programming goal you see: learning to program through games was to be a stepping stone to become a fulltime professional software developer.

Professional can mean many things but in this context I mean that I would make my living by programming. 

So the great news is that I accepted an offer by my current employer this afternoon to join the product development team as an Associate Software Engineer.

If you just want the short story you can stop here; otherwise if you're looking for an extended story about how I did this read on!


Friday, April 19, 2013

Pirates Jewels II : two new alpha screenshots achieved using vectors

So after learning about vectors recently I modified my game code to use vectors rather than traditional arrays.

This made the process of creating the game boards in these two screenshots very simple for me as I can pass the setup for a board of any size as an object to the function and have initialize all the values and then draw the gems on the screen according to a fairly simple formula based on the size of the gems and size of the array.

So we have here two separate screens, one uses a single large board, and the other uses two smaller side-by-side boards.

All 3 are done with the same functions, just passing a different vector when the are each set up.



Naturally I'm not claiming to be a code-scientist or a pioneer here, just sharing my progress in learning new things and making my indie games better!

I believe always pushing yourself to learn new techniques is extremely valuable. In this case it has made my code leaner, meaner, easier to use and much more modular.

punchy out!

Thursday, April 18, 2013

the solution to my previous question!

So last post I asked how to perform the passing of an array to a function / method in C++ similar to the Java code sample I published here.

 I was informed by a couple of folks to look into C++ Vectors. That turned out to be grand advice so I'd like to share the code that I came up with:

       

void zeroOnlyBubbleSort(vector< vector >&passedArray ){

for(int y = 0; y < passedArray.size(); y++){
bool needNextPass = true;
    while (needNextPass == true){
    needNextPass = false;
       for(int x = 1 ; x < passedArray.size()   ; x++) {  
           if (passedArray[x][y] == 0 && passedArray[x-1][y] != 0){
           int temp = passedArray[x][y];
           passedArray[x][y] = passedArray[x-1][y];
           passedArray[x-1][y]= temp;
           needNextPass = true;
       }  
    }
   }
  }
}

       
 

 This code is a tiny bit different in that it deals with a two dimensional array of vector type but that was a little bit tricky to figure out so I thought it would be nice to share here.

 I also found a couple of nice articles that helped a lot for learning resources so wanted to share those as well: 

This stackoverflow question was very useful: http://stackoverflow.com/questions/5333113/how-to-pass-a-vector-to-a-function 

 And this cplusplus.com article proved nice reference as well: http://www.cplusplus.com/reference/vector/vector/ Thanks for the tips guys!

Thursday, April 11, 2013

how would I do this in C++

So as previously mentioned I have been learning Java and really digging it.

In my previous game Pirates Jewels I use a bubble sort at certain points in the game, and I decided to work on an improved bubble sort that fit certain criteria:

1: This is a specialized bubble sort where '0' numbers float to the top and the rest of the numbers sink down and stay in their previous order

2: The first improvement is I  want to be able to pass an array to the function rather than hard coding it to always use one particular array.

3: The second improvement is I want it to accept variable length arrays ; that is it should automatically traverse the array for the length of the passed array.

4: The third improvement is if no swapping occurred on an given pass it should break through the current  inner for loop and out to the next outer loop (speeds up processing that is otherwise unnecessary)


So I wrote it in Java because I'm learning Java .. I do everything first in Java right now to improve my skills there.

BUT I need this to work in C++ because right now I am using the AppGameKit by  The Game Creator's and I have to write this in C++ to get it to port to iOS AND Android at the same time.

So here is my Java code (that works fine!)
       

public static int[] zeroOnlyBubbleSort(int[] array){
  
  boolean needNextPass = true;
  
   for(int k =1; k < array.length && needNextPass; k++){
    needNextPass = false;
     for(int i = 0; i < array.length - k; i++) {
    if (array[i] != 0 && array[i +1] == 0){
     int temp = array[i];
     array[i] = array[i+1];
     array[i+1]= temp;
     needNextPass = true;
    }  
     }
   }
  return array;
}

       
 
I have done some googling and I am not finding any solutions that match the simple elegance of the Java approach?

Any suggestions ?

Post a comment!

Wednesday, April 10, 2013

blocking out my next game menus Pirates Jewels II

So in case you didn't know I am definitely the type to spend way too much time on graphics when I should be coding my game! I am doing my best this time to use some very generic blocked out placeholder graphics so behold the main menu placeholder!



While certainly not incredibly exciting the names of the menu options should reveal that compared to the gigantic amount of ONE type of game play in the previous version of Pirates Jewels I am going over the top at this point and plan on including SIX game modes.

To be honest I already have the mechanics in place that will make 3 of them work with very minimal effort but I have some very big plans for some of the other modes.. I hope to blog about my progress as the game comes along.

Stay tuned.

Tuesday, April 9, 2013

Learning Java progress for 2013


So I've been learning Java this year.

It was part of my goal for this year as I had taught myself BASIC, C, and C++ last year.

Well to be honest; I only halfway taught myself C++ last year.

I actually started learning C++ in November and  as I entered the area for Classes and Objects it got very pointer heavy and the new year came about and it was time to start learning Java.

I had to make a decision ; continue forward with C++ or dive into Java and set C++ aside.