Advertisement

Render Management

Started by December 31, 2014 10:03 AM
1 comment, last by N=1 9 years, 11 months ago

Hi guys!

I wanted to start my own 3D game now.

I'm using Java with LWJGL(3) and I only worked a bit with LWJGL2 before.

I'm wondering on how to manage my Rendering process.

It'll be an adventure/RPG game, with separate maps (like Final Fantasy for example)

In the past, I worked on small 2D games and Objects rendered themselves like this:


public class Enemy extends GameObject
{
  double x,y;
  public void render()
  {
     //Decision of Rendering is here
     // rendering ENemy Sprite here
  }
  public void update(double delta)
  {
    //AI goes here
  }
}

But I'm often reading that this is a bad process.

Can someone explain why and how it should be done?

I often read of a RenderManager, even though I have no idea on how to organize my classes then(where are the dependencies?)

It'd be nice if you could help me with my concern.

Raildex.

If this is your first game, don't try and design your code up front. Any decisions you make may hinder your code later. If you don't need the code, don't add it. Get something fun working, and refactor the code when it is too complex to find bugs or two slow. Otherwise, slow and dumb is the way to go.

There is nothing wrong with doing all the rendering at once. In fact, if you want to batch updates to minimize state changes and cache misses, this is the way to go.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

Advertisement

I would say that your pattern looks pretty decent.

One reason to remove the rendering code from the Enemy class is that rendering graphics and performing AI calculations are two pretty different things. If the code for each action becomes too big it might make the Enemy class cluttered and unfocused. Then you might want to start thinking about other ways to structure your code.

But until you reach that point, I completely agree with Glass_Knife, just go with it for now.

This topic is closed to new replies.

Advertisement