Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Apr 2010
Offline Last Active Private

#5298142 The latest BMP I made crashes the program, other BMPs work fine

Posted by Khatharr on 26 June 2016 - 01:57 PM

Is it better to use a PNG?


Yes, but that's not what's causing your error.

#5297653 algorithmicly connecting a graph

Posted by Khatharr on 22 June 2016 - 08:35 PM

Only create edges in the ne,e,se,s directions as you iterate?


Though really I'd have to agree that one-way edges is probably better for usage, since you generally want to know what outbound edges are available for a specific node. If your edges are of uniform weight you can even just represent them as a vector of destination node pointers within each node.

#5296884 Problem on referencing a vector of derived class

Posted by Khatharr on 16 June 2016 - 08:11 PM

This appears to be a misuse of inheritance. (refer to https://en.wikipedia.org/wiki/Liskov_substitution_principle) Generally you should be avoiding this type of cast and use dynamic_cast when it's unavoidable (this may be one of those cases). Trying to cast the vector itself is really not a good plan.


Could you explain more about what you're using this for? There may be a better pattern for this.

#5296241 Major selling games and language types

Posted by Khatharr on 12 June 2016 - 12:51 PM

The first languages I learned were GWBASIC and Pascal. Years later I learned Visual Basic. Then a while later I learned C. Fast forward another couple years and I learned Ruby, then C++, then Lua, then a glance at Lisp... Then a ton of miscellaneous nonsense. At some point during that, learning new languages was pretty much a non-event. It's a lot more important to me what tools I have available and have something that matches up well with what I want to accomplish. These days that usually means Ruby for trivial tasks, C++ for not being a scrub (come at me), and C# for Windows tools or for working in Unity.


Anyway, my point is that I don't use the vast majority of languages that I've learned over the years, and it was over a decade from my starting point before I learned the ones that I use commonly today. However, all that I have learned up until now depends on the principles that I picked up with every language along the way. My advice is to find something that you're comfortable with and can accomplish something with, even if it's not where you want to end up. Get good at something and then expand your comfort zone at a decent pace.


Some people can leap headlong into C++ and succeed. Some people struggle to learn HTML. Software really is a moving target, so it's not really about getting where you want to be as much as it's about getting moving at the right speed and figuring out where you want to go from there.

#5296146 whats the "Big O" of this algo?

Posted by Khatharr on 11 June 2016 - 06:01 PM

Big-O is one of those things that can be harmful if you try to pick it up by hearsay. Study it out and check to ensure your understanding.


It's a measure of how a thing scales. Even for a massive dataset a particular O(n^2) algorithm can be infinitely faster than an O(1) algorithm. Be careful.

#5295525 responsiveness of main game loop designs

Posted by Khatharr on 07 June 2016 - 02:38 PM

someone here or on another recent thread was mentioning button presses on the order of 10ms. at 60Hz, you'd poll every 16.6ms. and polling would take less than 1ms most likely. so you could poll at t0=0ms, finish polling at t1= 1ms, press the button at t2 = 1.5ms, release at t3=11.5 ms, and the next poll occurs at t4=16.6ms. and just like that you missed an input entirely.


Yeah, science sucks, lol.

#5295432 C# and Unity for 2D Side Scroller

Posted by Khatharr on 07 June 2016 - 12:36 AM

Not having to learn a made up ecmascript variant is a start. The d-n-d editor is a joke if you plan to make anything more complicated than a dead-simple platformer. GM is terribad for working in teams as well, whereas Unity has settings that make it play nice with version control. Unity has nice tools for automating animation via state machines, good physics and collision that can be fine-tuned as you desire, and works with external editors so you can code in your own environment. The component-styled UI is powerful, and the way it exposes public script members so they can be edited from the UI - even during debugging - is great. The canvas system is more powerful for making and tweaking in-game menus and HUD elements. Unity supports custom shaders without tomfoolery. Both support a kind of object hierarchy, but Unity's is similar to a scene graph, which ends up being much more convenient.


Unity also has never decided to simply disable previous PAID versions of their software, leaving people stranded and unable to continue their work unless they upgrade to the new version and deal with the massive slew of breaking changes involved in that process.


GM can be used as a tool for people that are code-phobic so that they can overcome that phobia, and it's decent for prototyping, but for serious projects I'm just picturing hours upon hours of opportunity cost.

#5295422 C# and Unity for 2D Side Scroller

Posted by Khatharr on 06 June 2016 - 10:26 PM


Unity is overwhelmingly superior to GM in my opinion. You have more to learn with Unity, but that's only because much more is made available to you.

Additionally, Unity's tutorials are more comprehensive.

I am curious about why OP had trouble rendering in 2D though. Were you trying to use GDI or something? If so then maybe take a look at Monogame as well.

#5295344 responsiveness of main game loop designs

Posted by Khatharr on 06 June 2016 - 02:06 PM

Hey, let's do some science. Set up a simple input system that polls at 60hz alongside an input system that simply logs all input state changes as they occur, then see if you can press and release a key fast enough to miss the polling.

#5295059 Ball passing through gap between blocks

Posted by Khatharr on 05 June 2016 - 05:23 AM

Since you're only checking against AABBs, create an AABB that encloses the start and end positions of the ball for your dt. Every brick intersected by that is a candidate. That's your broad phase.

Calculate the time of impact (use FLOAT_MAX for misses) for each block, then pick the one with the lowest time.

Once you find that you advance the ball to that point in time, apply the effects of the impact, then integrate again with the remaining dt, doing however many impacts are necessary until the dt is consumed.

#5294934 What is the output?

Posted by Khatharr on 04 June 2016 - 06:06 AM


#5294824 [DirectInput] Get gamepad button name

Posted by Khatharr on 03 June 2016 - 12:19 PM

but is it really common to show gamepad bindings as "Button0"-"ButtonX"?

Yes, apart from XInput it's usually just numbered buttons. It's not hard for the user to figure out during key mapping. If you push a button and it says "Button 1" then chances are you're pushing button 1. There's really no standard to these things, so trying to predict what's what will only piss off the people that you guessed wrong for.


If you're interested in a specific controller then you can just have an option to label the buttons for that controller specifically. For example, some XInput games have an option for "Dualshock 3" that changes the XBox button labels to their SCP Driver equivalents. (Usually it's just a matter of loading a different texture for the button images.)

#5294709 [DirectInput] Get gamepad button name

Posted by Khatharr on 02 June 2016 - 04:00 PM

'Fraid not. One of the reasons DInput was deprecated is that gamepads and other HIDs are not standardized. If you're concerned about this kind of conflict the best thing to do is to offer custom key-binding support to the user. If you're exclusively concerned with gamepads then consider using XInput instead, as it has become something of a de-facto standard for gamepads on Windows.

#5293495 Do you usually prefix your classes with the letter 'C' or something e...

Posted by Khatharr on 25 May 2016 - 11:15 PM

Do you usually prefix your classes with the letter 'C' or something else?



#5293467 Can I write a browser game only using Java?

Posted by Khatharr on 25 May 2016 - 07:35 PM

Please don't. JRE (and plugins) is a huge annoyance for users. You may want to look into JS and the HTML5 canvas instead. There's plenty of material available for that. Just google HTML5 game development and see what comes up.