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!


AlanSmithee

Member Since 19 May 2011
Offline Last Active Today, 07:33 AM

#5213190 Architecture vs Performance [Android game]

Posted by AlanSmithee on 26 February 2015 - 03:09 PM


We can't tell you much without seeing the full code.

I didn't start writing a game code yet. I only think over implementation.

Premature optimization is the root of all evil.

Well maybe not, but on a more serious note; you should focus on getting a sound architecture and deal with any potential performance related issue when (if) it comes. Truth is you don't know enough about any potential issue to solve it until you've seen it. You are just as likely to introduce problems as you are to fix them should you do it now.


#5205978 Encapsulation through anonymous namespaces

Posted by AlanSmithee on 22 January 2015 - 07:41 AM

Thanks guys!

 



However, the 'there can only be one' and thus the singleton/global-state is a code smell. Why dictate that the library has to have a single global state and restrain it like that if you don't have to?

 

This is something I have been thinking about a lot.
For example; in a thread discussing something related, someone talked about using multiple instances of a rendering engine for debugging purposes.
This is a very valid point and I am taking this into consideration.
 
One approach I am considering is encapsulating all state-related information into a class or struct, say "Renderer", and leave the public interface as free functions (with anonymous "helper" namespace):
 
namespace // private helper methods and variables (constants etc)
{
    int DrawHelper(const RenderAPI::Renderer& renderer)
    {
        return renderer.GetSomething();
    }
}
 
namespace RenderAPI // public renderer API
{
    class Renderer
    {
        public:
            int GetSomthing() { return _something; }
 
        private:
            int _something;
    };

    Draw(const Renderer& renderer)
    {
        DrawHelper(renderer);
    }
};
 
Which seems like a good tradeoff to me.. Think this would be overengineering?



#5202780 Handmade Hero discussion thread

Posted by AlanSmithee on 08 January 2015 - 03:28 AM

Watched the first episode yesterday after hearing Jonathan Blow talking about him (which I guess is not so weird, now that I know he was a coder for "The Witness") and was pleasently surprised.

 

Personally I am pretty good at coding, but very bad at everything "around" coding, such as build systems etc, and it looks like he is covering stuff like that, so I will continue watching it. =)




#5194383 Entity Component System - Accessing Components

Posted by AlanSmithee on 24 November 2014 - 05:18 AM

Since you do not describe how you are defining and using your components (other then that they are accessed through a method), it is hard to give any direct advice as how to store and access them.

 

There are many forms of entity-compoennt systems - some where an entity an object with a list of components and others where an entity is just a an id and the components are stored in seperat lists and accessed through that entity id.

 

I am personally using an approach based on the latter (where an entyity is represented by an id) since I like the simplicity and performance of that method,

I also think its very readable, but it can be a bit hard to wrap your head around initially if you are more used to the object oriented style of programming.

 

I started out by following some great articles here on gamedev:

 

http://www.gamedev.net/page/resources/_/technical/game-programming/understanding-component-entity-systems-r3013

http://www.gamedev.net/page/resources/_/technical/game-programming/implementing-component-entity-systems-r3382

http://www.gamedev.net/page/resources/_/technical/game-programming/case-study-bomberman-mechanics-in-an-entity-component-system-r3159

 

Have a look and see if that is something you could use maybe.




#5194307 Problem with perspective in opengl

Posted by AlanSmithee on 23 November 2014 - 01:57 PM

wow..

 

I was passing GL_CW instead of GL_CCW to glFrontFace()... it works fine now!

 

I can also tell that when i thought i was rendering it correctly (using inverse of aspect ration) it was acutally rendering it from behind, which I guess is why glFrontFace(GL_CW) worked.

 

Thanks a lot!

 

(for any future reader having this problem, these are the flags I set to get the model to render properly)

 

glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glFrontFace(GL_CCW);
glCullFace(GL_BACK);



#5126717 SDL_CreateTextureFromSurface issue

Posted by AlanSmithee on 27 January 2014 - 07:43 AM

Hi!

 

Maybe you are confused by my code, i declared load_imge to return a bool, which mas a typo, it should return a Image object and the loader class should be separate from any other class.

 

An example:

 

Window.h

class Window
{
  public:
  //...
    SDL_Renderer* get_renderer() { return _renderer; }
 
  private:
  //...
    SDL_Renderer* _renderer;
};

ImageLoader.h

class ImageLoader
{
  public:
    Image const& load_image(SDL_Renderer*, std::string const&);
};

main.cpp

{
  Window window;
  ImageLoader imageLoader;
  Image image;
 
  //...
 
  image = imageLoader.load_image(window.get_renderer(), "foo.png");
  if (image == nullptr)
  {
    std::cerr << "Could not load image" << std::endl;
  }
 
  //...
}

Or something like that, sorry for any confusion i might have caused.




#5126296 Can someone help me think of a creative name for my puzzle/tower defense game?

Posted by AlanSmithee on 25 January 2014 - 05:34 AM

First of all, I agree with jbadams that it's a nice concept you have for your game!

 

There are some tower defence games out there that have pretty generic names, but I still remember them of the top of my head, like desktop tower defence, bloons tower defence. These games are just regular tower defence games though. You probably want a name that captures the spirit of combination of "match 3" with tower defence.

 

I dont have any concrete names for you, but a method that can help you come up with your own name is to write down words that represents each genre in two columns and then try different combinations and variants. You can use more columns if you want to incorporate more names, like your business name etc.

 

Good luck.




#5125113 Is HTML5 a legit language for developing game?

Posted by AlanSmithee on 20 January 2014 - 12:50 PM

Hi!

 

Developing games in HTML5 has a lot of advantages over other environments/frameworks/languages, such as platform independant distribution (the browser is the patform) and no downloads required to play the game etc.

 

The things that I found to be bothersome is that there are some things that you, as a developer, cannot take full control over, such as mouse lock and fullscreen mode etc. There are API's for this, but as far as I have been able to discern, they do not quite simulate the same behavior as native applications, as far as control is concerned.

 

I guess it depends on what kind of a game you want to develop.. I have found that HTML5 games (or browser games in general) are more accessible - just navigate to the URL of the game, but at the same time it is just as easy to stop playing - there is no "investment" in playing the game.. which would probably affect how the game is played.. (favors shorter playing sessions etc)

 

PS. HTML5 is a collection of techniques in HTML, CSS and JavaScript, and not a language




#5125051 Help

Posted by AlanSmithee on 20 January 2014 - 08:32 AM

I agree with wath BitMaster said.

 

It should also be said that it is possible to design and create games without much programming at all, using an engine or software such as Unity or GameMaker.

Haing said that, personally I would do pretty much as what BitMaster suggested.




#5125008 sandbox openworld survival game *to quest or not to quest

Posted by AlanSmithee on 20 January 2014 - 04:52 AM

Hi!

 

I don't have a good answer to your specific questions, but one "rule" that I think goes a long way in game design is that "doing one thing really well is always better than doing many things half-assed". This is true for many popular games that builds around a simple concept and delivers really well within that concept.




#5124426 Is using Java a good way to create a game?

Posted by AlanSmithee on 17 January 2014 - 10:44 AM

 

Java is fine as any other language to make your first game, but a RPG game isn't in my opinion.

That's a rather particular genre that this general purpose language can't seem to handle correctly. Why do you think so?

 

 

He was probably referring to the "make your first game" and not the coding language ^^ (as in a RPG might not be the best genre to try as your first language) I don't have any opinions on that though.

 

Edit* Maybe you were just making a joke boogyman.. Wouldn't be the first (or last) time sarcasm got the best of me over the internetz lol




#5122593 Component based game and component communication

Posted by AlanSmithee on 10 January 2014 - 07:49 AM

Hi!

 

Im not sure of how your current setup is working, and what a "subsystem" is, but in general a system should act on an entity with one or more component.

For instance, the MovementSystem could move an entity that has a displacement and velocitty component, the RenderSystem could render an entity that has a displacement and appearance component etc. This way the system needs to know about certain components, but the components does not need to know about each other.

 

Look here: http://www.gamedev.net/page/resources/_/technical/game-programming/implementing-component-entity-systems-r3382

 

In some cases I guess components will need to know about each other, I do not have that need yet, so I can not offer you a good answer.

I do however think you should implement some sort of messaging system.

 

Look here: http://www.gamedev.net/page/resources/_/technical/game-programming/case-study-bomberman-mechanics-in-an-entity-component-system-r3159

 

Good luck =)




#5122227 "Proper" state management for CBE

Posted by AlanSmithee on 08 January 2014 - 02:09 PM

Hello there!

 

I too have had my share of problems implementing a finite state machine.

I have found the very last answer in this thread (the post from Henrique Barcelos) to be a very good starting point.

It is easy to understand and the implementation is very generic.

 

Good luck!

 

*EDIT: I guess I didn't really answer your question..

 

First of all I agree with phil_t that you should try to keep your components more generic in general.

If you do follow the example that I posted a link too, I think a good idea would be to put the system parts of the ECS in the machine and component parts in the states.

 

Something like this psuedo code..

// In machine.cpp

void Machine::on_render()
{
  _state->on_render(*this);
}
 
// In some state.. lets say play-state.cpp
void PlayState::on_render(Machine& machine)
{
  machine._renderSystem.on_run(this->_world);
}

..where _renderSystem is a local RenderSystem in machine and _world is a local container of components (enteties)




#5121874 Multiple constructors for Animation class has duplicated code. How to fix cod...

Posted by AlanSmithee on 07 January 2014 - 04:50 AM

Yes, a call to another constructor must always be on the first line, forgot to mention that, sorry.




#5121773 Multiple constructors for Animation class has duplicated code. How to fix cod...

Posted by AlanSmithee on 06 January 2014 - 06:05 PM

Java and C# are verly much alike in syntax..

 

Just a minor change from what ferrous said

public class A
{
  private int a;
  private String s;

  public A()
  {
    this(1);
  }

  public A(int a)
  {
    this(a, "something");
  }

  public A(int a, String s)
  {
    this.a = a;
    this.s = s;
  }
}

(A not so useful example, but you get it the just of it, I hope)

 

The constructors are differentiated by their signature (arguments) so you should be able to cascade the constructor calls in a nice way to suit your needs. The general rule of thumb is to chain from fewest arguments to most arguments.

 

In java,there is also a thing called "variable length argument lists" http://www.deitel.com/articles/java_tutorials/20060106/VariableLengthArgumentLists.html, it might be something that you can have use of in some situation...






PARTNERS