Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


JonConley

Member Since 21 Aug 2008
Offline Last Active May 13 2013 02:40 PM

Topics I've Started

Resume Critique

08 November 2011 - 10:08 AM

Howdy all, I have been lurking on here for quite some time and have posted some questions and fewer answers. Well I graduate in the spring with a BS in Comp Sci so I started a resume and plan on sending it out within the next couple of weeks to mostly non-game related positions but, I figure that this would be one of the better places to get advice on what to change.

I have done some smaller games and some proof of concept items for myself. The biggest thing I am concerned about really is the Pokemon Red Save Game editor. Yes I own the original cartridge along with my gameboy pocket, but the idea came to me when I was bored at work (I work the front desk at a local Y) and I decided to boot up an emulator on my tablet to play the game some.

Attached is the resume, any advice is welcome. For references I have a professional who worked for Kodak for 10 years, a professor that now owns his own company (which has done an indie game that has won several awards), and professor I did an independent study with (Concurrent programming for the Cell).

Map of a function Pointer with arbitrary member functions

05 November 2011 - 01:30 PM

I am trying to design an input handler for SDL, the biggest problem with just checking for a keydown event is that once I do something else while still holding down the key it will no longer register as a keydown.
So I am trying to make a generic handler that I can register a function to a key using a map of SDLKey and a function pointer. Now this becomes the issue. I am trying to use boost and the functions that I will be binding will be member functions (such as for moving a camera or even rotating it).

Now I am not sure how to do this since to create the map I believe I need to know the arguments for the function pointer.
map<SDLKey, void(*)(<pointer to class that I am registering>, otherArgument(probably eventually boost::any)  >

I want to be able to have a function in the input handler that just takes a pointer to whatever object that will have its member function called and then the function that will be called.

class foo
{
public:
      void MoveForward(float mag){...}
};

foo a;
keyHandler.bind(SDL_w, &foo::MoveForward, &a, <pointer to what data is sent>);


Now I was wondering if anyone could help me figure out how to do this, I have used boost before but only for threads and random numbers (generating fractals).

Heap (Looking for crits)

20 October 2010 - 01:42 PM

I've been programming awhile and am in a Computer Science program. Gone to several competitions (won CCSC at Franklin college this year).

Basically looking for crits / potential speed ups in my heap. Got bored, never implemented one so decided to do it today.

main (test case with time)

#include <iostream>
#include <ctime>
#include <Windows.h>
#include "Heap.h"

using namespace std;

int main()
{
Heap<int> mine;
srand(time(NULL));
time_t begin, end;
begin = GetTickCount();
for(unsigned int i = 0; i < 100000; i++)
{
mine.push(rand());
}
end = GetTickCount();
cout << end - begin << endl;
for(unsigned int i = 0; i < 100000; i++)
{
mine.pop();
}
end = GetTickCount();
cout << end - begin << endl;
return 0;
}



Heap.h

#pragma once
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

template<typename H>
class Heap
{
static bool comp(const H& a, const H& b)
{
return a > b;
}
inline void filterUp()
{
//a nodes parent is (n-1)/2 and since n is SIZE -1, substitute
//and get (SIZE-2)/2
unsigned int n(SIZE -1), nPar( (SIZE-2)/2);
H temp;
while(n > 0 && Heap<H>::comp(nodes[n], nodes[nPar]) )
{
temp = nodes[nPar];
nodes[nPar] = nodes[n];
nodes[n] = temp;
n = nPar;
nPar = (n - 1) /2;
}
}//filter

inline void filterDown()
{
if(SIZE <= 1)
return;
//initialize when created (saves a copy)
unsigned int n(0), nChi1(1), nChi2(2), toSwap;
H temp;

while(nChi1 < SIZE)
{
if(nChi2 < SIZE)
{
//if compare function returns true than use nChi1 as index
toSwap = comp(nodes[nChi1], nodes[nChi2]) ? nChi1 : nChi2;
if(comp(nodes[toSwap], nodes[n]))
{
//temp variable
temp = nodes[toSwap];
nodes[toSwap] = nodes[n];
nodes[n] = temp;
n = toSwap;
//New child index
nChi1 = n*2+1;
nChi2 = n*2+2;
}//if statement
else
break;
}//if child 2 is big enough
else
{
//now if there is no 2nd child to current parent
//check compare, if true swap
if(comp(nodes[nChi1], nodes[n]))
{
temp = nodes[nChi1];
nodes[toSwap] = nodes[n];
nodes[n] = temp;
break;
}//if statement
break;
}
}
}
unsigned int SIZE;
vector<H> nodes;
public:
Heap(unsigned int Reserve = 30);
Heap(const H& Data, unsigned int Reserve = 30);
Heap(H Data, unsigned int Reserve = 30);
Heap(const vector<H>& Data);
void push(H& Data);
void push(H Data);
void pop();
const H& front()
{
if(SIZE > 0)
return nodes[0];
}
~Heap(void);
};

#include "Heap.inl"



Heap.inl (because vs 2008 doesn't have export working it seems so just tossed it in another file without .cpp)

#pragma once
#include "Heap.h"

template<typename H>
inline Heap<H>::Heap(unsigned int Reserve) : SIZE(0)
{
nodes.reserve(Reserve);
}
template<typename H>
inline Heap<H>::Heap(const H& Data, unsigned int Reserve) : SIZE(1)
{
nodes.reserve(Reserve);
nodes.push_back(Data);
}
template<typename H>
inline Heap<H>::Heap(H Data, unsigned int Reserve) : SIZE(1)
{
nodes.reserve(Reserve);
nodes.push_back(Data);
}
template<typename H>
inline Heap<H>::Heap(const vector<H>& Data)
{
//Copy the vector in and sort it (sorted high to low will give a heap)
SIZE = Data.size();
nodes.reserve(SIZE*2);
//copy Data into nodes
copy(Data.begin(), Data.end(), nodes.begin());
//Sort to create a heap
sort(nodes.begin(), nodes.end, heap::comp);
}
template<typename H>
inline Heap<H>::~Heap(void)
{
}
template<typename H>
void inline Heap<H>::push(H& Data)
{
SIZE++;
nodes.push_back(Data);
filterUp();
}
template<typename H>
void inline Heap<H>::push(H Data)
{
SIZE++;
nodes.push_back(Data);
filterUp();
}

template<typename H>
void inline Heap<H>::pop()
{
//swap the front with the back
swap((*nodes.begin()), (*(nodes.end()-1)));
nodes.pop_back();
SIZE --;
filterDown();
}





Also I understand sorting isn't the best way to create a heap from a vector, but that wasn't my main priority. Main priority was to get push and pop working quickly.

From AMD's Profiler
CS:EIP Symbol + Offset 64-bit Timer samples
0x11414c0 Heap<int>::filterDown 85.71
0x11413d0 Heap<int>::filterUp 7.14
0x1141110 main 3.57
0x11412b0 Heap<int>::pop 3.57

4 functions, 20 instructions, Total: 28 samples, 100.00% of shown samples, 2.79% of total session samples
16 ms for all the pushes to happen
47 for everything to happen.

Integral Pi Approximation on Cell Processor

23 September 2010 - 05:26 AM

I am doing an independent study titled "Parallel Programming on the Cell Processor" and one of the initial programs I have made is a program to approximate pi using the integration of the function 4/(1+x^2) between 0 and 1.

Now with 24 billion boxes between 0 and 1 and their area added together I get 7 decimal places of pi. That is not the problem.

The problem becomes that I have to do 2 billion divides per SPE on a double vector. These divides are terribly slow, I have tried using recipd2(1+x^2) * 4, I have tried just a straight division and it slows the program by 600%+.

Pseudo SPU Code

vec double four(4.0,4.0)
vec double one(1.0,1.0)
vec double result(0,0)
vec double tempResult
for(iterations)
tempResult = spu_mul(x,x)
tempResult = spu_add(one, tempResult)
tempResult = divd2(four, tempResult)
result = spu_add(result, tempResult)

double pi = result[0] + result[1]
DMA command send pi to PPU (which works)
exit

I was wondering if there is a way to get around the divide and are double divisions really that slow on the SPU?

Preparing to Write a Ray Tracer

16 June 2010 - 03:53 AM

I see quite a few Ray Tracer posts here, and it seems like a good way to understand the math behind rendering (whether it be rasterization or ray tracing). I am doing an independent study next semester dealing with parallel computing on the ps3 (doing pi approximations, fractal generation, and hopefully a ray tracer).

Before I jump into the ps3 items though I want to implement a ray tracer to get an idea of the structure and such. I have bought (have not received yet) Ray Tracing From the Ground Up, but I like to think of ways on how I would do it with the information I already know before I look at other peoples methods and why they chose that route.

Now to my question, this seems like a pretty obvious way to structure the rays for a pixel but it just sort of popped into my head the other night, for each pixel construct a tree with the root node being the intersection of the original ray for a given pixel with geometry. After that create children from each new ray spawned (whether it be reflection, refraction or what have you) and then each new node is the new intersection from the previous spawned array.

Something like this

Ray Tracing Tree

PARTNERS