Hot answers tagged

13

I'm not sure what sort of hierarchical FSM do you have in mind, so I'm sorry if this does not directly answer your question, but I'd really like to take the chance and add some input from my own experience using a stack based screen manager. Since you need the ability to open a popup screen but still be able to see the screens below, having a stack based ...


11

Unless you're using AbsoluteLayout (Usually a very bad idea, as you design your layout using x/y coordinates, which will only suit the device it's been designed on) this should not happen - Android applications automatically adjust to the device's screen-size. However from what you describe (Layout does not adjust to Table Screen), it sounds like ...


8

Do you think it would be a good idea to have each part of the screen (game session) handled by different thread? When it comes to rendering: No! OpenGL and multithreading don't mix well. It's best practice to keep all OpenGL operations to one single thread.


8

As I understand it, the major difference between hierarchical state machines and stacked FSMs (HFSM and SFSM from now on) is that in an HFSM transitions away from a low level state can be specified directly, whereas in a SFSM, states in the subgroups cannot have specific exit conditions that leave the subgroup. Probably best with an example: This is a HFSM:...


8

Was it necessary for a game developer (in Android, game consoles, online, or in desktop) to display the loading screen to cover unfinished rendered game environment and to prevent from other users thinking that this game is either lagging or freeze. Yes, loading screens are used to hide resource loading and it's somehow a more entertaining way to tell ...


6

Depends on the game, if the game is single-player, let the user select a resolution, if they are happy for small characters, they can have it, if they want to feel connected with the game, they can use a lower resolution. Games like Civilization opt for this method. However, if you're building a multiplayer game, you're going to need a fixed resolution, ...


6

So you have two coordinates or vectors, one is the center of the screen (C from now on) and the other is your object (P from now on.) If you know some math, you might know that a line can be expressed as an origin and a direction vector. The origin is your screen-center, while the direction vector can be found subtracting C from P. This equation can also be ...


6

What that code is doing is limiting motion to only if you're inside the screen. What you should instead do is something like this: //control code here if(player.getx() > 1024){ player.setx(1024); }else if(player.getx() < 0){ player.setx(0); } that way if the player exceeds the bounds of the screen the position will be set back to the bounds.


6

I need vector in iso coordinates that leads outside the monitor (is normal to a monitor screen). It's two rotations. Your tiles are half as high as they are wide. Projection/dot product is proportional to cosine, and arccosine(1/2) == 60 degrees, which means that's your first rotation. It is followed by a 45-degree rotation. You start with unit-z, 0, 0, ...


6

Try using this Camera:unproject method: unproject(Vector3 screenCoords, float viewportX, float viewportY, float viewportWidth, float viewportHeight) from the documentation: Function to translate a point given in screen coordinates to world space. It's the same as GLU gluUnProject, but does not rely on OpenGL. The x- and y-coordinate of vec are assumed ...


6

Probably because that's how coordinate systems are traditionally set up when doing math. But to be honest, OpenGL can have its origin anywhere you want and its axes can point in any direction you want (well, so long as they are perpendicular to each other). If you want the origin in the top left and the Y-axis to point down, you simply set your model-view ...


5

There are multiple points that come into play: Switching from windowed to full-screen mode often involves recreating some rendering / drawing contexts which simply needs some time to do some "administrative" tasks, such as allocating memory. This may also involve finding a matching resolution that works (e. g. see the documentation for this D3D9 method) ...


4

I think your idea is pretty much spot on! First calculate a ray for your cursor using both the near plane and the far plane as Z values for your 2D coordinates (i.e. use 0 and 1 for your Z coordinate). Here's an helper method to handle that: public Ray GetScreenRay(Vector2 screenPosition, Viewport viewport, Matrix projectionMatrix, Matrix viewMatrix, Matrix ...


4

Introduce a state variable. When the state is paused and not running draw a scene2d stage with the elements of your pause screen. Unpausing sets the state back to running, which then starts rendering and updating your game screen. The overlay or popup effect can be achieved through an image. So in short: use a switch case statement on the game state in ...


4

I see that you've already accepted an answer, but I feel I can add to it. I have written a blog post about this here. The gist of it is as follows: "After a bit of research, I’ve come to the conclusion that most Android phones that I want to target have a 480×800-ish resolution. I’ve also noted that the smallest aspect ratio of any Android phone (held in ...


4

As congusbongus wrote, you have listed most of the options. The usual solutions we use in games (sorry I'll be repeating you a lot): You can keep the gap. If you'll do that, you definitely should center the play area so the gap is the same on all sides. Otherwise it looks strange visually. Then you can.. Fill the gap with some solid tiles, or even some ...


4

Letterbox and scale. Percentages will still break your game. Think about different aspect ratios. The window might be 3:4, 16:10, etc. If you depend on pixel locations, these ratios between player and enemy locations will end up differing. Instead, just pick a size of your world completely independent of pixels. Scale your graphics up or down if the ...


4

Define a vector that shifts the rendered position of everything. When that vector is (0,0), the screen is still. Changing it randomly every 5-10 frames causes the screen to shake. You can smooth this change if you like.


4

What is the proper name for when you change views or screens? I have always called this a view / screen transition. This seems to be an accepted term across a variety of contexts, ranging from game development to software development, both through documentation and physical demonstration. This term does not just cover the fact that we are moving from one ...


4

For desktop games you can control the supported aspect ratios directly in Edit -> Project Settings -> Player -> Resolution and Presentation But for mobile, or situations where your aspect ratio might change during play (eg. resizing a window dynamically), or you want to use letterboxing for artistic effect, we'll need an in-game solution. You ...


3

First of all pixel on the screen is a ray in your 3d world - all scene behind this pixel. Second, what you must know, that any point in 3d converted into 2d motinor space via multiplying 3 matrices: pointIn2DSpace = pointIn3DSpace * WorldMatrix * ViewMatrix * ProjectionMatrix So you can do a back conversion, multiplying "monitor" point with inverted WVP ...


3

There is a good and relevant article on Android.com : http://developer.android.com/guide/practices/screens_support.html This reference helps you sort through screen size, screen density, and resolution. The goal is to use the Android APIs to achieve "density independence" so that your user interface components and graphics can look good on various devices. ...


3

A few things to consider : What happens after your fake loading screen is over in the case some user has a machine slower than yours? (Which will happen) Making a loading screen has never been a rule (i do not know if there is "rules" in video game making) but a good practice to prevent users with slower machines to see objects pop on the screen. If after ...


3

Yes, you should use WM_INPUT for things like camera movement. Why? Because it doesn't matter what the mouse's factory DPI is. Pretty much all games give the user a "mouse sensitivity" setting, where they can tweak a custom DPI value (they don't need to know it's the DPI!) to fit their preferences. When it comes to GUI, you should still use the ...


3

I use a screen stack system to handle this kind of thing. Think of your screens as objects containing individual update and render logic that can be stacked on top of each other. These screens are then updated top -> bottom so that the most recent screen always has control. They are rendered bottom -> top so that overlays (pause screens/transparent ...


3

Here's a rough sketch of an algorithm that might do this. Use the camera to calculate an inverse view projection matrix. Then transform all the cube's vertices using this matrix. You now have all the vertices in screen space (-1~1). Compute the convex hull of all these vertices and then clip this convex hull inside the screen space. You now have a polygon ...


3

camera = new OrthographicCamera(); camera.setToOrtho(false,800,400); Above code will draw everything in your game on 800*400 virtual screen (in pixel) and fit, stretch, fill etc (see viewports ) on device's screen, independent of device screen size. https://github.com/libgdx/libgdx/wiki/Orthographic-camera https://github.com/libgdx/libgdx/wiki/Viewports


3

You should avoid invoking new instances in your render and update methods. As these methods are called numerous times per second, this can be a pretty straining task, as the unreferenced instances will have to be freed in memory through garbage collection. To solve the two Vector2 problems, easy: Declare and instantiate two global Vector2 attributes, and ...


3

Think back to the graphs you would draw in school. The (0,0) point is at bottom-left. Now, OpenGL is an old, old API and it's derived from an even older one. There were no gaming graphics then; 3D graphics required an expensive workstation with an expensive professional accelerator, and were used for graphing, for CAD, for other professional tasks. Hence ...


3

'view' is typically related to what is seen by a camera. 'screen' is generally what's in your top level game state, e.g. main game screen, option screen, title screen, main menu screen. 'screen transition' is when changing screen. 'game state' comes from the fact that most games are implemented using state machines.


Only top voted, non community-wiki answers of a minimum length are eligible