   2D scrolling and tiles
  I'd like to start coding somewhat of an action 2D game but I'm having some trouble understanding how scrolling works exactly. What I understand is that tiles are needed and that I should build my level with those (with mappy or something like that). What I do not understand is how to actually implement the scrolling. Must all the tiles constantly be in memory? What kind of structure should the tiles be saved in? How do the actual scrolling work? Am I making it clear to what the problem is for me? How do the actual scrolling work? As for libraries I was planning on using HGE if it makes a difference.   
  Scrolling is just drawing things at a different offset. You don't need tiles for that - pretty much any structure will do. Whether you use a single background image, a tilemap, or a bunch of freely placed sprites, or a combination of these doesn't matter.Tile data and sprite positions don't take up that much memory. Most memory is used for the images themselves. Then again, each unique image only needs to be loaded once, so unless you're planning to build a very art-intensive game with huge levels, you shouldn't need to worry about that. Besides, an easy solution would be to split up huge levels into smaller ones, and keeping only one level in memory at any given time.Anyway, to give you some examples, recently I've been working on an AI project (written in Python) and for the visualization I wrote a tilemap and a sprite collection class (which uses sprite objects). All of them support scrolling: you just pass them a different drawing offset. They're not optimized for culling or whatsoever, but that shouldn't be too hard to implement.   ;  What I do is keep a global scrolling rect the size of the window. To scroll the tile map, all I do is offset this rect. Drawing the tiles in the rect is easy. Simply determine which tile column intersects the right and left side of the rect (by dividing rect.right and rect.left by the tile width) and you have the start and end columns. Do the same for the top and bottom of the rect to get the start and ending rows. Then, for each frame, just draw all of the tiles that intersect the scroll rect. You're not actually scrolling the tile map, you are just drawing what can be shown.   