1. Post #3081
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    Can someone explain why reading unaligned memory is slow, I've seen it talked about loads but never really explained.

    I've even seen some C++ structs which had 3 floats, then an extra float just for padding, supposedly because of this mysterious memory alignment.
    The CPU is only able to read word aligned data from memory. x86 is quite forgiving and will let you read from unaligned addresses too, but it's slower because it has to read two words and then do shifts and bitmasks to get the data you want
    Reply With Quote Edit / Delete Australia Show Events Informative Informative x 8 (list)

  2. Post #3082
    At least make it drag with the mouse, not follow it like on an elastic.

    I can see that getting extremely annoying when your moving your mouse to the right since it would get under it.


    Edited:

    Still elastic, but just much more faster.
    Reply With Quote Edit / Delete Windows 8 Netherlands Show Events Artistic Artistic x 1 (list)

  3. Post #3083
    Gold Member
    Downsider's Avatar
    July 2007
    1,999 Posts
    learn to optimize your draw calls scrub

    Edited:

    shithead king poster
    You can't in SFML. Every sprite drawn prompts a draw call. SFML sucks.
    Reply With Quote Edit / Delete United States Show Events Disagree Disagree x 8 (list)

  4. Post #3084
    Gold Member
    danharibo's Avatar
    July 2006
    4,488 Posts
    You can't in SFML. Every sprite drawn prompts a draw call. SFML sucks.
    Use SFML to get a window, use OpenGL to draw your shit.
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Agree Agree x 5 (list)

  5. Post #3085
    Richy19's Avatar
    May 2010
    5,384 Posts


    Still kinda bad for no fps limit but w/e
    Why is your artwork always so nice??? :( its not fair

    Also, it doesnt matter if you have a frame limit, if your fps is under the limit amount then the limit isnt doing anything.

    Edited:

    Use SFML to get a window, use OpenGL to draw your shit.
    How would you make it batch draw? would you not still need to draw to a rendertexture and then draw that?
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Friendly Friendly x 1 (list)

  6. Post #3086
    Gold Member
    Darwin226's Avatar
    January 2009
    4,079 Posts

    Edited:

    Still elastic, but just much more faster.
    Still doesn't feel right.
    Try making it snap to selected tiles instead of following the mouse.

    And (starting to get annoying here, sorry) could you make your vids smaller please? It really breaks my browser.
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events

  7. Post #3087
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    How would you make it batch draw? would you not still need to draw to a rendertexture and then draw that?
    You can use a vertex buffer. When a tile changes, it's even simpler to update it, because you can just use glBufferSubData to copy the new texture coordinates of the changed tiles.

    By the way, for creating an OpenGL context, what are your preferences?

    SFML
    SDL
    OpenGLUT
    GLFW

    Note that there are no winners here, it's just so I know what to prioritise in my guide.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Agree x 27Useful x 10Disagree x 4Informative x 2Late x 1Optimistic x 1Programming King x 1 (list)

  8. Post #3088
    Nigey Nige's Avatar
    June 2010
    1,340 Posts
    How would you make it batch draw? would you not still need to draw to a rendertexture and then draw that?
    Sometimes I think I can code, then I see posts like this and remember I don't know anything lower level than Slick.

    Edited:

    wtf even is xml
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Dumb Dumb x 2Optimistic Optimistic x 2 (list)

  9. Post #3089
    Okay, here comes a little story:

    When I first started Block Runner 2, I made a white silhouette of a 3D cube as logo. Together with that, I made a site - just for BR2. After a while I stopped working on BR2 and changed the site to Novaember, using the same logo. Now that I'm working on the game again, I need a logo for it, but the site already has the cube logo.

    Now I have a dilemma: Use the cube logo, or use something else? Maybe a derivative of the cube?

    This is the logo:
    Reply With Quote Edit / Delete Windows 8 Netherlands Show Events

  10. Post #3090
    Gold Member
    Deco Da Man's Avatar
    July 2007
    1,015 Posts
    You can use a vertex buffer. When a tile changes, it's even simpler to update it, because you can just use glBufferSubData to copy the new texture coordinates of the changed tiles.

    By the way, for creating an OpenGL context, what are your preferences?

    SFML
    SDL
    OpenGLUT

    Note that there are no winners here, it's just so I know what to prioritise in my guide.
    GLFW
    Reply With Quote Edit / Delete Windows 7 Australia Show Events Agree Agree x 4Useful Useful x 1Dumb Dumb x 1 (list)

  11. Post #3091
    AtomiCasd's Avatar
    June 2011
    588 Posts
    You can't in SFML. Every sprite drawn prompts a draw call. SFML sucks.
    It does what it is supposed to do, if you want to optimize your draw calls (i.e check adjacent sprites, combining sprites) you do that yourself.
    SFML is a library, not a game engine.

    You can enable texture repeating in the sf::Texture class anyways.
    Reply With Quote Edit / Delete Windows 7 Norway Show Events Dumb Dumb x 1 (list)

  12. Post #3092
    Gold Member
    Xeon06's Avatar
    September 2005
    1,222 Posts
    You can use a vertex buffer. When a tile changes, it's even simpler to update it, because you can just use glBufferSubData to copy the new texture coordinates of the changed tiles.

    By the way, for creating an OpenGL context, what are your preferences?

    SFML
    SDL
    OpenGLUT
    GLFW

    Note that there are no winners here, it's just so I know what to prioritise in my guide.
    WebGL..?
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  13. Post #3093
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    WebGL..?
    Later, there are a lot of things different when using WebGL. Different libraries for matrix math, different parameters, different buffer types and even different limits (sometimes imposed by DirectX).
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Friendly Friendly x 1 (list)

  14. Post #3094
    Gold Member
    Smashmaster's Avatar
    April 2005
    1,506 Posts
    Okay, here comes a little story:

    When I first started Block Runner 2, I made a white silhouette of a 3D cube as logo. Together with that, I made a site - just for BR2. After a while I stopped working on BR2 and changed the site to Novaember, using the same logo. Now that I'm working on the game again, I need a logo for it, but the site already has the cube logo.

    Now I have a dilemma: Use the cube logo, or use something else? Maybe a derivative of the cube?

    This is the logo:
    Use something else. At first glace, the cube doesn't look like anything, just a nondescript white shape. Logos should be very memorable and instantly recognizable.

    For instance:


    All they did was make a cube have weird shapes and stuff, but it's memorable.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  15. Post #3095

    August 2011
    192 Posts
    For instance:


    All they did was make a cube have weird shapes and stuff, but it's memorable.
    those are 3 arrows representing 3D that create the illusion of a cube^^ that logo is more thought through than one thinks looking at it
    Reply With Quote Edit / Delete Windows 7 Switzerland Show Events Agree Agree x 18Winner Winner x 4Useful Useful x 2 (list)

  16. Post #3096
    Gold Member

    October 2008
    3,838 Posts


    Working on getting that to generate with Lua. Got this so far.
    I wanted to comment on this but then I realized I was almost 2 pages late. Again.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Late x 24Funny x 8Dumb x 1Friendly x 1Programming King x 1 (list)

  17. Post #3097
    Gold Member
    Darwin226's Avatar
    January 2009
    4,079 Posts
    Tip for anyone that might need something like this.
    Calculating n^m can be done in log m complexity by squaring.
    The actual algorithm is
    function Power (n, m)
    {
        result = 1;
        while (m > 0)
        {
            if (m % 2 == 1) result *= n;
            m >>= 1;
            n *= n;
        }
        return result;
    }

    Now for how it works.
    Every power can be expressed as either 2k or 2k + 1.
    That means that you can write 4^9 as 4^(4 * 2 + 1).
    You continue doing that until you have 4^(((2 * 2) * 2) + 1)
    The above code is does that gradually, going from outside to the inside.
    In case of m = 9, it would first multiply the result(1) with n(let's say 4) because 9 % 1 == 1.
    Then it divides 9 with 2 (the right shift operator, m is now 4) and squares n (n is now 16).
    4 % 2 == 0 so it just divides it with 2 and squares n again (n is now 256, m is 2).
    Again, m % 2 == 0, just divide with 2 and square again (n is 65536, m is 1)
    In the last step, m % 2 == 1 (as it always will be in the last step) and we finally multiply the result with n. 4 * 65536 = 262144 = 4 ^ 9

    The whole process takes 5 multiplications instead of 9. So it's even beneficial for small numbers. Naturally it performs many times better for large numbers.
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events Programming King Programming King x 3 (list)

  18. Post #3098
    Frugle's Avatar
    June 2010
    485 Posts
    I found a code obfuscation feature in Visual Studio.

    1. Insert cursor before the code you want to obfuscate
    2. Hold Ctrl + Shift + T
    Reply With Quote Edit / Delete Windows 7 Finland Show Events Disagree Disagree x 1Funny Funny x 1 (list)

  19. Post #3099
    Dotmister's Avatar
    May 2008
    898 Posts
    The CPU is only able to read word aligned data from memory. x86 is quite forgiving and will let you read from unaligned addresses too, but it's slower because it has to read two words and then do shifts and bitmasks to get the data you want
    So in the example I gave it's useless since floats are 4 bytes anyway, therefore the extra one doesn't do anything at all.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  20. Post #3100
    Gold Member

    March 2005
    3,028 Posts
    So in the example I gave it's useless since floats are 4 bytes anyway, therefore the extra one doesn't do anything at all.
    It matters if you're using SSE.
    SSE operates on four floats at a time and requires 16-byte alignment.
    Reply With Quote Edit / Delete Windows 7 Show Events Informative Informative x 1Agree Agree x 1 (list)

  21. Post #3101
    Gold Member
    Dennab
    May 2011
    436 Posts

    Fixed the physics to run independant on the FPS and is now scaled properly (thanks to garry). I guess now comes the part where I have no add networking and synchronize all dynamic objects.

    Also I'm still looking for a good theme, I don't wanna do something that is already done.

    Edit:

    Looks like youtube somewhat messed with my video, it doesn't look smooth anymore :(
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  22. Post #3102
    ..............
    nekosune's Avatar
    February 2009
    1,827 Posts
    Where are people finding the materials on how to start programming an OS may I ask?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  23. Post #3103
    Gold Member

    March 2005
    3,028 Posts
    You can use a vertex buffer. When a tile changes, it's even simpler to update it, because you can just use glBufferSubData to copy the new texture coordinates of the changed tiles.

    By the way, for creating an OpenGL context, what are your preferences?

    SFML
    SDL
    OpenGLUT
    GLFW

    Note that there are no winners here, it's just so I know what to prioritise in my guide.
    I'm using SDL at the moment, but SDL 1.3/2.0/Hg is far from ready for use, and SDL 1.2 is a little dated. Is GLFW recommended over SDL? What more does it offer?
    Reply With Quote Edit / Delete Windows 7 Show Events

  24. Post #3104
    Gold Member
    Dennab
    May 2011
    436 Posts
    Where are people finding the materials on how to start programming an OS may I ask?
    When I tried that, I started with the bootloader. It has to be written in assembly of course you can also use GRUB which leads you to a entry point in C already.

    If you use something like GRUB you have the advantage of not messing with going to protected mode and you are able to continue directly in C.

    Sadly I'm not having any source codes anymore, I made my own bootloader in assembly before I switched to GRUB, but you will be able to find plenty resources on google.

    Edit:

    http://viralpatel.net/taj/tutorial/h...bootloader.php Thats a good tutorial on how to feed the BIOS with your bootloader and how to advance.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Programming King Programming King x 1 (list)

  25. Post #3105
    Paid for a title.
    Maurice's Avatar
    June 2005
    6,175 Posts
    Fixed the physics to run independant on the FPS and is now scaled properly (thanks to garry).
    In Not Tetris 2, the physics are also fps independent, but everything gets all bouncy at high FPS which sucks, so you might want to enable vsync or something.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  26. Post #3106
    Ohnoes, a bug!



    Tho I could leave this one in, could be a nice trick.. What do you think?

    Keep in as skillz trick
    Call Bugbusters
    Reply With Quote Edit / Delete Windows 8 Netherlands Show Events Disagree Disagree x 32Agree Agree x 3Funny Funny x 2 (list)

  27. Post #3107
    Gold Member
    Dennab
    May 2011
    436 Posts
    In Not Tetris 2, the physics are also fps independent, but everything gets all bouncy at high FPS which sucks, so you might want to enable vsync or something.
    I solved this using an accumulator, it will advance as much time is available for the physics to do so. Even at 2000 FPS its all stable for me now. But for development I always enable vsync and turn it off when I test new functionality.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  28. Post #3108
    Gold Member
    BlkDucky's Avatar
    May 2008
    6,485 Posts
    That... looks intentional. Unless you can still do that lower down the wall, then who cares?
    Reply With Quote Edit / Delete Windows Vista United Kingdom Show Events Disagree Disagree x 1 (list)

  29. Post #3109
    Gold Member
    Torrunt's Avatar
    October 2008
    246 Posts
    Just released my Zombie game I was working on, on Newgrounds: http://www.newgrounds.com/portal/view/590897


    (screenshot i took ages ago and just keep using because i'm too lazy to take another)


    Quite liking the scoreboards I put in, interesting to look at. Someone apparently killed a Goliath in 19 seconds :O (they have a lot of health) and people can always compete to be the Richest Player which is cool.
    Reply With Quote Edit / Delete Windows 7 Australia Show Events Winner Winner x 14Artistic Artistic x 4Programming King Programming King x 1 (list)

  30. Post #3110
    benji2015's Avatar
    October 2010
    476 Posts


    Yay art
    I need to do something actually productive like coding instead of sitting here making tilesets..

    Reply With Quote Edit / Delete Windows 7 United States Show Events Artistic Artistic x 11 (list)

  31. Post #3111
    Facepunch's Local Lycanthrope
    Contron's Avatar
    December 2008
    1,768 Posts


    Yay art
    I need to do something actually productive like coding instead of sitting here making tilesets..

    That's pretty good for programmer art.
    Reply With Quote Edit / Delete Windows 7 Jersey Show Events Agree Agree x 12 (list)

  32. Post #3112
    Gold Member
    Catdaemon's Avatar
    February 2005
    2,821 Posts
    That's pretty good for programmer art.
    maybe it's artist code

    is that even a thing

    it should be a thing
    Reply With Quote Edit / Delete Windows 7 Show Events Funny Funny x 13Agree Agree x 1 (list)

  33. Post #3113
    Paid for a title.
    Maurice's Avatar
    June 2005
    6,175 Posts
    maybe it's artist code

    is that even a thing

    it should be a thing
    There's enough shitty flash games with decent graphics and terrible coding, so it should be a thing.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Agree Agree x 8Funny Funny x 2Zing Zing x 1 (list)

  34. Post #3114
    I made WAYWO a better place
    OldFusion's Avatar
    September 2011
    1,311 Posts
    You can use a vertex buffer. When a tile changes, it's even simpler to update it, because you can just use glBufferSubData to copy the new texture coordinates of the changed tiles.

    By the way, for creating an OpenGL context, what are your preferences?

    SFML
    SDL
    OpenGLUT
    GLFW

    Note that there are no winners here, it's just so I know what to prioritise in my guide.
    How about just using the functions the OS provides? its not cross-platform but if gives you more of a understanding of whats going on.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  35. Post #3115
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    How about just using the functions the OS provides? its not cross-platform but if gives you more of a understanding of whats going on.
    It's also the best way to prevent people from learning OpenGL at all. It's like giving people the choice between an automatic car and a manual car, where you need to learn how the manual car is built before being allowed to use it.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Agree Agree x 3Disagree Disagree x 2 (list)

  36. Post #3116
    Richy19's Avatar
    May 2010
    5,384 Posts
    How about just using the functions the OS provides? its not cross-platform but if gives you more of a understanding of whats going on.
    But 95% of people on here wouldnt do that, most of us would much rather use a library like GLFW or SFML and just write the game code.
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Agree Agree x 1 (list)

  37. Post #3117
    Gold Member
    Number-41's Avatar
    August 2005
    4,292 Posts
    I want to make an excel add-in that does this

    //From a selection of cells with i rows and j columns
    
    //Some text into a dialog box that you can select stuff from
    for (int a=1; a<=i;a++)
    {
    	for (int b=1; b<=j;b++)
    	{
    		if (b != j)
    			//cell(a,b) content and also some string into the dialog
    		else
    		    //cell(a,b) content and also some other strings, go to the next line in the dialog window 
    	}
    }
    //Some more text into the dialog box
    
    

    So anyone who uses LateX recognizes that I want something that uses Excel data to create a table in LateX code. For those who don't, it comes down to a function that uses content from a selection of cells and pastes it into a dialog window where I can select & copy that information (it's nothing more than text information). So what I need is:

    -an object that I can extract cell content from and paste into the thing I describe in the next item in this list
    -some kind of output window which contains text data which I can copy & paste from (look at the screenshot)





    Or if you guys could tell me how I open an .xla file to edit it then all of the above isn't needed anymore
    Reply With Quote Edit / Delete Windows 7 Belgium Show Events

  38. Post #3118
    Gold Member
    BlkDucky's Avatar
    May 2008
    6,485 Posts
    But 95% of people on here wouldnt do that, most of us would much rather use a library like GLFW or SFML and just write the game code.
    yeah, I'm still reading this as Games For Windows Live.
    Reply With Quote Edit / Delete Windows Vista United Kingdom Show Events Agree Agree x 14Funny Funny x 3Disagree Disagree x 1 (list)

  39. Post #3119
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    3,054 Posts


    Save/Load windows, with callback events upon clicking either the check or cancel buttons.
    It ain't much but I think they're pretty cool
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Programming King Programming King x 1 (list)

  40. Post #3120
    I made WAYWO a better place
    OldFusion's Avatar
    September 2011
    1,311 Posts
    It's also the best way to prevent people from learning OpenGL at all. It's like giving people the choice between an automatic car and a manual car, where you need to learn how the manual car is built before being allowed to use it.
    Its more like learning how to use the key to start the Carr instead of having somebody else to do it for you.

    Its an OpenGL tutorial you learn people OpenGL, OpenGL exists beyond C++, i don't see why you would want to learn people to fiddle with the SFML library to create a window for you.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 1 (list)