1. Post #201
    jangalomph's Avatar
    November 2007
    229 Posts
    It's alive people..


    Shapes created with particles and vector fields, I'd call it a happy accident. Ports over to UE4 exactly the same. So much potential. Booyahhhhhh. (Still gotta fix rotation happening anytime you click and move your mouse).
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United States Show Events Artistic Artistic x 9 (list)

  2. Post #202
    Ott
    Gold Member
    Ott's Avatar
    June 2012
    6,627 Posts
    It's alive people..


    Shapes created with particles and vector fields, I'd call it a happy accident. Ports over to UE4 exactly the same. So much potential. Booyahhhhhh. (Still gotta fix rotation happening anytime you click and move your mouse).
    There's something immensely satisfying about the way the window moves when you rotate the object.
    Reply With Quote Edit / Delete Reply Windows 10 Firefox United States Show Events Funny Funny x 5 (list)

  3. Post #203
    Gold Member
    paindoc's Avatar
    March 2009
    9,263 Posts
    I got most my modules expanded to work in 3D, and got spherical noisemap generation working :D



    This isn't the full module chain I need to get set up, and I haven't finished porting all of the various modules in my library, but the vast majority are good to go. Downside: 3D is vastly more expensive, and this took about 7 seconds to generate (compared to less than one for 2D) at 8192x8192.

    Also, if I make the dimensions unequal uh everything breaks quite hard:



    So I gotta fix that still, since its ideal in these equirectangular projections to have the X-dimensions be twice that of the Y-dimension. I also need to tune the performance and really work on memory consumption, and maybe find a way to make this less likely to crash a user's display driver

    Edited:

    Best part I'm looking forward to using: super easy to access this data on the GPU, so using it for real-time terrain rendering should be easy and really fast since you don't have to wait for it to stream to the GPU. I'm working on finding ways to pass a handle/pointer to this data to graphics APIs, and hope to test that soon. I've been working on my mesh LOD'ing stuff all in anticipation of getting to show off the two working together!

  4. Post #204
    Gold Member
    cartman300's Avatar
    April 2011
    3,199 Posts
    Jesus Christ sometimes i manage to impress myself... I have a crappy tablet and the touchscreen doesnt work and the brand went bankrupt a while ago which means i cant download the stock ROM anymore, so i did some disassembly and exported the UART port outside of the case, 7 hours of staring into console outputs later and i manage do discover some neat stuff!

    Imagine burning an image file to an SD card, shoving it into the device and rebooting and- boom- rooted.

    More info soon.
    Reply With Quote Edit / Delete Reply Android Firefox Croatia Show Events Programming King Programming King x 1 (list)

  5. Post #205
    Gold Member
    Berkin's Avatar
    October 2013
    1,843 Posts
    My speech synthesizer can now convert simple words to a phonemic representation, but all it can pronounce right now is vowels (not even diphthongs). It's something special.

    Reply With Quote Edit / Delete Reply Windows 10 Chrome United States Show Events Funny Funny x 11 (list)

  6. Post #206
    Gold Member
    laserpanda's Avatar
    August 2006
    4,214 Posts
    Some highlights from my first attempt at a match between 3v3 bot teams.




    It was a blowout because blue team was set to the wrong positions, causing them to lose every faceoff, but I let it run to see how many goals red could rack up. Also something was wrong with Namestikov's speech causing him to yell at everyone on both teams including himself.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United States Show Events Funny Funny x 6 (list)

  7. Post #207
    Gold Member
    Torrunt's Avatar
    October 2008
    359 Posts
    If you use a constant speed, it will look very stiff. Try using a low pass filter on the absolute position instead.
    I'm using a cosine interpolation for that arm rotations now, I think it looks alright. Here's what that looks like:
    (Zombie on the left has the slowest possible arms and the one on the right has the fastest)

    and here's a quick video of it in action in mayhem:
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Australia Show Events Artistic Artistic x 3 (list)

  8. Post #208
    Gold Member
    eirexe's Avatar
    April 2011
    3,354 Posts
    I have published our game's source code: https://github.com/PepperCarrotGame/...rotgame_source

    It still lacks the binary assets folder, I'll upload that later once I sort out licensing.

  9. Post #209
    pierre0158's Avatar
    June 2010
    218 Posts
    Some raytracer progress, with schoolmates.






    Procedural flares are ugly as fuck


    Any idea how i could improve it ?

    Code:
    void drawflare(SDL_Surface *target, int x, int y, double distance)
    {
    	int x1;
    	int y1;
    	double dist;
    
    	distance = 30 + (distance - 1) * (3 - 30) / (25 - 1);
    	x1 = 0;
    	y1 = 0;
    	while (x1 < target->w)
    	{
    		y1 = 0;
    		while (y1 < target->h)
    		{
    			dist = sqrt(pow((x1 - x), 2) + pow((y1 - y), 2));
    			if (dist < distance)
    			{
    				putpixel(target, x1, y1, 0xffffffff);
    			}
    			else 
    				if ( dist < distance*10 )
    				{
    					putpixel(target, x1, y1, (( (Uint32)(255 + (dist - distance) * (0 - 255) / (distance*10 - distance)) << 24) + (255 << 16) + (255 << 8) + (255)));	
    				}
    			y1++;
    		}
    		x1++;
    	}
    }

  10. Post #210
    Gold Member
    Z_guy's Avatar
    July 2005
    680 Posts
    It's alive people..


    Shapes created with particles and vector fields, I'd call it a happy accident. Ports over to UE4 exactly the same. So much potential. Booyahhhhhh. (Still gotta fix rotation happening anytime you click and move your mouse).
    That's a nice looking ImGui theme. Mind sharing it?
    Reply With Quote Edit / Delete Reply Linux Firefox Sweden Show Events Friendly Friendly x 2 (list)

  11. Post #211
    TeamEnternode's Avatar
    September 2013
    868 Posts
    I'm hearing a lot of differing opinions about SDL vs. SFML

    Now that SFML and SDL have version 2s, which do you think is better for 2d game engine development in C++, and why?

    Reddit says SDL2 but I've heard a couple of arguments for SFML2.

    Edited:

    I should state I intend on implimemting Lua and Tiled into what I am making

  12. Post #212
    kill yourself
    Protocol7's Avatar
    June 2006
    29,652 Posts
    Trying my hand at a typo generator. Currently two modes are implemented: transposition and mistyping based on the keyboard layout.

    Example string:
    Code:
    the quick brown fox jumps over the lazy dog 1234567890 -+ [] \ ; ' , . /
    Transposing letters:
    Code:
    teh qucik borwn fxo jupms ovre hte layz dgo 1234568790 +- ][ \ ; ' , . / 
    hte qucik rbown ofx jmups ovre hte layz odg 1235467890 +- ][ \ ; ' , . / 
    hte uqick borwn fxo jmups ovre teh layz dgo 1243567890 +- ][ \ ; ' , . / 
    teh qucik borwn ofx jupms oevr hte alzy dgo 1234657890 +- ][ \ ; ' , . / 
    teh qucik borwn fxo jmups oevr teh alzy odg 1243567890 +- ][ \ ; ' , . / 
    hte qiuck borwn fxo ujmps oevr hte alzy dgo 1234567980 +- ][ \ ; ' , . / 
    hte uqick rbown ofx jumsp voer hte layz odg 1234567809 +- ][ \ ; ' , . / 
    teh quikc brwon ofx jumsp oevr hte lzay odg 1234567809 +- ][ \ ; ' , . / 
    teh quikc rbown ofx ujmps ovre teh alzy odg 1234568790 +- ][ \ ; ' , . / 
    hte qucik borwn fxo ujmps oevr hte alzy odg 1234576890 +- ][ \ ; ' , . /
    Mistyping Keys:
    Code:
    the quick b3own fox jumps ove4 5he lasy d9g 1234567890 -+ [] \ ; ' , . / 
    the quick brown rox jumps pver the lqzy dog 12345u7890 -+ [] \ ; ' , . / 
    the quick brown fox jumps over the laay dog 1234567890 -+ [] \ ; ' , . / 
    the quick brown fox jumpc obe5 fhe lazy dov 1134567890 -+ [] \ ; ' , . / 
    ty4 qyick br;wn fox kumps ofer the .wzy dog 123e567890 -+ [] \ ; ' , . / 
    the 2uick bdiwn fox jujps ov45 the lazy dog 223456u8o- -+ [] \ ; ' , . / 
    the quicm browb fox jumps over thf lazy dog 1234567890 -+ [] \ ; ' , . / 
    th3 quick browj fox jumpa ;ver the lazy doy 12e45y7990 -+ [] \ ; ' , . / 
    the quick vr;wn fpx jumps over the lazy dog 1234567890 -+ [] \ ; ' , . / 
    the 1uick brown f0z jumps over the lazy dog 1234567890 -+ [] \ ; ' , . /
    This one probably needs some adjustments but it looks pretty good so far.
    I'm a bit late but a long time ago I did something similar in C# that does random capitalizations and stuff.

    https://github.com/protocol114/Fore/...poGenerator.cs

    It was actually paired with a shitty Markov chain and prepopulated dictionaries, with final output that looks like any of the following sentences:

    having the rainy bEGinner beginner radiate he helpful beginners beginners bird cOMPAny milk just hEAd delay?. delay?. plantation have a am AM beginners sUPPOSe a sticky cannnon s tease a just

    mysterious bedroom stoMact raiNY WAtch watches helpless dude kick I careful cup plug a ctackers where wehere is an immense Piss wALLET mysTERIOUS lettuce,! flap the AFternoON

    has clumsy stomach sQUEEze you you large peNCjl prick the awlaways in kill he rapid stomach have you you returN EASy pencil pnencil shxllow.? laNguage wAIK YO u there paprer

  13. Post #213

    May 2016
    176 Posts
    I'm hearing a lot of differing opinions about SDL vs. SFML

    Now that SFML and SDL have version 2s, which do you think is better for 2d game engine development in C++, and why?

    Reddit says SDL2 but I've heard a couple of arguments for SFML2.

    Edited:

    I should state I intend on implimemting Lua and Tiled into what I am making
    It's mostly a matter of taste. They differ mainly in API style, with SFML being pretty object oriented and SDL being plain C. I'd argue for something that's going to be a fairly low level component of an engine, the latter is better, but it's entirely up to personal taste.
    It's in any case nothing to spend a lot of time on up front evaluating, just pick one and see if you like it. It's going to vanish pretty quickly inside your engine code anyways. I've always been a bit suspious of the built in sprite stuff they have and would recommend rolling that yourself using OpenGL because it's the more flexible route but that's also up to personal taste I guess.

    FWIW I used both and liked SDL better because the C-ish API is a better format for libraries in my opinion but if you prefer to USE object oriented APIs, you might find SFML nicer to use.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Germany Show Events Agree Agree x 2 (list)

  14. Post #214
    Gold Member
    Tamschi's Avatar
    December 2009
    8,616 Posts
    I have published our game's source code: https://github.com/PepperCarrotGame/...rotgame_source

    It still lacks the binary assets folder, I'll upload that later once I sort out licensing.
    In case you used other engines previously, what is most different in Godot in your opinion?

    Edited:

    [...]

    Procedural flares are ugly as fuck

    [...]
    They could use some irregularities, but I'm saying this as someone who wears glasses and as such gets pretty crazy patterns from these
    They seem overall way too strong/large, too.

  15. Post #215

    November 2016
    1 Posts
    [...]

    Any idea how i could improve it ?

    [...]
    Can't say much about the looks. But performance wise, I would do a row-major traversal for better cache utilization. Assuming your texture uses a conventional pixel layout.

    And you could probably approximate a min-max region for x1 and y1. But I don't know math so idk.

    You can also easily optimize your pow calls, since you use a fixed exponent. pow is slow af
    Code:
    float dx = x1 - x;
    float dy = y1 - y;
    dist = sqrt(dx*dx + dy*dy)
    I know you didn't ask for performance advice but I couldn't help myself sorry

  16. Post #216
    jangalomph's Avatar
    November 2007
    229 Posts
    That's a nice looking ImGui theme. Mind sharing it?
    Code:
    void VectorayGenStyle() {
    	auto& style = ImGui::GetStyle();
    
    	style.Alpha = 1.0f; // Global alpha applies to everything in ImGui
    	style.WindowPadding = ImVec2(8, 8); // Padding within a window
    	style.WindowMinSize = ImVec2(32, 32); // Minimum window size
    	style.WindowRounding = 0.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
    	style.WindowTitleAlign = ImGuiAlign_Left; // Alignment for title bar text
    	style.ChildWindowRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
    	style.FramePadding = ImVec2(4, 3); // Padding within a framed rectangle (used by most widgets)
    	style.FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
    	style.ItemSpacing = ImVec2(8, 4); // Horizontal and vertical spacing between widgets/lines
    	style.ItemInnerSpacing = ImVec2(4, 4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
    	style.TouchExtraPadding = ImVec2(0, 0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
    	style.IndentSpacing = 21.0f; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
    	style.ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns
    	style.ScrollbarSize = 16.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar
    	style.ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
    	style.GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar
    	style.GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
    	style.DisplayWindowPadding = ImVec2(22, 22); // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
    	style.DisplaySafeAreaPadding = ImVec2(4, 4); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
    	style.AntiAliasedLines = true; // Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU.
    	style.AntiAliasedShapes = true; // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
    	style.CurveTessellationTol = 1.25f; // Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
    
    	style.Colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); // Fine
    	style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); // Fine
    	style.Colors[ImGuiCol_WindowBg] = ImVec4(0.12f, 0.12f, 0.12f, 1.00f); // Fine
    	style.Colors[ImGuiCol_ChildWindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); // Fine
    	style.Colors[ImGuiCol_PopupBg] = ImVec4(0.05f, 0.05f, 0.10f, 1.00f); // Maybe?
    	style.Colors[ImGuiCol_Border] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); // Fine
    	style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); // Fine
    	style.Colors[ImGuiCol_FrameBg] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); // Background of checkbox, radio button, plot, slider, text input
    	style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f); // Little box hover color
    	style.Colors[ImGuiCol_FrameBgActive] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_TitleBg] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); //Title bar
    	style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.12f, 0.12f, 0.12f, 1.00f); //Title Bar
    	style.Colors[ImGuiCol_TitleBgActive] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f); //Title bar active (ORANGE) 1.00f, 0.47f, 0.00f, 1.00f
    	style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
    	style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); //Scroll bar background
    	style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f); //Scroll Bar Color
    	style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f); //Scroll bar click color
    	style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f); //Scroll bar drag color
    	style.Colors[ImGuiCol_ComboBg] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); // Drop down menus
    	style.Colors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); //Check Box
    	style.Colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.80f, 0.25f); //Slider/Float Slider color
    	style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f); //Slider/Float Slider Active Color
    	style.Colors[ImGuiCol_Button] = ImVec4(1.00f, 0.47f, 0.10f, 1.00f); //Button Color *FIX THIS*
    	style.Colors[ImGuiCol_ButtonHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_ButtonActive] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_Header] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
    	style.Colors[ImGuiCol_HeaderHovered] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_HeaderActive] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_Column] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
    	style.Colors[ImGuiCol_ColumnHovered] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_ColumnActive] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
    	style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
    	style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
    	style.Colors[ImGuiCol_CloseButton] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_CloseButtonHovered] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
    	style.Colors[ImGuiCol_CloseButtonActive] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
    	style.Colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
    	style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_PlotHistogram] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(1.00f, 0.47f, 0.00f, 1.00f);
    	style.Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
    }
    We use an external file to control our colors so that we don't edit any of the files from the ImGui Library. Makes for easier updating. You should be able to get this to work for you :)
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United States Show Events Friendly Friendly x 2Useful Useful x 1 (list)

  17. Post #217
    Gold Member
    Karmah's Avatar
    December 2007
    6,835 Posts
    I've been meaning to implement ImGUI in my engine and drop the shitty ui I made.
    If I use it then I'm going to have at least 3 separate libraries defining vector classes with: GLM, ImGUI, and ASSIMP all defining vec2 vec3 and vec4
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Canada Show Events Agree Agree x 1Funny Funny x 1 (list)

  18. Post #218
    Gold Member
    Dr Magnusson's Avatar
    July 2008
    2,848 Posts
    I've been following Bartosz Milewski's videos on Category Theory for Programmers, and I feel like it's blowing my mind on a regular basis. Furthermore, I am starting to see why Haskell is so well liked by people who "get it". The video series is bridging that gap between rough and tumble programming languages like C++, and the mathematical beauty and purity of what lies beneath all the dirty implementation details.

    I might give Haskell another shot once I'm done with the series. I read the Learn You A Haskell For Great Good book a while ago, and understood the syntax fine, but it never really explained the "why" of Haskell, the almost philosophical arguments for why Haskell, or category theory in general, is a good thing to know about and use when programming.


    edit:

    I still don't really know what a monad is
    Reply With Quote Edit / Delete Reply Windows 7 Chrome Denmark Show Events Winner Winner x 1Informative Informative x 1 (list)

  19. Post #219
    jangalomph's Avatar
    November 2007
    229 Posts
    I've been meaning to implement ImGUI in my engine and drop the shitty ui I made.
    If I use it then I'm going to have at least 3 separate libraries defining vector classes with: GLM, ImGUI, and ASSIMP all defining vec2 vec3 and vec4
    We use a number of libraries for our software, but isn't it possible to only include what you want from each library? (I truly don't know :P)

  20. Post #220
    Gold Member
    Karmah's Avatar
    December 2007
    6,835 Posts
    We use a number of libraries for our software, but isn't it possible to only include what you want from each library? (I truly don't know :P)
    Idk if there's any other way because the assimp model importing library seems to store its data using its own data structures ie using its own vector math library.

  21. Post #221

    May 2016
    176 Posts
    I've been meaning to implement ImGUI in my engine and drop the shitty ui I made.
    If I use it then I'm going to have at least 3 separate libraries defining vector classes with: GLM, ImGUI, and ASSIMP all defining vec2 vec3 and vec4
    When you add a physics engine you're going to have 4 probably.
    Not really something I'd call an issue though, esp. with being able to define conversion operators for them.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Germany Show Events Disagree Disagree x 1 (list)

  22. Post #222
    Gold Member
    DoctorSalt's Avatar
    January 2009
    2,555 Posts
    My speech synthesizer can now convert simple words to a phonemic representation, but all it can pronounce right now is vowels (not even diphthongs). It's something special.
    ~MOUTH SOUNDS~
    If you add a drum machine and some synth you could create a sequel to that rat man song from portal
    Reply With Quote Edit / Delete Reply Windows 7 Chrome United Kingdom Show Events Funny Funny x 2 (list)

  23. Post #223
    Gold Member
    Karmah's Avatar
    December 2007
    6,835 Posts
    When you add a physics engine you're going to have 4 probably.
    Not really something I'd call an issue though, esp. with being able to define conversion operators for them.
    Whoops totally forgot about that, so yeah I do currently have 3, plus ImGui = 4

  24. Post #224
    Gold Member
    Darwin226's Avatar
    January 2009
    5,177 Posts
    I've been following Bartosz Milewski's videos on Category Theory for Programmers, and I feel like it's blowing my mind on a regular basis. Furthermore, I am starting to see why Haskell is so well liked by people who "get it". The video series is bridging that gap between rough and tumble programming languages like C++, and the mathematical beauty and purity of what lies beneath all the dirty implementation details.

    I might give Haskell another shot once I'm done with the series. I read the Learn You A Haskell For Great Good book a while ago, and understood the syntax fine, but it never really explained the "why" of Haskell, the almost philosophical arguments for why Haskell, or category theory in general, is a good thing to know about and use when programming.


    edit:

    I still don't really know what a monad is
    Here's an explanation that I don't often hear when people ask what a monad is.
    Say you have a value of type Int in a strict, non-pure language. You don't know where it came from because it doesn't matter.

    Now say you're in a non-strict (as in, lazy), non-pure language. Your Int might not yet be evaluated, and in order to evaluate it you might need to do some IO, perhaps query a database or something. Suddenly you need to start caring if the Int you have is a simple number or if it's actually a side effecting computation waiting to happen.

    So the way you decide to do that is by differentiating these values at the type level. Ints that can't do anything special remain just Ints, but those that require some side effect evaluate will be decorated with a special IO type. Now you have two incompatible things, Ints and IO Ints, and there's no way to make a mistake. The only problem is that you can't really do anything with the IO variants so you need to define some operations that make sense for these values.

    Firstly, we should be able to "promote" a normal Int into an IO Int. Nothing bad can happen by assuming some pure value does side effects. So that's our first function, `Int -> IO Int`.

    Next we might consider the opposite. A function that takes an IO Int, does the side effect and gives you a normal Int back. The problem is that we're still in a lazy language so this side effect again won't happen until we start doing something with our normal Int. This is the same problem we started with. So `IO Int -> Int` is out of the question.

    There are many candidates for potential functions to include, but it turns out that pretty much all the sensible ones can be implemented with the following function: IO Int -> (Int -> IO Int) -> IO Int.
    So a function that takes an `IO Int`, and takes another function `Int -> IO Int`. When the side effect finally gets executed we get our normal Int out of it. Then we feed it into the provided function which can also potentially require additional side effects to produce a new number. The final result, an IO Int, represents an Int we'll get when both of those side effects get executed.

    Notice that we don't have a problem we had with the `IO Int -> Int` function because we never claim to produce normal Ints. We just keep stringing on functions that will eventually get run when the side effecting starts to happen.

    Now we have a pure, lazy language. It's pure because the side effects never really happen. Our code just constructs this huge plan what to do. Then the runtime takes that plan and actually executes it.

    If you get this, you get what a monad is in a practical sense. Further insight comes from the realization that many more things, other than just our magical IO, also allow for the same interface. So you call everything that implements this interface a monad. The other generalization is, of course, that talking about Ints here is completely arbitrary since the whole story works for any kind of value.

    Now as far as theory goes, there is a bit of a disconnect. Monads in Haskell are more "inspired" by category theory than they are derived from it. Actually seeing the parallels between mathematics and code does yield significant insight about what this interface does and doesn't let us do, but understanding that is in no way required to be able to say you "know what a monad is".

    Common question is "so what's so special about this?". Well, there is a certain minimality to the interface we defined. Because it's so minimal, a HUGE number of ideas and constructs can implement it. On the other hand these two functions are enough to be able to write whole libraries worth of functions, without ever talking about anything more concrete.

    The whole laziness story above is the actual motivation for introducing this concept into Haskell. I feel that it provides a useful perspective for understanding monads. That being said, the interface itself has nothing to do with laziness. It's just a solution to some of the issues.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Croatia Show Events Informative Informative x 2Programming King Programming King x 2 (list)

  25. Post #225
    Gold Member
    paindoc's Avatar
    March 2009
    9,263 Posts
    One of the long-standing problems I've had with my slicing engine is the simplification of polygons. When imported from an STL mesh especially, the output polygons generated can have an excessive amount of vertices that aren't needed at all. This is a problem both from the standpoint of computational complexity (generating toolpaths and such), and because lots of small details are really rough on 3D printers - you want the smoothest, simplest toolpath required to sufficiently describe a polygon so that you can keep the movements smooth. Right now, the simplification is hopelessly broken and has become a blocker since its so bad at safely simplifying things (either I get way too many points to use for a toolpath, or I lose vital detail).

    Both of the big slicing engines out there use the Douglas–Peucker algorithm to simplify Polygons, which is fairly primitive. Its also pretty hard on RAM in most implementations, and requires a lot of recursion. Enter the Visivalignam algorithm! I just kinda stumbled into this and a really nice implementation on github. It iterates through all points defining a polyline, considering the area generated by the triangle created by a point and its immediate neighbors. In this way, it's able to weigh the simplification better to avoid over-simplifying and really easily takes care of regions with unnecessarily high detail. It uses less RAM, is generally faster, and adjusting the tolerance to clip/simplify by feels much more intuitive. There's also no need for a new heap class: just define a "<" operator for the Visivalignam node struct you create and then use the standard library's lovely "make_heap", "pop_heap", and "push_heap" to take care of all of the sorting/ordering work for you.

    In simple tests I've run, its already come out far ahead. I take a square and just add random points all along the lines defined by the initial four vertices, and then simplify this down as far as both algorithms are willing to go. Visivalingam simplifies down to the base square, but Douglas-Puecker can't even handle this fairly simple test and ends up keeping a lot of the extra points around (and they really aren't needed). The Douglas-Puecker version also ends up breaking things, making the output into a really distorted rhombus. Oops



    I've also integrated automated unit testing using the Boost Unit Test Framework, which has helped me loads in verifying functionality as I rewrite a large chunk of my codebase (it was terribly broken and used Cura's wretched code too much). With that complete and this simplification integrated, I should be able to get back to work on tying up the last of the work needed to get this application running on the command line. Also, we just got news of an awarded Phase II contract at work. I'm not going to say what, exactly, as my name is on the paper and I don't want to throw that around too casually, but the tech is something NASA really wants for the Mars missions, and it should be immensely helpful for any long-term stays on the Red planet

  26. Post #226
    Gold Member
    eirexe's Avatar
    April 2011
    3,354 Posts
    In case you used other engines previously, what is most different in Godot in your opinion?

    Edited:



    They could use some irregularities, but I'm saying this as someone who wears glasses and as such gets pretty crazy patterns from these
    They seem overall way too strong/large, too.
    Godot's extensiblity, speed, lack of dependencies and low weight makes it my go to choice for 2d, I would use UE4 before, but I switched to Godot in an attempt to get away from UE4's licensing system, plus it uses gdscript which is like python, which is something I like.

    I feel like Godot is the 2D king, and will become a very competitive 3D engine once 3.0 drops.
    Reply With Quote Edit / Delete Reply Linux Firefox Spain Show Events Informative Informative x 1 (list)

  27. Post #227
    Gold Member
    Icedshot's Avatar
    April 2010
    2,761 Posts
    I'm hearing a lot of differing opinions about SDL vs. SFML

    Now that SFML and SDL have version 2s, which do you think is better for 2d game engine development in C++, and why?

    Reddit says SDL2 but I've heard a couple of arguments for SFML2.

    Edited:

    I should state I intend on implimemting Lua and Tiled into what I am making
    For an engine, SDL2 has features that SFML2 simply doesn't have. Raw mouse input, multi monitor stuff, no window maximising without context switch, i'm sure there's a few others. I hit a few snags with SFML2 not supporting features in my 3d game engine

    SFML is easy as shite to use though. Its super useful because of the whole RAII thing, so you can easily manage object lifetimes and gl stuff with it
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United Kingdom Show Events Agree Agree x 1Informative Informative x 1 (list)

  28. Post #228

    May 2016
    176 Posts
    For an engine, SDL2 has features that SFML2 simply doesn't have. Raw mouse input, multi monitor stuff, no window maximising without context switch, i'm sure there's a few others. I hit a few snags with SFML2 not supporting features in my 3d game engine

    SFML is easy as shite to use though. Its super useful because of the whole RAII thing, so you can easily manage object lifetimes and gl stuff with it
    Ah really I didn't know SFML was lacking on that front.

  29. Post #229
    phygon's Avatar
    December 2012
    3,494 Posts
    Reply With Quote Edit / Delete Reply Windows 10 Firefox United States Show Events Funny Funny x 7Friendly Friendly x 1 (list)

  30. Post #230
    Everyone has a $1 title
    Skipcast's Avatar
    November 2008
    6,811 Posts
    Also, in addition to the moral thing, there's a deadlock switch built in to an obfuscated DLL. If you accidentally trigger it, it rm - rf / 's your computer so your mileage may vary if you decide to pirate it.
    seems like a really dodgy and malicious thing to do imo.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Sweden Show Events Agree Agree x 1 (list)

  31. Post #231
    Ott
    Gold Member
    Ott's Avatar
    June 2012
    6,627 Posts
    seems like a really dodgy and malicious thing to do imo.
    Pretty sure he's bluffing

    Edited:

    Why would a DLL execute bash?
    Reply With Quote Edit / Delete Reply Windows 10 Firefox United States Show Events Agree Agree x 7 (list)

  32. Post #232
    Gold Member
    Karmah's Avatar
    December 2007
    6,835 Posts
    Pretty sure he's bluffing

    Edited:

    Why would a DLL execute bash?
    I don't think it matters if it actually does or not; as long as those who want to pirate it think it does.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Canada Show Events Optimistic Optimistic x 2Late Late x 1 (list)

  33. Post #233
    LennyPenny's Avatar
    December 2011
    2,802 Posts
    nvm

  34. Post #234
    phygon's Avatar
    December 2012
    3,494 Posts
    seems like a really dodgy and malicious thing to do imo.
    I'm not being serious
    All the DLL actually does is turn your computer into a grenade and blow your family to smithereens.
    Reply With Quote Edit / Delete Reply Windows 10 Firefox United States Show Events Funny Funny x 12Agree Agree x 5Programming King Programming King x 2Friendly Friendly x 1 (list)

  35. Post #235
    Gold Member
    JohnnyOnFlame's Avatar
    February 2011
    3,343 Posts
    I'm not being serious
    All the DLL actually does is turn your computer into a grenade and blow your family to smithereens.
    Phew, I was actually worried there for a second.
    Reply With Quote Edit / Delete Reply Windows 10 Firefox Show Events Funny Funny x 1Agree Agree x 1 (list)

  36. Post #236
    Gold Member
    Tamschi's Avatar
    December 2009
    8,616 Posts
    I'm not being serious
    All the DLL actually does is turn your computer into a grenade and blow your family to smithereens.
    I think the issue with stuff like that is that a legitimate customer could be turned away by it by doubt alone.
    Then again, most people should recognise this as a joke or at least ask you about it.

    I don't really get why anyone would pirate programming assets though. You can't publish anything with that stuff without risking to get sued.
    Reply With Quote Edit / Delete Reply Windows 10 Firefox Germany Show Events Agree Agree x 1 (list)

  37. Post #237
    Gold Member
    Icedshot's Avatar
    April 2010
    2,761 Posts
    I think the issue with stuff like that is that a legitimate customer could be turned away by it by doubt alone.
    Then again, most people should recognise this as a joke or at least ask you about it.

    I don't really get why anyone would pirate programming assets though. You can't publish anything with that stuff without risking to get sued.
    I mean, people steal whole games and upload them onto the steam store, some games have audio and art assets stolen from other games etc. It is illegal, but that doesn't seem to stop them given valve's fairly lax moderation policy

    Edited:

    I'm not being serious
    All the DLL actually does is turn your computer into a grenade and blow your family to smithereens.
    You are a truly talented programmer, grenade.exe is top tier business
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United Kingdom Show Events Zing Zing x 1 (list)

  38. Post #238
    Meow :3
    Ac!dL3ak's Avatar
    July 2005
    6,189 Posts
    Here's an explanation that I don't often hear when people ask what a monad is.
    Say you have a value of type Int in a strict, non-pure language. You don't know where it came from because it doesn't matter.

    Now say you're in a non-strict (as in, lazy), non-pure language. Your Int might not yet be evaluated, and in order to evaluate it you might need to do some IO, perhaps query a database or something. Suddenly you need to start caring if the Int you have is a simple number or if it's actually a side effecting computation waiting to happen.

    So the way you decide to do that is by differentiating these values at the type level. Ints that can't do anything special remain just Ints, but those that require some side effect evaluate will be decorated with a special IO type. Now you have two incompatible things, Ints and IO Ints, and there's no way to make a mistake. The only problem is that you can't really do anything with the IO variants so you need to define some operations that make sense for these values.

    Firstly, we should be able to "promote" a normal Int into an IO Int. Nothing bad can happen by assuming some pure value does side effects. So that's our first function, `Int -> IO Int`.

    Next we might consider the opposite. A function that takes an IO Int, does the side effect and gives you a normal Int back. The problem is that we're still in a lazy language so this side effect again won't happen until we start doing something with our normal Int. This is the same problem we started with. So `IO Int -> Int` is out of the question.

    There are many candidates for potential functions to include, but it turns out that pretty much all the sensible ones can be implemented with the following function: IO Int -> (Int -> IO Int) -> IO Int.
    So a function that takes an `IO Int`, and takes another function `Int -> IO Int`. When the side effect finally gets executed we get our normal Int out of it. Then we feed it into the provided function which can also potentially require additional side effects to produce a new number. The final result, an IO Int, represents an Int we'll get when both of those side effects get executed.

    Notice that we don't have a problem we had with the `IO Int -> Int` function because we never claim to produce normal Ints. We just keep stringing on functions that will eventually get run when the side effecting starts to happen.

    Now we have a pure, lazy language. It's pure because the side effects never really happen. Our code just constructs this huge plan what to do. Then the runtime takes that plan and actually executes it.

    If you get this, you get what a monad is in a practical sense. Further insight comes from the realization that many more things, other than just our magical IO, also allow for the same interface. So you call everything that implements this interface a monad. The other generalization is, of course, that talking about Ints here is completely arbitrary since the whole story works for any kind of value.

    Now as far as theory goes, there is a bit of a disconnect. Monads in Haskell are more "inspired" by category theory than they are derived from it. Actually seeing the parallels between mathematics and code does yield significant insight about what this interface does and doesn't let us do, but understanding that is in no way required to be able to say you "know what a monad is".

    Common question is "so what's so special about this?". Well, there is a certain minimality to the interface we defined. Because it's so minimal, a HUGE number of ideas and constructs can implement it. On the other hand these two functions are enough to be able to write whole libraries worth of functions, without ever talking about anything more concrete.

    The whole laziness story above is the actual motivation for introducing this concept into Haskell. I feel that it provides a useful perspective for understanding monads. That being said, the interface itself has nothing to do with laziness. It's just a solution to some of the issues.
    holy fuck, does that make a promise a type of monad?

  39. Post #239
    Gold Member
    Tamschi's Avatar
    December 2009
    8,616 Posts
    I mean, people steal whole games and upload them onto the steam store, some games have audio and art assets stolen from other games etc. It is illegal, but that doesn't seem to stop them given valve's fairly lax moderation policy
    They don't moderate actively enough, but as far as I know they crack down pretty hard on any kind of copyright infringement once they're notified.
    I'm pretty sure they permanently ban companies and individuals who are caught selling copyrighted material on their platform. Edited: There's at least one game that didn't get banned permanently, though that had a freelancer steal assets.

    Edited:

    [...]
    Edited:

  40. Post #240
    Gold Member
    Dr Magnusson's Avatar
    July 2008
    2,848 Posts
    Here's an explanation that I don't often hear when people ask what a monad is.
    Say you have a value of type Int in a strict, non-pure language. You don't know where it came from because it doesn't matter.

    Now say you're in a non-strict (as in, lazy), non-pure language. Your Int might not yet be evaluated, and in order to evaluate it you might need to do some IO, perhaps query a database or something. Suddenly you need to start caring if the Int you have is a simple number or if it's actually a side effecting computation waiting to happen.

    So the way you decide to do that is by differentiating these values at the type level. Ints that can't do anything special remain just Ints, but those that require some side effect evaluate will be decorated with a special IO type. Now you have two incompatible things, Ints and IO Ints, and there's no way to make a mistake. The only problem is that you can't really do anything with the IO variants so you need to define some operations that make sense for these values.

    Firstly, we should be able to "promote" a normal Int into an IO Int. Nothing bad can happen by assuming some pure value does side effects. So that's our first function, `Int -> IO Int`.

    Next we might consider the opposite. A function that takes an IO Int, does the side effect and gives you a normal Int back. The problem is that we're still in a lazy language so this side effect again won't happen until we start doing something with our normal Int. This is the same problem we started with. So `IO Int -> Int` is out of the question.

    There are many candidates for potential functions to include, but it turns out that pretty much all the sensible ones can be implemented with the following function: IO Int -> (Int -> IO Int) -> IO Int.
    So a function that takes an `IO Int`, and takes another function `Int -> IO Int`. When the side effect finally gets executed we get our normal Int out of it. Then we feed it into the provided function which can also potentially require additional side effects to produce a new number. The final result, an IO Int, represents an Int we'll get when both of those side effects get executed.

    Notice that we don't have a problem we had with the `IO Int -> Int` function because we never claim to produce normal Ints. We just keep stringing on functions that will eventually get run when the side effecting starts to happen.

    Now we have a pure, lazy language. It's pure because the side effects never really happen. Our code just constructs this huge plan what to do. Then the runtime takes that plan and actually executes it.

    If you get this, you get what a monad is in a practical sense. Further insight comes from the realization that many more things, other than just our magical IO, also allow for the same interface. So you call everything that implements this interface a monad. The other generalization is, of course, that talking about Ints here is completely arbitrary since the whole story works for any kind of value.

    Now as far as theory goes, there is a bit of a disconnect. Monads in Haskell are more "inspired" by category theory than they are derived from it. Actually seeing the parallels between mathematics and code does yield significant insight about what this interface does and doesn't let us do, but understanding that is in no way required to be able to say you "know what a monad is".

    Common question is "so what's so special about this?". Well, there is a certain minimality to the interface we defined. Because it's so minimal, a HUGE number of ideas and constructs can implement it. On the other hand these two functions are enough to be able to write whole libraries worth of functions, without ever talking about anything more concrete.

    The whole laziness story above is the actual motivation for introducing this concept into Haskell. I feel that it provides a useful perspective for understanding monads. That being said, the interface itself has nothing to do with laziness. It's just a solution to some of the issues.
    Thank you for the detailed reply, I can definitely see the use for it, especially now with the insight into why these foundational constructs are useful and necessary, in a programming context. I haven't gotten to the video on monads yet, so my edit was mostly made in jest, but your contextualization will no doubt make it easier for me to understand completely when I get to it. Thank you!
    Reply With Quote Edit / Delete Reply Windows 7 Chrome Denmark Show Events Friendly Friendly x 2 (list)