Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411283 Posts in 69325 Topics- by 58380 Members - Latest Member: bob1029

March 29, 2024, 04:29:29 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The grumpy old programmer room
Pages: 1 ... 191 192 [193] 194 195 ... 295
Print
Author Topic: The grumpy old programmer room  (Read 733444 times)
Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #3840 on: January 03, 2013, 03:26:21 PM »

Probably because - to my limited Java knowledge - everything is treated as signed. And a byte value of >= 0x80, when being automatically expanded to signed 32bit/64bit integer, is expanded to 0xffffff80. Try to OR anything into that Smiley
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
RalenHlaalo
Level 0
***



View Profile WWW
« Reply #3841 on: January 03, 2013, 03:31:00 PM »

If I had to take a wild guess I'd say it might have to do with implicit type-casting. Perhaps the addition of &0xFF causes the compiler to interpret the whole bitwise OR expression along with its two operands as 16bit (or higher) numbers, which would make the <<8 part work correctly -- otherwise bit shifting an 8 bit number by 8 probably isn't what you want. This is just a guess.. I have virtually no experience messing with bits and bytes.

EDIT: On second thoughts, I doubt this is the problem. I think it has to do with signed-ness, as you say.
« Last Edit: January 03, 2013, 03:45:13 PM by RobJinman » Logged

a0x
Level 0
**



View Profile WWW
« Reply #3842 on: January 03, 2013, 04:24:14 PM »

I sort of get that it's something to do with signed vs. unsigned bytes but I don't really see what's happening... samplebufb is byte[] array, so why does masking with & 0xFF make a difference?

You and Schrompf are right, it has some to do with the fact all Java integral types are signed, but it also has a lot to do with Java's implicit casting.  All literal numbers (like 0xFF) are treated as int's in Java, so when you & 0xFF, the byte is casted into an int before the & operation. Which also casts the right side of the | operation into an int (which is good, considering you're shifting it), and the result is casted into a short for the assignment operation. Java likes to handle a lot of your casting for you.
« Last Edit: January 05, 2013, 12:39:30 PM by a0x » Logged
chris_b
Level 1
*


View Profile WWW
« Reply #3843 on: January 03, 2013, 05:06:01 PM »

Thanks, guys - that's cleared up my confusion a lot!  Coffee
Logged
QuadrupleA
Level 2
**



View Profile WWW
« Reply #3844 on: January 11, 2013, 11:15:01 PM »

Code:
void IDEsAndProgrammers::WhoUseRidiculousEndLineLayoutsLikeThis( int here,
                                                                 string uglyAss,
                                                                 uint32_t layoutStyle,
                                                                 int thatWastes,
                                                                 string lotsAndLotsOfSpace );
AreDevelopmentallyDisabled( 42 );                         
Logged

Weapon Hacker - roguelite metroidvania;
Battleship Solitaire - mindless podcast companion
ALourenco
Level 0
***


View Profile WWW
« Reply #3845 on: January 13, 2013, 05:04:10 PM »

In in a mind crush phase. I just try to study or produce something and nothing comes out...
Logged

GameDev Master Student.
Game Engines and Computer Graphics in free time.

@CodinGree
Quarry
Level 10
*****


View Profile
« Reply #3846 on: January 13, 2013, 05:28:19 PM »

Code:
void IDEsAndProgrammers::WhoUseRidiculousEndLineLayoutsLikeThis( int here,
                                                                 string uglyAss,
                                                                 uint32_t layoutStyle,
                                                                 int thatWastes,
                                                                 string lotsAndLotsOfSpace );
AreDevelopmentallyDisabled( 42 );                         

B-but it's more visible!

no joking, I hate those people too *grump grump*
Logged
_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #3847 on: January 14, 2013, 04:01:59 PM »

I have just implemented a ControllerManager. A manager! The One Enemy! Waaagh!
But I had to, I found no better ways to do what I needed Sad
Logged

ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #3848 on: January 14, 2013, 04:04:57 PM »

When you need a manager, you need a manager. Sometimes they're the best solution to a problem. To be used sparingly, of course!
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #3849 on: January 14, 2013, 04:29:53 PM »

When you need a manager, you need a manager. Sometimes they're the best solution to a problem. To be used sparingly, of course!

The appearance of a Manager in the past unavoidably meant that I really fucked up my design badly at some point... and unfortunately this one made no exception.

I just reverted into the void 5 files, 450 lines, and I feel much better Durr...?

I was making a wrapper around Input to wrap Joysticks and the keyboard, without realizing that I could abstract both at the source (ie. with a Controller class) AND at the same time add the key-mapping thing.

EDIT: all working now, with user defined button bindings, a single big enum for any button you will be ever able to press, and the power to swap keyboard with a pad or AI inputs without the Player even noticing :D
If you ever see a Manager, run!
« Last Edit: January 14, 2013, 07:11:26 PM by _Tommo_ » Logged

sublinimal
Level 8
***



View Profile
« Reply #3850 on: January 15, 2013, 05:49:34 AM »

Haven't we, as programmers, collectively agreed that no design option should be dismissed as inherently flawed?
Logged
Quarry
Level 10
*****


View Profile
« Reply #3851 on: January 15, 2013, 06:08:48 AM »

But then for what reasons we would argue on?
Logged
sublinimal
Level 8
***



View Profile
« Reply #3852 on: January 15, 2013, 06:10:32 AM »

On making good gams, or something.
Logged
QuadrupleA
Level 2
**



View Profile WWW
« Reply #3853 on: January 15, 2013, 11:31:36 AM »

Interesting, never heard any religious opposition to managers as a design concept before - I've used them to great effect. InputManager, RenderManager, SoundManager, MusicManager, TextureManager. All global variables. Vastly simplifies coding the behavior of individual objects in the world.

It's funny, I've developed a kneejerk suspicion of any "conventional wisdom" in the programming world over the years. Like sublinimal said, no design option should be dismissed as inherenty flawed - gotta evaluate its merits in each particular situation.
Logged

Weapon Hacker - roguelite metroidvania;
Battleship Solitaire - mindless podcast companion
_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #3854 on: January 15, 2013, 11:41:32 AM »

I'm not "against" managers, they're good when they model an actual service (I do use an InputManager, a SoundManager and a Render myself), but when they arise to solve a "communication problem" between classes they 99 times on 100 it means that you've fucked up... or at least that there's a much simpler way to do whatever you're doing Smiley

Which was exactly the situation I had here - reworking the base classes to make them more generic perfectly removed the need for a Manager, and for most of the code I had written.

Maybe I just hate them after scrapping my old completely overengineered and unusable component-systems-with-manager engine, but each time I can make without one I'm happier Smiley
Logged

Belimoth
Level 10
*****


high-heeled cyberbully


View Profile
« Reply #3855 on: January 17, 2013, 04:48:26 AM »

Scribbled a solution to a programming problem last night in my sleep.
It evidently involves something called an 'ArrayEater' and I have no idea what that means.
Logged

Ben_Hurr
Level 10
*****


nom nom nom


View Profile
« Reply #3856 on: January 17, 2013, 01:09:28 PM »

Maybe it involves doing dark service for the bit gods beyond the stars?
Logged
Belimoth
Level 10
*****


high-heeled cyberbully


View Profile
« Reply #3857 on: January 17, 2013, 02:47:32 PM »

That would explain the sigils all over my notebook.
Logged

Belimoth
Level 10
*****


high-heeled cyberbully


View Profile
« Reply #3858 on: January 17, 2013, 02:48:51 PM »

No, wait, those are UML diagrams.
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #3859 on: January 18, 2013, 08:36:51 PM »

That would explain the sigils all over my notebook.
This got a titter out of me, heh.

Reworking broadphase stuff in an engine prototype, getting jitter that I dont get with the N^2 comparison method. The hangover probably doesn't help Tired
Logged

Pages: 1 ... 191 192 [193] 194 195 ... 295
Print
Jump to:  

Theme orange-lt created by panic