Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Feb 2007
Offline Last Active Yesterday, 07:41 PM

#4968461 Graduation exercise from cplusplus.com

Posted by on 11 August 2012 - 12:15 PM

"Write a program that creates a linked list of bunny objects."
With an array you could jump to any position of that array, however a link list you must start at the beginning node and transverse through each node in order to reach the desired node. Each node will have a pointer to next node and a structure/pointer to the data it contains.

Start by laying out the framework of the application.

Main Loop
  User Input
  Bunny Update Loop
	Change State
	Create New Bunnies
	Kill Current Bunny
  Mass Murder Bunnies
  Sort Bunny by Age
  Display Output
  File Output

I have noticed that advanced classes is part of the requirements for the exercise. A class CBunny would be good candidate for this instead of a struct. For the link list, pass a pointer of CBunny as the data.

Good Luck ;)

#4966604 Isometric Hex Picking

Posted by on 06 August 2012 - 02:43 AM

Thanks for link to Paul Firth's article :) It sparked new ideas for me.
I never done isometric let alone hexagonal so please forgive me in advance for guessing.

Looking at the image of the hexagonal tiles in OP, I tilt my head slightly to the left and see that this is still a 2d grid (x,y).
Starting on the far left tile is (0,0) and the far right is (5,3)
Every hex tile has a center. The center point will become the exact tile location.

Based on the 'Coordinate Systems' section of the article: (0,0) will become the origin for the up 'U' and right 'V' vectors.
The two vectors will pass through all the center points of each hex tile along the edge of the map.
Get the screen coordinate 'P'
Do the math to get tU and tV

Temporarily select a tile based on (tU, tV). So if (tU, tV) = (1.3, 2.7) then it will pick tile (1, 3).

Afterwards, do a more comprehensive test.
Using the temporary tile, check the six sides if the (tU, tV) falls within the polygon. All sides are equal distance from the center of the tile.
If any one side fails the check then the adjacent tile is the tile to be selected. Otherwise the current tile is the selected tile.

#4964179 Read 2D array map from text file

Posted by on 28 July 2012 - 08:10 PM

I don't program in c# but would something like this work?

1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12

string[] astrNumbers = buffer.Split(',')

foreach( string strNumber in astrNumbers )
int numVal = Convert.ToInt32(strNumber);

#4963990 Animation and Art for 2D RPG

Posted by on 28 July 2012 - 09:55 AM

I don't think splitting up the character is necessary however the equipment might be a good idea.

Let’s say this is Photoshop and everything is done in layers. Take particular animation frame and have it as the bottom layer. Create a new layer for each piece or set of equipment and draw on top of the animation frame. Create a new sprite sheet for the item only. Select the layer of the worn item and copy and paste it into same index position as animation frame. While in the game, render the character's sprite sheet first then all the separate equipment sprite sheets in the order of feet going up. That way something like a cape gets rendered on top of boots.

The problem with this is the armor and equipment is specific to the character. This is not a problem if the main character is the only character. Unless all the characters are the same size and have identical movements, you could possibly reuse the equipment animation. Otherwise, repeat the process for all the other characters.

I'm slow at typing :P
JTippetts explained it better.

#4963820 ID3D11Device::CreateBuffer returning E_INVALIDARG for no apparent reason.[RES...

Posted by on 27 July 2012 - 06:54 PM

Is vertexCount == 3?

Your call:
AssetManager->CreateVertexBuffer(&vertexBuffer,sizeof(VertexType)*vertexCount, &vertices);

Your definition:
void AssetManager::CreateVertexBuffer(ID3D11Buffer** buffer, unsigned int bufferSize, void* vertices, D3D11_USAGE bufferUsage, D3D11_CPU_ACCESS_FLAG processorAccess)

What are the default values?

ID3D11Buffer** buffer means pointer to pointer.
In the creation you have buffer pointer instead of *buffer pointer
HR(gD3DDevice->CreateBuffer(&bufferDesc, &subResData, *buffer));

#4963099 Product Key System

Posted by on 25 July 2012 - 05:01 PM

Here is some more guessing ;)

For PayPal I think they have an 'auto return' feature for business websites. For instance you have a website where a person buys a game and proceeded to PayPal’s website. They pay up and PayPal returns back to a predefined page at your website. At that point your own website issue the product key if payment is received; not PayPal.

The system I was describing was for each unique product/public key there is a corresponding unique private key. So 10k product keys = 10k private keys. All keys are stored in a locally stored database.

I suppose instead of doing it that way, there could be a system where there is only one private and public key pair.
  • You keep the private key, and the public key is hardcoded into software.
  • Have a unique plaintext string that gets embedded into each game disk.
  • Take that unique text string and encrypt it using the private key you kept.
  • The encrypted output ‘is’ the Product Key and is placed on the packaging.
  • A person buys your game.
  • The person enters the Product Key
  • The Product Key is decrypted using the hardcoded public key.
  • If the plaintext message received from the Product Key is the same as the plaintext message stored on disk, then the Product Key is good.

However I could see a few flaws with this right off the bat:
  • A hacker could replace the public key with their own and the plaintext message on disk gets encrypted with their own private key.
  • Each game disk is different due to the unique plaintext string which results in multiple iso images.
  • One Product Key cannot be used with other disks.

#4962826 Product Key System

Posted by on 24 July 2012 - 11:53 PM

I'm far from qualified to answer this, but I want to have first crack at guessing.
I could imagine a system very similar to PKI where there is a public/private key. There would be a database at some game company's HQ containing a private product key for each public key distributed with the packaging or downloaded apon purchase online. The game itself may have a hard coded string of characters and using the public key to encrypt that string. Then the encrypted string would be sent over the internet back to HQ in order to be decrypted using the private key. If the hard coded string matches after using the private key, then the public key is good. This is just a guess and I may be completely wrong.

#4961978 Viewport empty

Posted by on 22 July 2012 - 12:11 PM

Have you tried moving your camera a little further back say -1.0 instead of -0.5?

camPosition = new Vector3(0.0f, 0.0f, -1.0f);

#4961969 Preprocessor on same line as code

Posted by on 22 July 2012 - 11:33 AM

I'm kind of interested in seeing your one liner.

I agree with Daaark that lines are a useless metric. I suppose a better one is exe file size. There are impressive 3d tech demos out on the internet including music and it all fits within 64KB limit.

#4957910 Re starting again with programming

Posted by on 11 July 2012 - 12:42 AM

It all depends on your learning curb on any subject. Loads of daily commitment and practice could get you proficient in any programming language. Everything I know is self-thought and from my experience I have gotten really good at programming in c/cpp within one summer break of high school. However it took years to apply that knowledge. These days I can pick up a programming language within days because I have a solid grasp of how computers work. For example with Python I learned within 3 days using resources on the internet since my learning curb on programming is very low now. The question is, do you have kids or work more than one job? Because kids and surviving are demanding of your time and effort you know.

Allocate your time based on how fast you saturate information and comprehend concepts. Don't have long days with little sleep. If you get burned out on programming, pick a different subject for awhile like math or basic electronics. Get well rounded in IT.

Goals are generally categorized as immediate, short-term, and long-term and it takes leadership skills to stay on track. Management is taking goals and creates tasks that work towards completing that goal.

For instance in learning:
long-term goal - I will have a firm understanding programming in C# by 3rd quarter 2012
short-term goal - I will read, understand, and apply my knowledge of CH3 in C# in 21 Days starting 7/11/2012 and no longer than 7/14/2012
immediate goal - I will write and test x function today starting at 9am

Treat yourself if you complete a goal ;)

#4957853 How to code bullets in side scroller

Posted by on 10 July 2012 - 07:54 PM

Try implementing a bullet movement function and call it per-frame after user input and before collision detection such as:

[source lang="cpp"]float bulletMovementFoward(void){ posX += .5; //Something faster than ship movement return posX;}[/source]

However I suggest looking into frame independent movement to give object a smoother feel to it.