Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 18 Mar 2013
Offline Last Active Yesterday, 01:38 PM

#5203805 Looking for a good way to make games in C/C++ on linux for cross-platform

Posted by EarthBanana on 12 January 2015 - 06:08 PM

Although you will need additional libraries for other features such as file searching, etc.


lol You will need additional libraries, like OpenGL in order to load the shaders that you might write, and to give those shaders anything to possibly draw

#5203804 Weird framerate drop

Posted by EarthBanana on 12 January 2015 - 06:00 PM

Any time I have had weird frame rate drops like this is has been either because my program was sending stuff to the GPU to render in some format it didnt like (for instance mapping to GPU vetex buffer with some parameters set incorrectly) or because im allocating/deallocating memory in a bad way


With java I know it does all of the allocation and de-allocation for you - so I'm not sure how you could go and check something like this. Possibly run without doing certain things and see if you still have the issue.

#5203634 Whats the task of the programmer in this video game?

Posted by EarthBanana on 12 January 2015 - 03:40 AM

This would take a very long time to implement even using tools such as Unity or GameMaker..


One project that is kind of similar (in the sense that it uses 2d background painted images) is a project launched in a kickstarter campaign which aims to create another "infinity engine" style game. The link is here:




This project, which perhaps is a bit larger in scope than what your thinking, has taken a lot of very good programmers, artists, tools developers, etc over a couple years to build. They are using Unity with 2D graphic backgrounds for all of their game areas.


I'm not trying to discourage, just try to get yourself some well defined realistic bounds. For example, write a plan of creating one small dungeon with this art style etc.. If you keep your goals smaller then you can always expand on them if all goes well. But when developing games, there are always these random things that make stuff take a long time compared to what you though it would take.


Good luck!

#5203601 Getting Visual Studio and Dreamspark

Posted by EarthBanana on 11 January 2015 - 08:31 PM

It really doesn't matter what you download - you will be able to build a c++ executable as long as it has the build tools. All the other stuff is extra - doesn't hurt you but it will be a long time before you ever really care about any of it.


This is actually where my biggest problem with VS comes in - it is a really nice tool for debugging - and I don't have any complaints about its compiler - but I will say that it really seems to aim at making you think building a c++ program is more complicated than it is. I really feel like there are a lot of programmers today that wouldn't have a clue on how to use the command line compiler - that is if there was no IDE they would be at a loss on how to build their program.


I highly recommend you take your time and learn how to use the VS command line build tool without the IDE - im not saying always do this.. but if you take the time and learn how it works and what it is doing it will really save you a lot of time down the road. It will especially be a lot easier for you to figure out things like linker errors and such.


I see a lot of posts around the internet which basically show VS linker error printouts and people clueless on how to fix them.. This really comes from a lack of understanding in what a compiler is actually doing.


Just my two cents

#5194501 introducing myself, guidance requested

Posted by EarthBanana on 24 November 2014 - 05:26 PM

Python is a great language - its just plain useful to know, and very generous in teaching programming concepts. Great choice!

#5194363 Entity Component System - Accessing Components

Posted by EarthBanana on 23 November 2014 - 11:59 PM

Are you using a base component class such as Component and deriving all of your components from this type, with an array of components given to each entity?


If so then I'm assuming you get a component from a given entity - IE

Entity * obj = new Entity(); // Lets pretend it is created with a TransformComponent

TransformComponent * tForm = obj->getComponent("TransformComponent");

If you are using your entities as component containers then you could use a std::unordered_map with a string key type and Component * value type - then every time you make a component you could create a static function that returns the typename  so that you could type

Entity * obj = new Entity(); // Lets pretend it is created with a TransformComponent

TransformComponent * tForm = obj->getComponent(TFormComp::getTypeString());

You could then make your entity class support a templated type for your component so that you could do

Entity * obj = new Entity(); // Lets pretend it is created with a TransformComponent

TransformComponent * tForm = obj->getComponent<TFormComp>();

and in your Entity class use the static method to actually get the value from your std::unordered_map like this

// Inside your entity header file

class Entity
typedef std::unordered_map<std::string, Component*> CompSet; // typedef to make accessing the unordered_map less verbose
// Other functions

template<class CompType>
CompType * getComponent()
	CompSet::iterator iter = mComponents.find(CompType::getTypeString());
	if (iter != mComponents.end()) // check to make sure it has the comp
		return (CompType*)iter->second;
        return NULL;
CompSet mComponents;

Something along these lines



the std::unordered_map operates using a hash table internally so it should be constant look up time

#5193693 Need some tips for a Project

Posted by EarthBanana on 19 November 2014 - 05:43 PM

In my experience professors are going to be more interested in the publication/development process rather than any final game product - that being said you will probably want to do research and talk about all of the different choices there are for the development process. Then choose the shortest possible development time route for yourself and make the simplest possible game - and then talk about the different choices and options for taking it through to publication.


I would suggest that you do not put a lot of effort or time in to the gameplay or graphics or anything like that - because your professors simply are not going to care. Just get a bare bones game working - possibly even a game clone.


If you want to start a game project with the goal of making a really fun/cool game - I would suggest you do it after the semester ends not as a part of this particular project.


Just my two cents - I'm a graduate student in EE and have a lot of experience with this type of thing

#5193387 Live re-sampling playback speed changes using SDL mixer?

Posted by EarthBanana on 18 November 2014 - 12:09 AM

I don't know anything about SDL - can you supply the sampling frequency anywhere for SDL for the individual tracks playback? If so just reduce the playback sampling frequency by the amount you want the soundclip slowed - ie if your sampling frequency is 44.1k and you want the speed to be 2/3 of normal, set sampling frequency for that clip to 2/3 * 44.1 kHz for playback.

#5178571 Best 2.5D Game Engine for beginners?(obviously little programming)

Posted by EarthBanana on 06 September 2014 - 01:06 PM


#5173692 Normals question

Posted by EarthBanana on 14 August 2014 - 03:01 PM

So I solved the problem - thanks to a closer look at the shader which was inspired by the above post by Buckeye.


As mentioned at the end of the last post - the problem was within the normal map reading.. but it wasn't exactly what I thought. In the shader I have a couple bools (hasDiffuseMap, hasNormalMap, hasOpacityMap, etc.. ) that are set on a per material basis..


Well in the rendering code I was setting them to true for materials that had it, but not false for materials that didnt.. Since the same GBuffer shader is used for pretty much all materials these bools remained true even when there wasn't a map available.. this resulted in invalid texture reads for the objects that didnt have normal maps


I fixed it by setting the hasMap booleans to true or false for every single material


This fixed a lot of other strange lighting artifacts I was having with specular also

#5167647 Game engine architecture

Posted by EarthBanana on 18 July 2014 - 11:48 AM

Assimp does not limit 1 material per mesh - very roughly speaking what Assimp calls a Scene is what LSpiro is referring to as a mesh, and what Assimp calls a Mesh is what LSpiro is calling a Subset


Assimp loads the "Scene" as an array of "Meshes" which each have an index in to the array of Materials for the scene


This translates, in my engine, as a Mesh which contains an array of Submeshes, each with integer handles to the material.. Each Submesh can refer to only 1 material.. Each Material then contains an integer handle to the Shader responsible for drawing the material


When using components, don't call your resources components - anything that you have to load could be considered a resource - textures, meshes, animations, audio clips, shaders, etc

You only want to load these things once - and either pass around handles or pointers to these within the engine


IE if you want to have a Render component, it should contain a pointer or handle to a mesh rather than the mesh itself

#5167641 Assimp with Visual Studio Express 2013 and CMake

Posted by EarthBanana on 18 July 2014 - 11:08 AM

Why are you building it yourself? It comes with the necessary lib files for x64 and x86 - you simply need to add the libraries to your project..


Also you will have to add the assimp32 or assimp64 dll file (located in the bin/x86 or bin/x64 folders respectively) to the same folder where visual studio puts your build exe file


To include the libraries just uncompress the sdk to some folder like c:\Assimp

Then add the include path for assimp to the include path for VS2013

To do this right click on your project in solution explorer, go to properties and under Configuration Properties go to VC++ Directories


Under "Include Directories" add the c:\Assimp\Include (or wherever yours is at) folder

Now under "Library Directories" add "c:\Assimpl\lib\x86" assuming you want to use the 32 bit version

Now click on "Linker" in the left pane and add "assimp.lib" to the Additional Dependencies section


Finally go to your Assimp\bin\x86 folder and grab the Assimp32.dll and put it wherever the program your writing's exe is at


I am not using the brand new assimp library - but a recent version (from a few months ago) so the procedure should be the same


To use assimp just #include <assimp/whatever assimp file you need>


Hope that helps - if you already know all this then sorry!

#5153783 Can a non-programmer make games?

Posted by EarthBanana on 15 May 2014 - 08:30 AM

You know - just thought I would mention - I hated computer science.. It just wasn't a very fun or challenging program at my University. I got my degree in something else instead that I was more interested in while learning to program on my own.


I love programming and I have made a lot of stuff by now!


My point is that just because you don't like comp sci doesn't mean you don't like programming or coding in games. Go ahead and get your degree in a program that is interesting to you at the University you are attending - but try learning some programming on your own for fun. I think you will be surprised at how much fun stuff you can do without needing a computer science degree.

#5153591 Creating a Data Block Loader or something?

Posted by EarthBanana on 14 May 2014 - 10:14 AM

You can use templated classes to load different types - in fact its how I load different types of components in to one component vector.. just make whatever your container class is (in my case Entity) templated so that it can call new TemplateType() on whatever subclass type you are trying to add to the vector..


ie my templated Entity class adds components like this

	template<class CompType>
	CompType * createComponent(NSbool pOverwrite=true)
		CompType * comp = new CompType(this);
                mComponents[CompType::getType()] = pComp;
		return comp;

 where mComponents is a vector of component pointers (I removed some error checking stuff to make it more readable)... I personally use a known index system so that certain components are always at certain positions in the vector - but that is irrelevant for you - you could just add the new component with a push back


Also - when you get you menus.. if you have a templated container class to get them from - you can get them without having to typecast each time... just define a getMenu function and do the typecast within the function returning the templated type.. something like this..

template<class MenuType>	
MenuType * getMenu(std::string & pMenuName)
	if (hasMenu<MenuType>(pMenuName)) // check to make sure it has the menu
		return (MenuType*)mMenus.findMenu(pMenuName); // do the typecast here - you might want to use a different type of cast but even this should work
	return NULL; // if no menu was found return NULL

Hope that helps

#5151662 What is your opinion and how would you do a structure that has multyple funct...

Posted by EarthBanana on 05 May 2014 - 12:32 PM

It seems like you are trying to implement a component system - I agree that you don't really need bit fields to do that - why don't you do something like make a base struct called Component (or something similar) and then make all of your other structs inherit from that struct?


In your objects you could do something like have a vector of pointers to Component structs.. then you can add and remove components dynamically


You could either create virtual serialize and deserialize functions in your base component struct that inheriting structs must define for writing and reading their contents to and from file - or if you make all parts of your struct components constant sized (ie no std::string or pointers or anything like that) you could directly read and write them to file as lump memory blocks ( outFile.write((char*) myComponent, sizeof(MyComponent)) )


Just an idea