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!


Madhed

Member Since 13 Jun 2001
Offline Last Active Yesterday, 06:54 PM

#5188643 O(pow(N,12))

Posted by Madhed on 22 October 2014 - 06:23 PM

c3d0981ae770f926eedf4eda7505b006.jpeg




#5188641 Is optimization for performance bad or is optimizating too early bad?

Posted by Madhed on 22 October 2014 - 06:21 PM

Optimizing is bad if your "sub optimal" code is actually running perfectly fine on the target system and you have more important things to do.

Optimizing code that you haven't tested is bad because you are most probably fishing in the dark.




#5188640 C++ header inclusion question

Posted by Madhed on 22 October 2014 - 06:16 PM

I think #2 should actually read: "Only include headers in headers if you can't get away with forward declarations"




#5187648 How to remove GET variables from URL in php

Posted by Madhed on 17 October 2014 - 08:50 AM

That's the whole point of GET. The parameters are added to the url.

Either I didn't understand the problem correctly or what you are trying to do is impossible.




#5187214 What's best (Custructor Arguments)

Posted by Madhed on 15 October 2014 - 01:28 PM

If your constructor takes too many arguments, well... make it two classes or more. biggrin.png

Could be a sign that your class tries to do too much.




#5187037 How to Separate the Rendering Code from the Game Code

Posted by Madhed on 14 October 2014 - 04:29 PM

The main selling point of ECS is code reuse and separation of concerns. By breaking up your typical classes into small self-contained components you can easily build more complex behaviours by combining them.

Cache coherency is a nice side effect that *can* occur if you design your systems right.

 

As for the mostly empty list, you could simply sort your objects so that unused ones get appended to the end of the list. Then you can trivially stop iterating once you hit the first unused element.




#5186053 safely researching PC games

Posted by Madhed on 09 October 2014 - 02:07 PM

Steam?




#5184541 passing data between objects using messages... wat do?

Posted by Madhed on 02 October 2014 - 05:17 AM

It sounds like you are trying to implement a completely dynamic system without any explicit dependencies. While this is possible it completely circumvents c++'s type system with respect to classes.

Also it is arguably far worse to have dependencies implicitly encoded within your code rather than explicitly enforced at compile time.

 

Reality is, there will always be dependencies. No object is an island.

There exist different design patterns to deal with these dependencies. The mediator pattern is the first than comes to mind.

 

As for circular dependencies, if you write your headers the right way (inclusion guards, forward declarations) and design your game right you won't have problems here.

 

Sounds to me like a case of premature optimization.




#5184439 passing data between objects using messages... wat do?

Posted by Madhed on 01 October 2014 - 05:31 PM

Why not simply store a reference to the Time object in the Mario object when you create it?

Mario is apparently dependent on Time so I see no reason why this should be done with messages.




#5184163 This chat, apparently, is a gigantic coding horror

Posted by Madhed on 30 September 2014 - 04:31 PM

It's especially funny since javascript already has a built in function called encodeURIComponent which replaces certain characters with their respective safe counterparts.




#5183482 Hand painted textures **UPDATED**

Posted by Madhed on 28 September 2014 - 08:47 AM

Looks way better. I think you don't even need a normal map for this art style as the diffuse texture already has a lot of lighting in it and the look is very cartoony,




#5180136 Code organization without the limitations of files

Posted by Madhed on 13 September 2014 - 06:06 PM

I think this is one of those cases where an implementation detail forces you to use a tool in a specific way. ie. code stored in a hierarchical filesystem forces you to structure your program in such way.

The problem with hierarchies is that they are strict and rigid and force you to put your code in a dichotomy that is very ill suited for a multi dimensional problem like computer programs.

 

What you want is to abstract away the file system from the programmer and treat it as an optimization problem for the IDE to feed into the compiler.

Ultimately the source code would be stored in database that is closely modeled after the language specification, as a normalized, canonical representation of the program.

 

All the features that you wrote about would then be views on top of that database. That way you can choose a representation that fits the task you are currently trying to solve.

 

Big problem I see with this, like others have said, is the tight coupling to the IDE.

 

But it could be interesting nevertheless, I actually thought about this exact thing before.




#5178669 How difficult(or not) do you find these C++ tests?

Posted by Madhed on 07 September 2014 - 06:26 AM

I really don't like these kind of tests. Yes, they are called "c++ tests", but what is really tested here is specialized knowledge of a few very specific langauge concepts probably containing more than one gotcha. Almost like a trick question, and I don't like trick questions.

 

What I'd be more interested in a candidate is quickly grasping large-scale code structure, ability to visualize class dependencies, debugging, refactoring, all in all skills that are not bound to a specific language.




#5176088 Moving from dinput to RAW input (mouse)

Posted by Madhed on 25 August 2014 - 04:30 PM

Handling windows messages is not that hard though. And you are guaranteed to not miss anything.




#5176082 Moving from dinput to RAW input (mouse)

Posted by Madhed on 25 August 2014 - 04:03 PM

I personally never bother with Windows messages and use the API functions directly. Look up GetCursorPos() for mouse movement and GetAsyncKeyState() for keypresses. These will give you immediate values which you can process at your own will.

 

GetAsyncKeyState() can miss key presses when the framerate is low or the key was pressed very quickly.






PARTNERS