Jump to content

  • Log In with Google      Sign In   
  • Create Account

Waterlimon

Member Since 28 May 2011
Online Last Active Today, 05:52 PM

#5286971 Stuck the ball in the board (pingpong game)

Posted by Waterlimon on 14 April 2016 - 11:13 PM

Make the paddle ignore the ball if its traveling away from it.

 

Currently the ball goes a bit inside it, its directions is reversed, its still inside it, so it gets reversed again (which prevents it from ever leaving the paddle)

 

 

To do this, ensure the direction the pad points, and the direction of ball velocity, point away from each other, before reversing ball direction (dot product is how you do this with vectors - but you can just use a simple conditional if you want to)




#5284769 Polymorphic uninvolved parenting?

Posted by Waterlimon on 02 April 2016 - 12:35 PM

Either use a Derived* instead of Base* where necessary (part of the code might deal with a specific derived class, while another part is more generic and only needs base pointer), move it into the base class/interface, or come up with a messy system to ask (through a Base*) what the actual derived type is, and then cast to Derived* and then call the function (if you find yourself needing to do that a lot, theres probably some bigger architectural problem).

 

For example, if both "draw" and "write" actually just draw the thing, they should both be called just that (and not separate names for no reason), and you can then put it in the base class.

 

In some cases, you might find that some base class things are not used by all the derived classes. This can be fine if it allows more flexibility in what kind of derived classes you can create. But remember that increased flexibility often comes with reduced maintainability/readability/performance (compare having 1 god-class that does all the things, and a bunch of specialized classes, or having everything be a global variable vs keeping things nicely local and scoped)




#5283516 tutorials

Posted by Waterlimon on 25 March 2016 - 09:24 PM

Make the UI intuitive (as in, dont make every button an obscure symbol with no tooltip), so, given an objective ("youre thirsty"), the player can easily click on some things and see some water-related stuff and hopefully figure it out.

 

Then you just need some such objectives (either explicit ones or implicit like that "youre thirsty" one) to motivate the player to explore their options.

 

Another thing you should do, is write some checks that activate when the player isnt doing something right (or looks like they have time to work with some advanced feature), and show a hint/mini-tutorial that introduces the concept and gives some advice on how to proceed. With option to never show again, of course (and option to override those decisions for a new game).

 

For example, if the code detects that the player is thirsty, you could show hint that lists possible sources of water (maybe even detect the best options nearby and list those).

 

It of course helps if the first game is in a scenario where everything is guaranteed to be somewhat easy (so the player doesnt have to go on a quest through your most complex features to get a drop of water...). Perhaps even throw in some 'cheats' like free resources to prevent failure when the player is still learning the basics (you could have it opt-out, so player can start playing 'for real' in the same world when they get the hang of it)




#5281252 Efficent Tagging

Posted by Waterlimon on 14 March 2016 - 02:58 PM

Yeah, avoid "stringly typed" code.

 

If your tags are stored as text, parse them into something more computer friendly (assign each unique string, an integer ID).

 

So now you have integers. Using those might already be good enough for you.

 

 

Since the tags are basically memberships in a set with a fixed number of possible sets, you might be able to compress them into a sequence of bits (to quickly do your checks using bitwise ops). std::bitset works if youre using c++ and can set an upper bound on possible tags at compile time (as the size is needed for the template). Or just use plain old integer if you dont have that many and like things simple.

 

You can also make tags that combine several 'fundamental' tags, to reduce the amount of tags you need per object. For a weapon, instead of tags [orc,human,dwarf,...] you might just use [hasHands]. (this will also make it more structured and maintainable, if you suddenly decide that some race has no hands, and no longer can use half of the 5000 weapon types you laboriously defined... good to have that automatically work)




#5281080 how could unlimited speed and ram simplify game code?

Posted by Waterlimon on 13 March 2016 - 01:19 PM


Is this true Waterlimon?

 

I wasnt referring to any particular language, but prolog did enter my mind while writing that (along with all those functional languages there are?)... Note that I dont know anything about prolog, except someone once said that it can solve stuff for you or something :I




#5281053 how could unlimited speed and ram simplify game code?

Posted by Waterlimon on 13 March 2016 - 11:33 AM

We would start writing more declarative code instead of imperative. We dont write how to get to the result, we write what properties a valid result shall have. Then the computer brute forces a perfect solution.

 

For example, when doing pathfinding, we would just say we need a solution in the form of a list of nodes, and the combined cost of the nodes shall be minimal, with first node being specified and every following node being adjacent to the previous one, and no node exist more than once in the list.

 

It would be more like math I guess.

 

 

Though maybe such a language already exists but nobody uses it because it allocates everything on the heap and has weird syntax.

 

 

Of course, we would just make a game that works exactly like our universe, and its so awesome that everyone plays just that, and then we build regular old slow computers inside that world and think how cool and challenging it is to deal with the limitated system resources...




#5281052 no good way to prevent these errors?

Posted by Waterlimon on 13 March 2016 - 11:23 AM

If the x,z things are (mathematical) vectors, I use a vector object instead of independent variables, so I would either do

A.something = B.something

A.mSomething = B.mSomething

 

or

 

for(int i=0;i<2;++i)

{

A[i] = B[i];

}

 

Both of which reduce chance for manual errors when doing repetitive stuff.

 

I guess if you have an y component and want to skip that, and its a common thing, you can write a special function for that:

A.setXZ(B)

 

So whenever I do anything related to vectors/matrices I use loops instead of manually handling every component. It also usually generalizes to any number of dimensions if I care about that.

 

 

For other things, if you cant make the type checker detect the errors, see if you can change your naming conventions to highlight them better. mX instead of mx might be more visible. Also consider adding comments that state what must be done, before actually writing the code. That will force you to think a bit more and also remind if you forget something while writing it out.

 

In the case of using current_location instead of new_location, perhaps you can limit the scope of variables even more (such as by using anonymous scope), so theres less potential wrong choices to make. Some people might also make variables useless by setting some garbage value just after the last use (like setting pointers to nullptr after delete).

 

Then theres tools like assertions and unit tests, which are also a bit like comments, except theyre actually checked. People really care about writing safe and correct code, you could even look into fields where its extra-critical and see what they do.




#5280061 is there an easier way to do this?

Posted by Waterlimon on 07 March 2016 - 02:28 PM

For the basic information that every object needs filled in, you could write a simple editor (if theres a ton of items) that asks the data in efficient way and writes it to all the places necessary.

 

Ensure the common case has a sensible default that allows you to skip providing the data (probably applies to everything there). Make it so, that when adding some entirely new functionality, you can skip all the common data (appearance, physical properties...) and focus on the functionality. So you dont need to finish/decide every aspect of the entire item before it even exists. That should make it less annoying to add new things. Fill in the details later.

 

See if theres any way you can add more templates/helpers to minimize amount of data/boilerplate you need to input. Try to bring all the information in a single place, in correct order (having to jump around multiple places adding stuff is slow). (this is what an editor would do - even if all the data was in code, you could have some text console editor insert the data and write the boilerplate for you)




#5277803 Manufacturing chain for paper

Posted by Waterlimon on 23 February 2016 - 05:12 PM

Toilet paper?




#5277008 New Studio Name, Thoughts?

Posted by Waterlimon on 19 February 2016 - 12:56 PM

 

 

Good Bishop Studios

 

Bad Bishop Studios

 

King's Bishop Studios

 

Queen's Bishop Studios

 

Indian Bishop Studios

 

Bishop Pair Studios

 

 

Pfft

 

C5XfN2C.png

 

I demand 75% revenue share




#5276017 Victory conditions for a 4X

Posted by Waterlimon on 16 February 2016 - 03:28 PM

It might feel better if you have to complete those achievements within limited time (it can be a long time, but still a clear limit)

 

Perhaps, you also need to survive until that limit, even after completing the necessary achievements.

 

So you have to do some time management as well. Maybe you can get all the achievements by going all in, but expend too much resources doing it and fall before the time limit. Or maybe you want to play it safe and leave a difficult achievement toward the end (eg build something big which requires selling most of your army), but something unexpected slows you down and you lose.




#5270205 none issue when near plane = 0.01, is it just matter of time when I see artif...

Posted by Waterlimon on 08 January 2016 - 09:19 PM

The value of near plane is irrelevant on its own - what matters is the relative magnitude of the near and far plane to each other.

 

Set far plane as low as you can without issues. Then near plane as high as you can without issues.

 

If theres no issues, everything is fine.

 

If there still is issues, you need to do something else in addition to simple depth testing to deal with the cases where it isnt working (like doing multiple passes for different depth ranges to increase precision withing each range, or depth biasing like you have).




#5268915 Fun Challenge: Implement Polymorphic Callback

Posted by Waterlimon on 02 January 2016 - 08:11 PM


You are relying on vendor specific behaviour.
Calling conventions are up to the compiler and platform. So calling the member function as a free function with an implicit this argument might fail.
 
But as long as it works...
It's the same trick that the FastDelegate library uses. Only it has compile switches for a dozen compilers or so.

 

I dont specify the calling convention (I never convert the member function pointer to something else and only call it knowing both the class type and member func ptr type)

 

AFAIK the only requirement is that the member function pointer is compile time constant (as its used as template argument to 'wrap' it into normal nonmember function). Shouldnt compile otherwise...

 

Im not sure if the above assumption is true for something like virtual methods (it COULD be?). But yeah I dont feel confident using it for anything else than regular member functions which I can assume are known at compile time (better be, for my performances sake)




#5268874 Contrevertial Simulator Idea - Feedback Needed

Posted by Waterlimon on 02 January 2016 - 02:30 PM

You could also implement it so that the player is not the leader, but the very idea itself.

 

So it doesnt matter if groups of people claiming to be the cult all die, as long as the idea survives (if your idea bans internet, it might make your cults more resistant to its members becoming sane, but it might not spread so well, etc)

 

Ofc it could be interesting if you can directly control the leaders or whatever (maybe the idea is so ingrained in them, you have direct control)




#5268726 Raytracer is not working

Posted by Waterlimon on 01 January 2016 - 01:32 PM

try adding a minus sign somewhere...?

 

 

try track some rays in debugger through sphere test to see why they dont hit, maybe you will find bug






PARTNERS