Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


Member Since 06 Mar 2012
Offline Last Active Yesterday, 09:55 AM

#5162312 Why do we need to iterate data structures as they are already in RAM

Posted by Fredericvo on 23 June 2014 - 06:30 AM

First off, I hope I placed this in the appropriate section.  If so...



I've been programming for a while, but this may be a simple question to some (or many).


My Question: If a data structure already exist directly in RAM, then why do we need to spend the processing power to iterate in order to find the right data? (Side Note: pointers still exist in managed languages. They're just handled for you)



All that would actually be in RAM is:


index 0, index1, index 2



Index 0: --> GET VALUE '10'; FALSE; Next Address!

Index 1: --> GET VALUE '15'; FALSE; Next Address!

Index 2: --> GET VALUE '5'; TRUE; RETURN Value!




It doesn't work like this. RAM is like one huge array of bytes e.g. char MyWholeRAM[4 294 967 296] for 4 GB.

Every byte (char) has a unique address numbered from 0x00000000 - 0xffffffff 

I'll spare you details about paging and kernel space/user space.

A pointer is just an address of one location stored at another location. The CPU can only load a few values at once in its registers so iterating through RAM means loading data in registers, do a calculation or comparison, and store the value.

Some times it needs to know that another value is at a particular place in RAM and that's when a pointer tells it where it is.

A linked list would be stored as a pointer to the next node or NULL if there are no more nodes, and the actual data. The other node would again contain a pointer (really just a 4 byte value like another or 8 bytes in case of x64) 

Attached Thumbnails

  • ram.png

#5162300 DirectX

Posted by Fredericvo on 23 June 2014 - 05:51 AM

I completed all 49 DX11 tutorials from www.rastertek.com and all 20 terrain tutorials and everything is starting to make a lot of sense to me now. I did have some mathematical background already though (Linear Algebra). I recommend khan academy or Paul Dawkin's online notes (Lamar Uni) to learn that.

#5041474 When to start with C++?

Posted by Fredericvo on 10 March 2013 - 05:45 AM

I knew assembler before I knew C and C before C++. I understood pointers already thanks to assembler and curiously found the C/C++ way to approach them more convoluted because of the complex syntax. Looking at assembly output helped me understand what compilers do and get the language better.

#4963065 PhysX basic understanding

Posted by Fredericvo on 25 July 2012 - 03:06 PM

I'm still a total noob on this topic but from what I read so far, yes, this seems to be how it works.

#4961312 "Make Games, Not Engines".. But how?

Posted by Fredericvo on 20 July 2012 - 07:00 AM

Do you mean even the little question mark block that you can kick out coins from have not been copyrighted? Or little turtles whose shell you can grab to throw it back at them?

#4961124 physX info

Posted by Fredericvo on 19 July 2012 - 07:06 PM

I know what you're saying.
The Nvidia site seems to have suffered a hacker intrusion and I too can't find anything about physx there lately :-(

#4960443 C++ As First Language

Posted by Fredericvo on 18 July 2012 - 06:27 AM

I don't think it is so hard to learn C++ programming..
But it is sure that you should learn more about Computer before C++ programming .
You should know how the memory and cpu work together and understand what the memory address really means ....this is the key to understand pointers in C++ (notice the function pointers)

Then any trouble else with C++ programming?

If any it'll be how to design a project...

That's why I think assembler could actually be an excellent first language. After all many old programmers had nothing else and so it was their first language. I myself, though am moderately old, knew assembler before C and C++ and whenever I wasn't sure what a feature did I'd often peek at the assembler output to get it.

#4959810 Opengl Index buffer madness

Posted by Fredericvo on 16 July 2012 - 05:52 PM

how do i create an index buffer for a large mesh? i mean specifically how to i set up the array of int's from the vertex data? like what is the logic behind this? i understand what the index buffer is for and how to use it but i dont know how to set up the initial array you will pass to the gl element array buffer.

Not sure if you nean simple geometry that you manually type the numbers for or imported geometry from a 3D program but if it's the latter then it'll already be exported with indices.
If the question is about how it works then the index is simply the location in the vertex buffer to use the data from.
Example: vertex buffer
x1,y1,z1 (position)

Then in the index buffer a triangle would be defined as [0,1,2] and another as [1,2,3] using vertex 1 and 2 twice thereby saving space and bandwidth.

#4959162 C++ As First Language

Posted by Fredericvo on 14 July 2012 - 06:52 PM

I'm going to make a suggestion totally out of the blue. If you are totally new to programming try learning PHP first. It's not useful for games since it's a web scripting language but it's dirt easy and if you never programmed before then games aren't the first thing you should focus on in the first place. With PHP you will at least learn something you will encounter in most other languages such as a while loop, a for loop, switch/case, if/else etc. You will use arrays, hash tables and never have to worry about forward declarations, header files or translation units. That's for when you feel ready for the next step which is when you'd switch to C++. And PHP has the additional benefit that you will need it for your websites where you wouldn't use C++. Another language that you would learn just because it seems easier at first but overlaps with C++ might be abandoned later once you upgrade. Just my 2 cents.

#4958836 3D Mathmatics

Posted by Fredericvo on 13 July 2012 - 10:44 AM

I recommend the khan academy videos.
I also learned my math online from Paul dawkins's tutorials. I did calc II,II,III,DE and Lin alg.

#4958786 Did you succeed in building a game from a Game Engine?

Posted by Fredericvo on 13 July 2012 - 07:18 AM

I think it all boils down to efficient division of labour. I think I'd go a lot faster if I could develop with others who'd be my exact complement. As soon as there is competence overlap then there are going to be ego problems such as will we use my solution or yours or if my solution is always discarded because it's inferior I'd feel I'm no longer part of the team etc. However if I'm fully specialised in , say, rendering and you in game logic or physics then there's full conplementarity and no stepping on each others feet. And we could fully concentrate on a topic rather than be scared that we still have so much to sift through. So how I see it gamemaking is mostly a people management problem.

#4958383 Any point in moving the world in reverse these days?

Posted by Fredericvo on 12 July 2012 - 07:06 AM

Yeah it's a matter of perspective (pun unintended)
The "cam" doesn't really exist. It's a matrix that moves whatever you want to look at into the frustum.

#4957845 "Make Games, Not Engines".. But how?

Posted by Fredericvo on 10 July 2012 - 06:58 PM

It's good that you bring this up because I somewhat struggled with this confusing terminology too.
Maybe there should be a term that differentiates between game-specific engine and game engine as in a very general set of libraries that can power any game with minimal code writing on your part such as Unity, a program that allows end users to make games.
My goal is to create games but with my own engine as in very specific. i.e. Other people might not be able to use it but it should serve my purposes. If it can be improved so the better.

#4956745 Has the game industry reached a point of saturation?

Posted by Fredericvo on 07 July 2012 - 03:27 PM

We went from 16 colours to 16 million which is what the human eye can distinguish. We went from 2D to 3D which is what a human mind can comprehend. I suppose a 4D game in 16 billion colours wouldn't make sense. Lol

#4956539 Help me change my life and career.

Posted by Fredericvo on 06 July 2012 - 06:40 PM

LOL tell me a bad line that'll blow up my windows. User code not kernel code.