Jump to content


Photo

Improving 3d game's perfomance


  • Please log in to reply
3 replies to this topic

#1 Sednax

Sednax

    GMC Member

  • GMC Member
  • 210 posts

Posted 06 July 2012 - 03:43 PM

Hi there, I am making a 3d game similar to minecraft, in which I made the floor made by a large amount of boxes with the same size. All of them have the same texture which is a partial part of a 600x600 texture. So there is many objects, which one is a box. In camera I used d3d_set_projection_ext to reduce the amount of drawing boxes by the distance to the camera to try to make the game faster, but I still have made the floor in a size that I want to increase later and there is a lack of performance. Any tips to improve the perfomance of the game?
  • 0

#2 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1589 posts
  • Version:GM8.1

Posted 06 July 2012 - 06:31 PM

Hi there, I am making a 3d game similar to minecraft, in which I made the floor made by a large amount of boxes with the same size. All of them have the same texture which is a partial part of a 600x600 texture. So there is many objects, which one is a box.

Change texture to 512x512 or some other power of 2. (Not a performance issue, but once you find out why you will abase yourself in front of me in thanks for my wisdom)

Since your floor rarely changes, make a d3d model out of it. There are other methods of optimization, but in GM it's usually far better to just let the graphics card do the work.

In camera I used d3d_set_projection_ext to reduce the amount of drawing boxes by the distance

Most people will read that part of your post as: "Derp"

d3d does NOTHING to change how many drawing functions are called. If you're drawing 5000 boxes nearby, you'll draw 5000 boxes far away unless YOU specifically change that.
  • 0

#3 michael pw

michael pw

    GMC Member

  • GMC Member
  • 1488 posts
  • Version:GM8.1

Posted 06 July 2012 - 11:59 PM

Make the whole map one model which only updates when a block is broken, store all the block data in some form of Array. then make a model out of only visible layers so if someone where to be under the map they would just see emptyness. this model can be regenerated each time a block is broken, then draw the whole map as one model. If your map is really large you will need to chunk sections but again only keep the layers as one model as much as you can as drawing one model is faster than several.
I would go as far to say drawing one 2000 poly model is faster than drawing one 12 poly block using d3d_draw_block(...).
  • 0

#4 Sednax

Sednax

    GMC Member

  • GMC Member
  • 210 posts

Posted 08 July 2012 - 12:34 PM

I've been working in the game, I start using a model to the floor and after a lot of mistakes and remakes I now have a pretty nice floor and a very good performance, I will try to use this one model to create the whole world. Thanks for the tips and help guys!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users