Jump to content

  • Log In with Google      Sign In   
  • Create Account

laztrezort

Member Since 20 May 2009
Offline Last Active Oct 25 2014 12:15 AM

Posts I've Made

In Topic: How to create a typical "Dungeon Master" type of game?

08 August 2014 - 08:13 PM

For the map structure, it can be the same as a typical top-down maze or dungeon game (similar to a rougelike game). Each map cell represents a feature (open space, wall, well, chest, etc.), like each square on a piece of graph paper.

 

Some old school games represented walls as divisions between cells (the lines between squares on graph paper), so you can have thin walls separating two cells.  This is a bit harder to implement, and it doesn't look like the linked video uses this method.

 

There are basically 2 ways to go about drawing this, the truly old school way and to fake it using modern techniques.

 

For the old school approach, each feature (wall, door, chest) that appears at a certain location in the player's view needs is pre drawn on a sprite sheet.  Perspective needs to be baked into the assets.  It gets a bit complicated working out the walls in particular, probably need to work it out on piece of graph paper.  Here is an example "template" where the player is at * and looking north, each number/letter is a wall cell in the player's field of view:

02431
57986
 ACB
 D*E

When drawing a view, you will need to take the player location and facing direction and build a list of walls and features in the view, then draw them in the order of the template.  You will also need to have a static list of coordinates to know what and where to draw each wall sprite, depending on where it is in the player's view.  As a made up example:

9
...

A
100,50
80,160
0,20

B
...

This might mean that if wall "A" needs to be drawn, copy a rectangular region from the sprite sheet at  position 100,50, size 80,160 to screen position 0,20.  Drawing them in order (1,2,... D, E) and using transparency on the sprites allows use of the painter's algorithm.

 

This works fine but is a bit tedious to implement (especially creating the wall sprites and getting them to line up in a pleasing way).  That said, I've implemented such system a couple times and had fun doing it.

 

The other approach, which can be easier to implement (depending on your skill set) and much more extendable, is to fake it using 3D triangles.  Going this route means you just need to have a texture for the walls.  Field of view, lighting, animating movement and turning, fog - all these things are massively easier to add or tweak if using modern techniques.


In Topic: Text rendering - Minification?

14 January 2014 - 10:06 AM

I don't have the complete code base in front of me, but I believe these are the settings that worked fine for my rendering implementation (likely I was using texture clamping).  That said, the exact settings depend on the rendering methods used.


In Topic: Text rendering - Minification?

14 January 2014 - 07:57 AM

I implemented BMFont rendering in an OpenTK project, and remember having to tweak the output settings a bit to get the text to look good.  I don't have the config file I ended up using handy, but I remember it taking some experimentation.  The end result is pleasing to me, with both min- and mag- (I just let OpenGL create the mipmaps).  Of course, I suppose it depends on how much scaling you are doing.

 

Maybe you can post some screen shots of your results, maybe someone might see something there?

 

EDIT: ah, found the config I'm using:

# AngelCode Bitmap Font Generator configuration file
fileVersion=1

# font settings
fontName=Open Sans
fontFile=
charSet=0
fontSize=24
aa=1
scaleH=100
useSmoothing=1
isBold=0
isItalic=0
useUnicode=1
disableBoxChars=1
outputInvalidCharGlyph=0
dontIncludeKerningPairs=0
useHinting=1
renderFromOutline=1
useClearType=0

# character alignment
paddingDown=0
paddingUp=0
paddingRight=0
paddingLeft=0
spacingHoriz=1
spacingVert=1
useFixedHeight=0
forceZero=0

# output file
outWidth=256
outHeight=256
outBitDepth=32
fontDescFormat=1
fourChnlPacked=0
textureFormat=png
textureCompression=0
alphaChnl=0
redChnl=4
greenChnl=4
blueChnl=4
invA=0
invR=0
invG=0
invB=0

# outline
outlineThickness=0

# selected chars
chars=32-126

# imported icon images


In Topic: question about sending ram->vram each frame

13 January 2014 - 03:33 PM

Technically, most of the answers to your question depend on what you are doing - but for efficiency, it's better to limit transfering from client to server (or vice versa) as much as possible.

 

Really, I suggest going through some tutorials, look up "modern OpenGL tutorials" or similar.  Make sure the tutorials are "modern" or at least version 3 or later.  For example, this one http://www.opengl-tutorial.org/ seems good, I believe it was one of the tutorials I skimmed through it when moving from XNA to OpenGL a year or two ago and found it helpful.

 

After you get the basics, going through the OpengGL wiki is helpful on the nuts & bolts aspects of OpenGL.


In Topic: Performance problems at ~1,000,000 triangles. Am I doing something wrong?

02 January 2014 - 09:09 PM

Merging textures into one (or as few as possible) larger textures (usually called a "texture atlas") is a standard technique, precisely so the number of draw calls can be reduced.  You just need to give each vertex an appropriate texture coordinate.  Same thing can be done with other material data - the more you can reduce the number of calls, the better performance you will see.  This is the most important optimization you can probably make at this point.

 

I believe dpadam450 was referring to the same thing with "batching."  This is basically just putting as many vertices in a VBO as you can, to reduce the amount of state changes and draw calls.  In fact, a good amount of rendering optimization is based around sorting data intelligently into batches.

 

Million triangles is nothing for any modern hardware - as long as you are not making thousands of separate draw calls.  You will find that the difference in rendering speed between batching vs. not-batching is huge.


PARTNERS