Tag Info

Hot answers tagged

10

I would also consider allowing a stack of states. That way when the state on top leaves, the state under activates. this is really nice for menu states. When one menu leads to another, it simply puts the next state on top. If the user wants to go back, you simply deactivate the current state and the previous state activates. Very easy for menu navigation. ...


8

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 ...


8

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 ...


7

I'm just going out on a limb here and assuming that your drawing is painter style, in that something drawing first will show up behind something drawn after it. If that's the case, it's simply a matter of sorting your entities by y position before you draw. I'm assuming you have some mechanism of iterating through all of your entities. You'll have to sort ...


7

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.


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

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 ...


5

The problem here is that you are trying to get a controlled object (screen you're in) to direct it's controlling object (ScreenManager). Two approaches come to mind: Adapt the code of the library so that the ScreenManager listens for and acts on custom events fired from the screens it manages. You could send events that carry an instance of class object ...


5

Having tried every conceivable way of doing it, I have found if it's purely a 2D game, just use the screen drawing system, it will make your life much easier. Sin, Cos, and atan2 need to be used slightly differently, but this inconvenience is easily made up for by the simplicity of knowing which way up, down, clockwise and anti-clockwise are. I would also ...


5

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 ...


4

Since it is most likely that the logic of your game will not change from level to level, rather it is the content that changes - map, characters, enemies - it doesn't make sense to create a new screen for each and every level. Each new level screen will be almost identical to the previous ones except for maybe a few properties, fields, and the ...


4

Just in case you missed it, there is a document (think its a html page) that outlines what it all does. Though you probably have already read this, and just need a brief overview.


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

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 ...


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

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

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, ...


4

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) ...


3

Assuming that you have an array containing every object that needs to be drawn. On each game loop you would loop through this array and call each object's corresponding draw() method to place it on the canvas. If you are doing it this way then you can use a sorting function on the array that will sort the array based on the object's Y axis value. So when the ...


3

A good architecture is keeping the GameState and ScreenManager objects separate so they don't directly know about each other and only indirectly communicate though an EventDispatcher object; ScreenManager registers with EventDispatcher as listening for messages about models being picked, and GameState sends a message to EventDispatcher about a model being ...


3

You can render the normal game objects using perspective view, and then when the render func is done with that, switch to orthographic view and render your GUI or whatever it is, this way. Using glOrtho you can define your screen going exactly from left 0 to right 1 and the same for bottom and up. Since there is no perspective distortion anymore, those ...


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

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

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 ...


3

Since you have to target Windows Phone OS7.1 in order to use XNA for Windows Phone 8 I believe that you are stuck with that profile. One possible way of circumventing that is to use MonoGame to develop it which supports Windows 8 and Windows Phone 8.


3

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 ...


3

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.


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 ...



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