Sign in to follow this  
LorinAtzberger

Unity HammerEngine development questions.

Recommended Posts

Hey guys. Even though I'm not very new to the comunity I still haven't had the chance to talk and share info with you guys. I'd like to change that since we're all here to make games and learn from one another. I made this topic because I've started working on my second GameEngine since the first one didn't turn out exactly as I wanted and now I have more experience. I'd like to put all my questions and stuff I figure out here so anyone can see the eventual problems and solutions. First of all my game engine is called HammerEngine but it might change (not the important right now). Next in line, I work with Visual Studio 2008 c++(for the engine programming) and I also make C# bindings. I use OpenGL for graphics. The engine uses deferred lighting. I want to split it up as Hammer3D,HammerInput,HammerPhysics,HammerAi etc. Currently only Hammer3D and HammerInput are in development. Hammer3D let's you bind the a engine to a HWND or creates a window for you and binds an engine to it. HammerInput takes a HWND and attaches a input loop to it so that you don't have to do anything but call functions like KeyDown(KEY_A) First problem: I'm not sure on how to make a window that updates automatically without me having to call a certain function. My code for the example looks like this:
#include <windows.h>
#include "..\..\..\Hammer3D\Hammer3D.h"
#include "..\..\..\HammerInput\HammerInput.h"

TEngine engine; 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{	
	InitializeHammer3D();
	InitializeHammerInput();
	engine = CreateEngineWindow(800,600,32);
	CreateInput(GetEngineHWND(engine));
	while(!KeyDown(KEY_ESCAPE))
	{
	}
}
Problem is that I can't move or do anything with the window. Oh and for who might ask. HammerInput uses subclassing for getting acces to the input without calling something like Update(); Could anyone point me somewhere with this issue? Thank you. Edit: I found a way to do this but it has one problem. Using this function that is called on every function like KeyHit:
void SystemPoll(){
	MSG msg;
	while( PeekMessage( &msg,0,0,0,PM_REMOVE ) ){

		switch( msg.message ){
		case WM_KEYDOWN:case WM_KEYUP:
		case WM_SYSKEYDOWN:case WM_SYSKEYUP:
			switch( msg.wParam ){
			case VK_SHIFT:
			case VK_CONTROL:
			case VK_MENU:
				break;
			}
			break;
		}
		
		TranslateMessage( &msg );
		DispatchMessage( &msg );
	}
}
This way the window works well but Im not sure what happens if for example you don't use any of those functions. It's a good temporary solution but not the best i think. [Edited by - LorinAtzberger on December 25, 2009 8:20:12 AM]

Share this post


Link to post
Share on other sites
What's the problem with simply putting an update function in the main loop? Assuming that the user will call an optional function is not a good way to design a solid API. However, if you clearly state that users are required to invoke UpdateHammer3D() or a similarly named function each loop cycle, chances are most people will catch that right away.

EDIT: Another way is to start a background thread that constantly calls PeekMessage(), but if you do you will have to be careful to lock any shared data. For example, the thread that handles window messages will need to lock the keyboard state (as will KeyDown) to ascertain that the list of pressed keys will be in a consistent state.

[Edited by - Windryder on December 25, 2009 5:49:54 PM]

Share this post


Link to post
Share on other sites
Yeah but what game doesn't require any input? Even the close button of the window can be called unsing pollsystem. And even more if there are problems with this I can add it on flip function as well since that has to be called in each loop to flip the buffers.

Share this post


Link to post
Share on other sites
Quote:
Original post by LorinAtzberger
Yeah but what game doesn't require any input? Even the close button of the window can be called unsing pollsystem. And even more if there are problems with this I can add it on flip function as well since that has to be called in each loop to flip the buffers.


So call it when you flip? ;) I don't really see the problem.

Share this post


Link to post
Share on other sites
Yeap I did that. Works like a charm.
I've reached the material/texture part and I have another problem.
First of all using visual studio for the engine I have the solution and the projects.
First I have Hammer3D and HammerInput and then in Test\Cpp I have the c++ tests projects.
I want to have all my test data into HammerEngine\Debug\Data but for instance if I don't copy the Data folder to HammerEngine\Tests\CPP\Material\ it can't find the file. Although if I run it without any debug it doesn't have that problem anymore.
I've set all the output folders and intermadiate folders to Hammer\Debug and nothing seems to work. Searching on google didn't get me anywhere but maybe I'm not searching right.
Does anyone have an ideea?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Announcements

  • Forum Statistics

    • Total Topics
      628350
    • Total Posts
      2982211
  • Similar Content

    • By koto
      Hello,

      I'm developing a roguelike game. Currently it's in a playable state and I think it's a high time to show it and hopefully get some feedback.

      The game has following features:
      - turn based
      - procedurally generated levels
      - tons of loot
      - spells system
      - trading system
      - some quests
      - some limited crafting
      - door/key/lever mechanics
      - quite a lot of different (look/behaviour) monsters

      Trailer:
      Demo: http://kotogames.com/wp-content/uploads/2017/11/OuaD_demo.zip
      Regards,
      Tom
       
    • By Afambus
      Hello,
      I have a full experienced team that looking for a composer and another 3d designer, im expecting as much from you there are other people in this server that can help you we have a determined team, we have done many things in our game there is more information in the discord about everyone and there skills there region and about the game, if you join the discord pm asap
      https://discord.gg/b2teN3m
    • By BAG Labs
      Mobile SoS

      Platform: Android
      Genre: Board
      Link: Google Play
       
      This games sharpen memory and test your strategies to place S-O-S pattern within time limit and serve 3 difficulties as Easy, Normal, and Hard.

      Goals of the game is to put S-O-S words in patterns (Horizontal, Vertical, and Diagonal) alternately with enemy.
       
      Features:
      Single Player Multiplayer Achievements Leaderboards  
       
      Screenshot:

       

       

       
      Link: Google Play
       
      Please help us improve this game with review
    • By abarnes
      Hello!
      I am a game development student in my second year of a three year program and I would like to start building my portfolio. I was thinking of creating some games to show what I can do to potential employers since I wont have any work related experience when I graduate. But as I'm sure you all know there are tons of ways to approach developing/designing a game and I'm curious if anyone had any insight as to any "standards" that come with this? Is it okay to use game engines like Unity, Unreal, Game Maker etc? Or would it be better to make a game from scratch to better show case your skills? Any and all advice will be greatly appreciated!
    • By Hilster
      Hello 2D Artists,
      I've started making a 2D Puzzle Adventure game for mobile and I'm looking for someone who would want in on creating assets for the game. The core of the programming is pretty much complete, you can walk within the grid laid out and push boxes, when there is an object on top of a pressure pad it will activate the linked objects or if there is one object with multiple linked pressure pads it requires you to activate all points for the object to become active. 

      The level iteration for the game is quick and simple, a Photoshop file that is made of individual pixels that represents objects is put into the game and it creates the level out of those pixels with the assigned objects.
      The objects that need sprites created so far is the character, box, pressure pad, door, trap door, the walls, the stairs and the tiled background.
      I intend to add more objects so the amount I'd like to add will be extended.
      My motivations for posting here is to have something that looks nice to be able to display on my portfolio, so if you're looking for a working game that you can place your art into and improve the look of your portfolio then we're in business.
      Please reply with a few past examples of your art below and I'll be in touch!
  • Popular Now