Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 May 2011
Offline Last Active Yesterday, 07:11 PM

#5258551 Looking for feedback on menu system design

Posted by Waterlimon on 22 October 2015 - 12:54 PM

The menu buttons usually have shorter descriptors.


In your case something like:

-New game

-Load game (or 'Continue')

-Options (with both graphics/sound options there)



Is quicker to understand.


graphics/sound options should be grouped together because theyre both options, and could for example use a common 'apply changes' button or such. They might be 2 different tabs under the 'options' menu.


I suggest separating the 'quit' button from the rest. Spatial separation (add empty space or put it in some corner), color it red, put an empty line above it... That way you dont accidentally click it, and its easy to spot (if you want to quit, you dont use the other buttons, and vice versa).




Also, make sure the transition animations dont last longer than a fraction of a second. That kind of thing is annoying (might have just been the video though). For example, fade in the next menu WHILE the animation is playing, and allow making changes immediately (while the animation is still going)

#5258392 Problem with save mechanisms

Posted by Waterlimon on 21 October 2015 - 01:23 PM

Make sure you read and write the savefile in same order, or youll get garbage.

#5258078 Flow in an asymmetric game

Posted by Waterlimon on 20 October 2015 - 05:42 AM

Maybe you want some kind of stabilizing factor that is strong in early game and weakens toward the end.


Early, aggression will give you little benefit.


Late, aggression can gain momentum and swipe out entire alien empires.



Maybe you can even control it to shape the stability curve over time - maybe some games end up with early aggression, others with stability-aggression-stability, yet others with the stability-aggression progression.




-Tech development that gives you powerful attack weapons near the end (planet destroying lazors etc)

-Early tech that discourages heavy aggression (like nukes do today) but becomes less of a danger later (better defenses, maybe you capture so many planets they cant strike all, maybe population moved underground...)

-Finite resources with high cost to begin extraction, so early game you dont have need nor the resources to capture planets for their resources (too costly to begin extraction). But late game, you NEED the resources, and the enemy already build full extraction facilities (lots of money and time went into it)

-Make player unaware of enemy locations early on (information takes time to travel in space, poor 'radar' tech, etc), so you might find one or two planets of an enemy empire, but cant find the rest without going all over space.


Thats for stable-aggressive progression, but you get the other ones with little modifications (counter-counter weapons, access to new tech, multiple resources that shift importance in long term to affect gameplay...)

#5256532 What makes a City Builder fun?

Posted by Waterlimon on 10 October 2015 - 09:23 AM

It really depends on the player.


Some players focus primarily on visual appearance of the city, others just care about functionality, and yet others just go for whatever pops up in their mind and end up with some ugly design that doesnt even work - but at least it has that district where only dirt roads are allowed.


If you think about city builders, theres a bit of everything. Theyre sandboxes, the player can play just like they want to.


Create a complex simulation, but keep the rules lax enough that the player can decide what aspect they want to focus on. But make sure that it stays challenging IF that is what the player wants - for example let the player choose where to build their city (varying terrain, tourism, weather, trade opportunities, natural resources...)


You want a lot of variables like that. You dont want every city to be able to be everything at the same time. Thats boring. Theres little replay value in that. Give every city limited choices, and even more limited paths they can actually follow at once. Some more, some less (again, depends on player how much challenging restrictions they want).


Really, just throw in all the things and youve got a city builder.

#5256136 Empire wide buildings

Posted by Waterlimon on 07 October 2015 - 09:07 PM

Maybe something like internet services?


I mean, you would surely get +50% technology points if you set up stackoverflow or wikipedia :)

#5256005 Internal space ship gravity (Unity3d)

Posted by Waterlimon on 07 October 2015 - 07:59 AM

If I understand you correctly, your gravity works while ship is not rotating? So WHILE the ship rotates, theres issues, but when it stops, everything is ok?


If so, could the sliding be because the rotation causes the character to accelerate, so theres actually two forces, gravity and acceleration because of centrifugal pseudoforces (or whatever they call them)?


In that case, try:

1. Increase friction between floor and character - you cant slide if friction is high enough (assuming the physics work correctly and its not some glitch)

2. Dont accelerate the ship too fast (even angular acceleration is acceleration)

3. Design the ship to minimize such additional forces (dont make ship long on an axis where it rotates fast)

4. Separate the ship-internal physics completely from the external physics AKA cheat. Like if a player enters a ship, spawn them in a stationary "ship internals" world that has not much to do with the actual ship doing crazy 30 g manoeuvres while you chill there. How to accomplish this depends on your tools.


If this is a physics glitch instead of a natural consequence of rotating the ship too fast, then you might want to read on known issues with whatever you are using, or how they work, to figure out why its happening.

#5255778 Learning Calculus Online

Posted by Waterlimon on 06 October 2015 - 02:59 AM

I know from some graphics equations that that squiggly bar with a and b has something to do with angles or hemispheres, so I guess the sin()’s came from that.


If you mean the integral symbol, not just angles or hemispheres. You integrate over a variable, which might be an angle. In the article it just uses a generic "f(x)", where f is integrated over the variable x. A bit unclear, but here f(x) = sin(x), so thats where the sine comes. It could be any function, integrated over any variable (specified by the dx thing).




Then there is h.  What is this magical number?

"step size h"

Integrals are not discrete, you break it into steps of size h along the variable being integrated over to make it computable. You approximate the integral, h controls the accuracy. Infinitesimally small value (infinite steps) is equivalent to the integral itself.




Why is it divided by 3?

If you look inside the [] you can see that its something like 2*(sum of f(x) over half range) + 4*(sum of f(x) over half range) + the edges.

Ignoring edges, thats something like 6*(sum of f(x) over half range) = 3*(sum of f(x))

That 3 needs to go poof since we only want sum of f(x) over the range.


Thats a horrible simplification of what seems like a complicated method though. Stare at the derivation on the wikipedia page for a few hours to know why it actually is there smile.png



Integrals are not dependent with trigonometry in any fundamental way. You can integrate over trigonometric functions using the angle as the variable of integration, but thats no different from any other arbitrary function. That probably got you confused.


The rest seems to be just examples of using this approximation with more complicated functions (instead of sin(x)), spawning all those sqrts and stuff.



You can probably calculate the area of some discrete function using a for loop (sum of rectangular slices).

An integral is what you get with infinite steps, but you know that.

What the article shows, is not just boxes. A flat-top box is a bad approximation of a curved line. So they come up with maths to use different shapes for the top of the box. A slanted top instead of flat. Or maybe some fancy polynomial (which seems to be what this "simpsons rule" used in the article is?). To minimize the "error" between the flat top of the box, and the not-flat curve of the function being integrated.


I know khan academy is one place to learn such things, dont know if pace is right or if you like videos (get a book if not, should be plenty to choose from).

edit: https://www.khanacademy.org/math/integral-calculus/indefinite-definite-integrals  (Not sure if they cover the approximation used in that article, but it has something about approximation at least)

#5254818 Could this really be that slow?

Posted by Waterlimon on 30 September 2015 - 10:38 AM

If I calculated correctly, on 4 GHz core that would be like 4000 cycles for each cell. Given that for each cell you check a region of 9 cells (~500 cycles per checked cell), I guess thats feasible if theres some cache misses and branch mispredictions (googling tells me the former can be hundreds of cycles).


Are you running in release mode?


Is there a certain size of grid where performance suddenly falls? Maybe you can make a graph for fun smile.png

#5254805 Flow in an asymmetric game

Posted by Waterlimon on 30 September 2015 - 09:46 AM

If the player is better than alien, they win, else they lose.


You can add random events and hidden knowledge to create opportunities to change the tide of battle, if that fits the game. So if alien is winning, maybe player can strike a weakness to prevent defeat.


That would make the "uncertainty" region of who will win, bigger, since theres more unknowns. So game remains interesting for longer, when its not just the first moments of gameplay that determine the winner.



Then, the problem of momentum. Once a side is winning, what prevents them from pushing through all the way?


First, just make everything slow enough, so it takes some time. Maybe taking over a planet is not instantaneous, maybe you need to build infrastructure before being able to push further.


Second, let the battlefront oscillate. Like a spring with ever increasing energy, until it finally exceeds a limit in either end and one side is victorious. You push hard, both sides lose resources, but you are left with weakened force, allowing alien to push back, repeat.


One way to implement that would be to give limited offensive power to both sides, that takes time to regenerate, and isnt sufficient to wipe out the entire enemy in one go. Basically, you 'spend' your offensive capability to hurt the enemy somewhere, but have to go defensive after that, giving enemy an opportunity to do the same.

#5254627 Smoothing terrain heights

Posted by Waterlimon on 29 September 2015 - 11:02 AM

If youre smoothing using gaussian blur, I know you can separate it to vertical and horizontal pass. And for those, you could do one row/column of pixels at a time (so only need to copy that slice of pixels).


So say for the horizontal blur, maybe you first do the top half and then bottom half. Then you only need 8k*4k temporary texture instead of 8k*8k (all the way to 8k*1 if memory is scarce)


This needs ability to read/write to same texture, dont know how well that is supported (I assume at least newer APIs can do something like that)

#5251790 Sort unit vectors clockwise

Posted by Waterlimon on 11 September 2015 - 04:40 PM

bool compare(a,b)
return a.x*b.y + a.y*b.x < 0

a is less than b, if dot(a, perpendicular(b)) < 0



Uh... assuming a number line that wraps around smile.png (you dont have an absolute ordering in such a space)


First youd use this to split the space in two along a unit vector of your choice, then sort those using the same function, then join the halves.

#5251786 Bad performance when rendering medium amount of meshes

Posted by Waterlimon on 11 September 2015 - 04:18 PM

Do you have a lot of overdraw (many overlapping pixels)? Since what you described is the amount of vertices you have, when there are A LOT more pixels than vertices when rendering a mesh. You can quickly check whether fill rate (overdraw, or just slow pixel shader) is a problem by changing the window size (changes number of pixels but keeps vertices the ~same).



btw, you can associate the index buffer with the VAO (just like VBOs) if you dont specifically need to use multiple index buffers with the same VAO

and you probably should use 16-bit indices if your meshes only have ~28 verts.

#5250729 Single pixel holes in GBuffer

Posted by Waterlimon on 05 September 2015 - 03:06 PM

Are the vertex positions exactly equal?


One way to guarantee this is if you use indexed mesh and both triangles index the same vertex.

#5250701 Single pixel holes in GBuffer

Posted by Waterlimon on 05 September 2015 - 11:23 AM

That can happen with "T-Junctions" in the mesh, where a vertex is located on the edge of another triangle (instead of at one or the other endpoint)


Also if you render both faces of the triangle then winding order differences can be an issue I think but if you only render one face that cant happen (within a single mesh).

#5250441 Most efficient way of designing a vector class in 3D

Posted by Waterlimon on 03 September 2015 - 11:34 AM

My vector class is basically:

Vector<ComponentType, Dimensions>


With typedefs as:




etc. (for all primitive types for dimensions 1-4)


And I chose to ONLY allow array subscript access:

myVector[0] = 1.0f;


For matrices (similar in all other aspects), I instead use call operator overload:

myMatrix(0,0) = 1.0f;

Because Im not going to make a fancy proxy class just so I can use [].



Its just 2 extra characters so I didnt see a reason to hack support for x,y,z,w. Those dont even allow indexing by variable (which is usually needed to avoid code repetition) so it would be a messy combination of array style access and letters, which would probably just lead to bugs and harder to understand code.



Ill have to add Vector.swizzle(indices) (as in glsls vec.xz for example) because lack of having that has annoyed me recently...


If I were to add x,y,z I would probably just use methods named x() y() z() for them. That way I could implement the swizzle stuff like xy() xz() and so on using same syntax.



Also I love how VS2015 can create the method definition body for me because creating those by hand is not fun with these template classes...