• Create Account

# wolfscaptain

Member Since 08 Jul 2009
Offline Last Active Aug 13 2012 01:46 PM

### #4955543consistent Gaming Loops and Clocks

Posted by on 04 July 2012 - 12:56 AM

This is worth a read http://gafferongames.com/game-physics/fix-your-timestep/

Posted by on 01 July 2012 - 06:00 PM

SDL 1.3 (now named 2) runs on OpenGL behind the scenes, so it's the same as SFML regarding that.

I'd still go for SFML because it's easier to use, and the things that SDL supports and SFML doesn't (like multiple windows) are generally not needed.

### #4951024Supporting 100000 objects in box2d

Posted by on 20 June 2012 - 10:55 AM

Box2D doesn't implement a quad tree, or some other grouping technique?

### #4945754How to Structure a Tile Based Game?

Posted by on 03 June 2012 - 02:17 AM

I structured my own 2D tile map from tile types, which define all the attributes a tile has (image index to the image array, collision data, special flags, etc.).
The map itself is then a 2D array of indices to the tile types array.

This saves a whole lot of memory both while running the game, and on the disk, though the real intention was to make the map easily editable (I see editing a few tile types a whole lot easier than editing every single tile manually, but maybe that's just me).

To make empty tiles I just start the tile type indices at 1, so that every tile with value of 0 is to say "no tile type".

About collisions - you need only check the tiles around the player. You can get the exact tiles by converting your player coordinates to tile coordinates.

Suppose your player's coordinates are some point (x, y), and suppose every tile has the dimensions (w, h).
To instantly get what tile the player is on, simply divide the player's position by the tile size (x/w, y/h). This will result in the x/y indices of the tile.
For example, if the player's position is (200, 100) and the dimensions of each tile are (50, 50) then the player is on tile (4, 2).
That's converting your player's world space coordinates to tile space coordinates.

You should of course also take care of the player's dimensions. For example, if the above player's dimensions are also (50, 50), it is most likely that the player is intersecting with more than one tile, so take that into consideration.

I would say to just go with a physics engine like Box2D, but I really have no idea how optimal general physics engines are for uniform tile maps, which might have thousands to millions of tiles, yet are very, very efficient in terms of collision if done specifically for them.
You might want to check this out, as I've never yet used a physics engine.
While they are not meant specifically for uniform tile maps, they might have internal buckets (e.g. the well known quad tree) to filter out unneeded collisions, which are not as efficient as writing your own code, but are probably fast enough for you not to care.

### #4942691VBO Opengl tutorial

Posted by on 23 May 2012 - 03:13 PM

A simple "vbo" search on Google would be faster than asking here.
Second result (after wiki): http://www.songho.ca...ngl/gl_vbo.html

Just note that you most likely don't need ARB at the end of every function and constant anymore, unless you have a really old graphics card.

### #4942150Broken Game as an Anti-Piracy Measure

Posted by on 22 May 2012 - 04:25 AM

Crackers are better. That's all there is to it.
Big companies these days wate so much money and effort on protections that get cracked, usually, a few days after their games get released.

Maybe if they would use the money and time on making the games work better, people would be encouraged to buy them.
Right now, the only people suffering costantly from DRM are the legal buyers, pirates don't even see it.

A simple CD key would stop 5 years old kids from spreading games. Nothing beyond that is worth the effort.

### #4938675Handling of game objects (projectiles, players etc)

Posted by on 09 May 2012 - 08:35 AM

If you want to decouple your objects, why do they handle everything to begin with?

SC2 objects don't control collisions, they have attributes that tell the engine how it should handle them.

It makes a lot more sense (at least to me) that all objects are owned by some logic game class that actually runs the game. That class, then, has access to all the needed components (rendering code, physics code, etc.) and runs them on the objects it owns.

The objects themselves only own attributes to tell the game what they are and what to do with them (which by itself is a whole new topic on how to design this, e.g. Inheritence vs components).

### #4927125Tile-Based Collision\Physics Problem

Posted by on 01 April 2012 - 02:37 AM

Why not just make the player a little smaller?

### #4904546rendering image in memory only

Posted by on 20 January 2012 - 05:05 AM

glReadPixels seems to do the job. Never used it myself, but it looks like a straightforward memory copy.

### #4904374rendering image in memory only

Posted by on 19 January 2012 - 03:47 PM

You can render anything you want on a Frame Buffer Object, from which you can grab the data and use it however you want. This is how modern Render-to-texture operations are made.

You can then use the data in the Framebuffer (in the form of a chunk of memory containing pixels) to populate an actual image object using whatever library you have.

### #4883392Is Unity3D spoiling me?

Posted by on 12 November 2011 - 11:10 PM

JavaScript is an implementation of the ECMAScript specs.
Unity's JavaScript is another implementation, except it doesn't really conform to the specs (same story with Flash's ActionScript).
That being said, JavaScript usage is all over the place, also in the game department, mostly since HTML5 and friends started getting implemented.

Posted by on 24 July 2011 - 02:22 PM

TGA is not supported in any browser.
Had to convert thousands of pictures to PNGs because of it :| (yey for batch operations with ImageMagick using a 5-liner Ruby script)

The browser probably told you that in its console, so you better open up the console when you test your code.
Chrome's console (and JS implementation) is a whole lot better then Firefox's in my experience, so you might want to develop on it.

### #4838975HTML5, JS and CSS3. Unity question.

Posted by on 22 July 2011 - 09:54 AM

HTML5 adds some new tags, that is all. Now XHTML just means that you are writing code that tries to not suck too much, it isn't an actual technology or anything.
HTML4 code will almost always work when parsing a page as 5, since hardly anything got removed (a few useless tags nobody uses).

I don't know why anyone would need a book for HTML, CSS, or JS, as they are very simple by design.
Googling skills are more then enough, especially when most problems come from the crappy browser implementation, which you will easily find answers to on the web.

### #4836059Setup OpenGL like Direct2D

Posted by on 16 July 2011 - 11:51 AM

You would probably want to add functions that manipulate a modelview matrix (to "move" your camera). Making them is pretty easy, you can look at how the functions worked in early OpenGL versions (gltranslatef, glrotatef, glscalef).

The end result would be projectionMatrix * modelviewMatrix * vertex in the shader, or you can calculate projectionMatrix * modelviewMatrix on the CPU since it's just extra calculations if you do it for every vertex.

### #4833308Structure of a Videogame?

Posted by on 10 July 2011 - 06:25 AM

I suggest you to look into entity systems and component programming in general.

PARTNERS