Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 02 Mar 2006
Online Last Active Today, 12:18 AM

Posts I've Made

In Topic: the very best resources I found for game programming

Today, 12:20 AM

Speaking of "Pro", one can't call himself professional if he only knows one language, try and know at least 3

Actually, if you get paid to write software, you are professional. Any other metric is pretty meaningless.

In Topic: Coding-Style Poll

Yesterday, 02:29 AM

I find braces not on their own line very hard to read. Believe this is K&R style?
for(int i = 0; i < 10; ++i) {
My brain just cannot process that. I can only handle:
for(int i = 0; i < 10; ++i)
Professionally, I fit in with what others do but I'm fortunate that my current colleagues are "own-line-brace" guys too, as I would be at a major disadvantage if I had to write and follow code like my first example. But I suppose I'd just adjust to it.

My colleague has a very weird habit that I've adjusted to now:
class Foo
    const int*
    method() const;

const int*
Foo::method() const
End of the day, I hated this when I first saw it, but within a week or so I'd adjusted and I now flip between "work code" and "home code" without any problem whatsoever.

In Topic: the very best resources I found for game programming

Yesterday, 02:24 AM

But I have a problem, I can't go beyong basics in programming. I do not have ideas of what to code next, I still don't have the ability to create my own code (program) by myself. I have to follow tutorials, when I try to code by myself I dont do that good.
So my question is, what is the programming best practice??

Stop focusing on learning. Start focusing on achieving. You need to set yourself a specific goal, then learn just what you need to accomplish that goal.

Don't worry about how much you "know" or have "learned" or if you feel like an "expert". All of that is worth absolutely nothing if you can't produce an end result.

Once you have accomplished your goal or you get bored and want to move on, consider a new goal that stretches what you already know a bit further, but not so far further that it destroys your motivation.

I've been at this lark for over a quarter of a century now and I'm learning every day.

In Topic: Get pixel's location

24 September 2016 - 03:02 AM

Sorry for the accidental down vote. Thumb slipped and can't seem to undo it. Reply and I will up vote to compensate.

In Topic: 3D World Editor - Suggestions and Ideas

23 September 2016 - 01:25 AM

In my experience, undo/redo needs to be designed in from the very beginning. It is a nightmare to retrofit to an existing project so I'd focus on it as soon as you can.

Then general idea is as explained above. The only way you should be able to modify your state is via Command objects, which store enough information to be able to undo and redo themselves.

I use the C++ const system to enforce my undo/redo system at the code level. I have a WorldState object that just contains bare read-write data for the world state. This is then wrapped in a World object which provides const-only access (read) to the world state. Eveything like views, toolbars etc uses the World interface to read the state.

The World also has beginCommand(Command*) and endCommand(Command*) methods that take classes deriving from Command. When one is passed to beginCommand() it is given a pointer to the WorldState so it can directly modify the values, but must take responsibility to undo itself and redo itself. When endCommand() is called, if the command is valid, it is pushed onto an UndoStack in the World object.

So the only way to modify the WorldState is via Command objects. It is not possible via any other mechanism so you can't accidentally fall outside the system.

It can feel a bit weird at first that every time you want to modify something, you have to create a Command to do it, but for me it is really the only way to ensure the system is comprehensive and you soon get used to it.

Hope this helps.