# Questions tagged [logic]

The tag has no usage guidance.

114 questions
Filter by
Sorted by
Tagged with
64 views

### Moving Multiple Objects With Vector2.MoveTowards Not Consistent

Good Afternoon, I'm trying to move three objects from their current position to a shared target position based on speed. Once they reach the target position, they move to a shared respawn location and ...
• 164
1 vote
124 views

### How to implement NPC that reads player input and counters it?

input reading = NPC reads the input of the player and instantly reacts to counter everything the player does. So, is it like : ...
• 863
1 vote
241 views

### grid(tetris) inventory system

I'm trying to adapt my current inventory so that the items can occupy more than one slots (cells) like in this image: Any idea that might help me? My inventory is an Image that has grid layout and ...
1 vote
33 views

### Polling Behaviors with Geometry Based Collision System

This one's going to be interesting to explain. Let's say I'm making a geometry based collision system for a platformer, where polygons exist based on the lines that form them. I'm using some basic ...
111 views

### Pygame Traffic signal logic

I am currently working on a traffic simulator with Pygame, however i am struggling with implementing the logic of the traffic signals. Any help is welcome. My traffic simulation is grid based. The ...
1 vote
1k views

### Reorientation when rotating Transforms around another Transform without parenting

The functionality I am trying to implement, consists of rotating one Transform and appling this rotation to other relevant Transforms in the scene. To make it a bit more clear: I have several objects ...
1 vote
48 views

### Translating conditions ("If A has B, then true") into objects that satisfy them ("A has B")

I have a system where I'm sifting through a large number and variety of objects in my game, looking for objects that match an arbitrary search criteria that can be simple or complex. For example, ...
• 330
126 views

### Texas hold'em game logic loop

Ok, so I was thinking of making a Texas Hold'em game, and I wanted to write down the game logic loop before starting. Here's what I have. Tell me if I missed anything or if anything is wrong. Game ...
• 200
71 views

### How to disable pause() in game_loop() once game_over() function is called?

How can I disable pause() in game_loop() once game_over() function is called? game loop ...
1 vote
112 views

### How to correctly solve a procedurally generated puzzle?

I'm creating a puzzle game where the player must remove all colored blocks from a grid. When the player selects a block, all adjacent blocks of the same color are removed. Any blocks that have empty ...
• 13
71 views

### AI for 1v1 snake

I've got a task for job application to create a snake AI that can defeat their basic AI. Searching in this topic I've found that it's very similar to Tron and it's solved mostly by minimax algorithm. ...
351 views

### Multiplayer network architecture - why do we need to verify local movements?

I'm messing around with a 2D game using UDP. I've read some books and articles on the logic of a dedicated server to clients multiplayer game and I can't wrap my head around one thing: What I've read:...
1 vote
109 views

### How do I initialise levels sequentially?

I have been learning opengl and I have made good progress over past few months. However I still struggle to understand game logic in C++, I am new to C++ too. Say I have this program. ...
1 vote
247 views

### Should fields in components in an ECS use polymorphism?

I've just started to try and learn how to use ECS (Entity component systems), but I'm having trouble understanding the concepts behind components. Should adding more types of components, or trying to ...
• 59
1 vote
96 views

### Using logic gates for Sprite Collision Detection - humor an old fart please

Im an old coder who came back so to speak, learning Java I know what I want but I cannot find anyone asking it anywhere so here goes... Im writing a basic tank game to code for practice but as is ...
• 11
135 views

### How can I calculate all the tiles visible to a camera in 2D?

I am creating a basic tile-based 2D game ~mostly from scratch in Java, however all I need is pseudo-code for how this could be achieved.  My problem lies in the fact that my world (stored in ...
• 1
121 views

### Way to look up a chain of touching objects (power connections)

I'm having a bit of a logic problem. I have blocks that connect together for power and so when a block comes into contact with a block that is powered, it also becomes powered. It also keeps a list of ...
• 113
55 views

### How to program rules for card game [duplicate]

Hi I want to program a card game, in my game each card can do multiple actions, depend on the situation in which the player is facing. For example There is an "Attack" card which can attack another ...
• 101
2k views

### Should components in Entity Component System pattern have logic?

Is often read that in entity component system pattern we should treat components just as a passive data structure with no logic at all, this way we follow to a data oriented design approach with ...
370 views

### Why does this implementation of aabb-sphere collision ghost collide and how can I fix it

I am trying to make a collision detection system and the aabb-sphere collision isn't working. Here is my code. This method checks to see which whether I should collide with AABB-AABB, Sphere-Sphere, ...
168 views

### How to structure a game that continue even when closed?

I'm developing a Unity based game purely for fun but I'm stuck with a problem. How can I implement a system that keep my game running even when is closed? I don't want to HAVE IT running when it's ...
• 21
17k views

### How can I know if my puzzle game is always possible?

I've made a sort of a puzzle game where the goal is to get rid of all of the white tiles. You can try it at the end of the question. Each time, the board is randomly generated with white tiles in ...
• 743
193 views

### Collison detection trouble. (c++ SDL2)

I have a small trouble with my collsion detection system, ill show it on images. im checking the detection by using that logic with example when moving to the right: ...
1 vote
1k views

### Game logic in mvc: model or controller?

Sorry if the title is too broad, I'll try to explain this in a more specific way down here. We need to create a board-game in Java for an University project and we have to use the mvc pattern for it. ...
• 113
175 views

### Logic only GUI library

I'm not sure whether this place is the correct for asking this. If it's the wrong place I'm sorry, please tell me if so! I'm making a small game for fun which would uses an own engine with OpenGL and ...
715 views

### Unity 5.5 - Modify image of a button from an array of images via script - Logic Help

Right now i have this: Is a placeholder for what i want to do. This blue circles are images in different buttons, i have a blue image circle for every letter. I have to display the correct letter ...
• 109
233 views

### 3d puzzle game generating levels

I want to create a puzzle game for my first year in college. I will use OpeGL and C++. The point of the game is to create a path between squares that have the same color, without making the paths ...
339 views

### Best way to store map?

I am trying to make a simple game that simulates ants inside a colony, in the Java language. They can move around the paths randomly, go outside to eat leaves, etc. The game is meant to be more of an ...
1 vote
93 views

### C++: Strange arithmetic error in adjacent tile checking code

I have a tilesheet from which I draw wall tiles. Each wall tile on the sheet is enumerated from XXXX to ULRD, where each place corresponds to whether there is an adjacent wall above, to the left, to ...
• 135
427 views

### Unity3D, How do I press one key and then cant press another key while the one is pressed?

I am making a horror game, and I want to press a key to look up while I am idle, that i've done but if I press the W key it stands in idle but floating forward. How can I disable the W key while I ...
202 views

### Moving a continue condition into the for loop produced something NOT logically equivalent?

I'm setting up a hex grid. The column/row system I use puts 0, 0 as the top left corner, and increasing columns (x) moves to the right but also vertically upwards. So columns run straight up and down, ...
• 338
1 vote
1k views

### Why is the code in this if statement being run when the condition for it is not met?

I have a feeling I'm overlooking something stupid here... By default all of my enemy objects start without a target assigned to them. As in - "target = noone;" However, despite target being ...
• 19
849 views

I'm currently building a choose your own adventure game. Now it's easy enough to have one outcome to every choice and create a linear flow, but is there a good algorithm for having all previous ...
• 417
1 vote
239 views

### C++ MMO: Best approach to store creatures in a multi-level world map for the purpose to find spectators

I'm developing a game which is a multi-level game, my game can have a maximum of 15 floors, and a fixed amount of tiles width/height. Each tile in the map can have a creature. All fine until here; I ...
2k views

### How to make game like Gals Panic [closed]

Any one have a idea how to build game like Gals Panic. I want to know the basic idea how can i start building the game. Note : im a flash game developer.So anything related to flash would be helpful. ...
130 views

### Optimizing black and white matrix block drawing

Disclaimer: I am uncertain if this is the best place to post this question, so please advise me of how I can best find the answer if I am doing something wrong. I am asking this question because I am ...
• 73
229 views

### How to move 2D objects based on mouse movement with pointer locking?

I'm using pointer locking for a 2D game (where you perform calculations based on the delta in mouse positions from frame to frame). I'm having some basic math/logic issues with accomplishing what I ...
1 vote
117 views

### Programatically placing musical notes on a stave

I'm trying to program a musical stave and have come against the problem of where to place a note, given its index. The index of a note is defined from a model created from the table in the following: ...
• 111
126 views

### Resolving A counters B, who is countered by C, who could be.... in an ATB

There are 4 player character slots and 8 enemy slots. I'm using a combat system that's similar to ATB from FF4; You select a move, there's a waiting period depending upon the move, during which other ...
1k views

### Creating a Roguelike game in C

I'm trying to create a simple rogue-like game in ncurses in a C program. The idea here is that, I'd parse a file like this: ...
• 159
545 views

### Restricting Maximum Velocity in Space

I'm making a top-down 2D space ship game in which you rotate and thrust. I'd like to impose a maximum velocity for different engine types, meaning that a certain engine can only get you going up to a ...
• 157
82 views

### Portal 2 Authoring Tools: func_instance_io_proxy not working?

I have a func_instance (which I made myself) of a door in my map. It is supposed to open when a cube is fizzled. I also put a checkmark indicator to make sure I had the cube's logic correct. When the ...
• 130
349 views

### How to execute game logic every 100ms but render as fast as possible?

I have created a simple snake clone and would like to execute game logic every 100ms while rendering as fast as possible. How can I achieve this when the program might run with very different frame ...
• 224
119 views

### Manager Game Logic [closed]

I'm currently trying to figure out a way where I can achieve the following; Pre-Calculate the game - This will predetermine any event / interaction between the players. Simulate the calculation - ...
• 21
106 views

### How to decide the direction of movement, when navigating a fixed path in a 2d overworld?

Suppose, I have a 2D overworld like in Super Mario Brothers 3, but without junctions or intermediate nodes. Only a single, contiguous path of level nodes, which should be navigated with the arrow keys....
• 132
2k views

### How to handle angles in an isometric game?

I am working on my first isometric game, and I am not sure how to go about angles and rotation. Basically, I want the player's forward movement and rotation to coincide with the isometric angles. I ...
• 33
316 views

### Looking for good comunication schema in turn-based game with multiple players

based coop game that will need to communicate to the server to handle the game process. Basically I need to be able to invite to the game, progress through turns (one player at a time) and finish in ...
• 207
377 views

### How to compare different states of my game? (rpg)

I'm working on a rpg, the battle system. I want to compare different scenario with each other. For example, what if I play move A then move B ? or two times move A ? or ...? I'm using a tree-...
• 51