Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 17 Dec 2009
Offline Last Active Today, 02:08 AM

Posts I've Made

In Topic: Byte and double byte numerals

15 December 2014 - 01:26 PM

This is what i get with VS13:

				uint8_t var = 0xFF;
00346602  mov         byte ptr [ebp-51h],0FFh  
				uint16_t var2 = var << 8;
00346606  movzx       eax,byte ptr [ebp-51h]  
0034660A  shl         eax,8  
0034660D  mov         word ptr [ebp-60h],ax  

When you load the value from var into the register, it doesn't care how large the variable was, the value from it now resides in a 32/64 bit register. When it does the shift, it's doing it in a 32/64 bit context. Storing it into var2 just means it's going to take the bottom 16bits, truncating if necessary.

In Topic: Minimalist Programming Environment

15 December 2014 - 01:03 PM


Seriously? That's the reason you're not using the most powerful IDE on windows?


And no.  I've been using Microsoft compilers since DX 7.0 and VC++ 6.0.  They are awesome.  Again, not what I was talking about.  I didn't do a very good job explaining my question.


Nobody said anything about compilers :) The question was about IDE, which encompasses much more than a call to the compiler with a bunch of args, which is something you'd do through a .bat file in your minimalist approach.


But hey, if you're aiming for something like what Casey is doing on Homemade Hero, props to you. I think he makes it look easy because it's something he did a thousand times over, and has a lot of stuff prepared from before, and has been doing it for a long time (specifically, i mean the emacs config).


If you simply don't like the VS editor, that's perfectly fine, but don't say it's because of the all caps menu titles. :)

In Topic: Minimalist Programming Environment

15 December 2014 - 11:25 AM

I don't like the ALL CAPS tabs at the top

Seriously? That's the reason you're not using the most powerful IDE on windows?


How much time do you spend looking at the menu text, and how much time do you look at the code? o.0

Besides, as Oberon says, it's fixable.

In Topic: One Time per Press Events vs. Continuous Events

12 December 2014 - 01:58 AM

I have individual update() and draw() methods for each object, but update() is acting like react(), which now that I think about it probably would be a good idea to seperate it.

In my opinion, having an update() method on objects is not a good idea, because you can't fully update one object at a time, things should be done in a lock-step sort of way.

This is code from my logicUpdate part of the game loop:

updateBullets(m_bullets, m_monsters);
VKillLocations locations;
killMonsters(*this, locations);
generatePickups(locations, *this);
generateSplatter(locations, *this);

The 'this' pointer is the Game class that contains the lists of players, enemies, projectiles, etc, and systems like graphics, input, etc.

Much more fine grained, explicit, and flexible to changing the order of operations. And each step produces a new partial state for all objects, so i don't get any issues with mismatching states between objects during part of one objects update. I find this to be much better than a magical update() method on objects. :)


I was actually thinking I should probably rewrite my movement code to work with events rather than a straight key array. What can I use the flag for in that case?

The flag in my little code example should be different for every thing you need. movingLeft, movingRight, movingForward, movingBackward, movingUp, movingDown, shooting, lockpickingDoor, ....., you name it. For each continuous action you want to have in your game, make a flag for it and name it appropriately. Then set that flag as i showed in the little example. :)

In Topic: One Time per Press Events vs. Continuous Events

11 December 2014 - 01:59 AM

First, read this post from L.Spiro. It's a great read :)


The idea is that you should handle events only, and not rely on SDL_GetKeyState. With SDL_GetKeyState, you might miss some of the input the player sends if you get a short stall in your game. What i would do:

First get only the events that pertain to the frame you're calculating now.

Handle only those events, by looping over them, and setting your own flags, something like Servant does with his MoveLeft flag.


For continuous actions, set your flags, and do stuff by checking those flags. The flags are set on SDL_PRESSED, and reset on SDL_RELEASED.

For one-time actions, set a flag on (SDL_PRESSED && repeat == 0), and reset the flag by your handling logic, something like "if(flag) { flag=false; doTheActionForFlag(); }".