Jump to content

  • Log In with Google      Sign In   
  • Create Account

Neglected

Member Since 13 Nov 2011
Offline Last Active Dec 02 2012 05:19 PM

Topics I've Started

Game Engine or not?

06 April 2012 - 05:49 AM

Hello there Posted Image

Right now, I'm working on a project with a group of people. We're basically trying to get together a 2D RPG (with a twist - more on that in a minute), and we've chosen C# as our language of choice (although I do want to implement Lua, Python, or what have you as a script engine at one point). We're not set to start coding until June, because we're currently conceptuallizing, but I brought up the issue of a game engine, however I have read somewhere that you don't actually *need* an engine.

We're planning on using managed code (i.e XNA/DirectX), and we essentially want to have a 2D RPG whilst you're "roaming" (in terms of movement, think about Pokémon, games created from RPGMaker), however when you enter combat, we want to switch to a battle screen that is 3D (or, at least, 2.5D - think FF). I've read that you don't really *need* a game engine in a 2D game because essentially all that needs to be done is have a main loop that updates events in the application (currently in my game engine mock up, I have a main thread with a variable timestep that signals a display thread to render asynchronously [which, in hindsight, seems rather ridiculous - see code below] which then tells the main thread it's done rendering and allows the main thread to continue to the next iteration).

My question is, would we require a game engine for this (it's intended to be a single player RPG though I am trying to convince them to allow you to have peer-to-peer multiplayer), if so what one would you recommend, and, if not, how would we go about organizing the code so it's not too messy? In addition, how would one switch from a 2D perspective to a 3D perspective *cleanly* in DirectX? Part of me thinks about having the 2D perspective transition into black, which a 3D perspective then fades in.. Posted Image

Best regards, sorry for wall of text, and let me know if I need to clarify anything. Posted Image
Main game loop:
http://pastebin.com/wfZYdUuP

EDIT: I would also *GREATLY* appreciate if someone could tell me an efficient way to seperate Renderable content. Right now, I have
Interface IRenderable  { void Render(); }
Class Scene : IRenderable { void Update(); }
But I'm wondering how I would efficiently create GUIs under that structure, or is that a lost cause?

Multitexturing & Shape nets.

14 November 2011 - 03:35 PM

Hello everyone :)
I'm facing a.. I hope.. simple issue for my isometric game. Right now I've made the tiles, and it works brilliantly, but I've decided I wanted to create something that looks more realistic than a flat plane floating.. Suppose I have the given texture:

http://i39.tinypic.com/2elv191.png

And I want to map this to a few quads.. now, the bottom side doesn't matter as the user never sees it, which is why I have omitted it. I was wondering how I would do this? Essentially I need to map the co-ordinates in this texture to the 3 quads, but I was also wondering how I would go about splitting up the texture. Each square of texture is 32 by 32, so it's not difficult to work out the dimensions, it's just the logic I'm stuck with.

Best regards & Thank you for any help given :)

- Neglected

Isometricity.. if that's even a word.

13 November 2011 - 03:36 PM

Hello GameDev.net :)

Right now I'm working on a small project which basically involves reading in binary data from a file and then interpreting that to draw an isometric, tiled world on screen - right now I'm having issues with the creation of said tiled world. I can draw a single tile fine but I have no idea how to use maths to translate the tiles into their appropriate positions. I'm pretty new to OpenGL and wanted to pick a simple game to start with (kinda missed the mark there).
Anyway, I was wondering if you can help. What I do is, as I read in the map file, I create MapTile objects which contain the info in the file (id, flags) and then draw the tile accordingly by invoking render() on it. The code for the MapTile class is below. A few things to note: I cannot change the arguments of the render() function or the underlying interface that gives it to the MapTile class. The class is as follows:

package com.lorichon.maps;

import java.io.IOException;

import org.lwjgl.opengl.GL11;
import org.newdawn.slick.opengl.Texture;

import com.lorichon.controllers.ResourceLoader;
import com.lorichon.templates.RenderableObject;

/**
 * Represents a Map Tile.
 * @author Dan
 */
public class MapTile implements RenderableObject {
    public static final int TILE_GRASS        =0x00;
    
    public static final int FLAGS_NONE        =0x00;
    public static final int FLAGS_WATER        =0x01;
    
    public static final String TEXTURE_TILE_GRASS    = "assets/images/tile_grass.png";
    
    private short m_tileId;
    private short m_flags;
    
    private String m_texture;
    
    /**
 	* Creates a MapTile with the given ID and flags.
 	* @param id
 	* @param flags
 	*/
    public MapTile(short id, short flags) {
    	m_tileId = id;
    	m_flags = flags;
    	switch(id) {
    	//case TILE_ISOTEST:
    		//m_texture = TEXTURE_TILE_ISOTEST;
    	//    break;
    	case TILE_GRASS:
    		m_texture = TEXTURE_TILE_GRASS;
    		break;
    	default:
    		m_texture = TEXTURE_TILE_GRASS;
    	}
    }
    
    /**
 	* Returns true if this tile is water.
 	* @return
 	*/
    public boolean isWater() {
    	return ((m_flags&FLAGS_WATER)==FLAGS_WATER);
    }
    
    /**
 	* Returns the Tile ID.
 	* @return
 	*/
    public int getTileId() {
    	return m_tileId;
    }
    
    /**
 	* Returns the Texture ID to be used with OpenGL.
 	* @return
 	*/
    public String getTextureName() {
    	return m_texture;
    }
    
    @Override
    public void render() {
    	Texture tex = null;
    	try {
    		tex = ResourceLoader.getTexture(getTextureName());
    	} catch (IOException e) {} // discard exception, it'll never be null here
    	
    	GL11.glPushMatrix();
    	{
    		GL11.glEnable(GL11.GL_TEXTURE_2D);
    		GL11.glColor3f(1.0f, 1.0f, 1.0f);
    		// TODO how to draw in the right position?
    		GL11.glBegin(GL11.GL_QUADS);
    		{
    			tex.bind();
    			GL11.glTexCoord2f(0,0);
    			GL11.glVertex3f(-0.5f, 0.5f, -0.5f);
    			GL11.glTexCoord2f(1,0);
    			GL11.glVertex3f(0.5f, 0.5f, -0.5f);
    			GL11.glTexCoord2f(1,1);
    			GL11.glVertex3f(0.5f, -0.5f, -0.5f);
    			GL11.glTexCoord2f(0,1);
    			GL11.glVertex3f(-0.5f, -0.5f, -0.5f);
    		}
    		GL11.glEnd();
    		GL11.glDisable(GL11.GL_TEXTURE_2D);
    	}
    	GL11.glPopMatrix();
    }

    @Override
    public void update() {
    	// nothing to do
    }
}

In addition, could anyone tell me how I could "tint" a texture without having to create an entirely new one? :P

Thanks,
- Neglected.

PARTNERS