Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


ncsu121978

Member Since 29 May 2000
Offline Last Active Yesterday, 03:45 PM

Topics I've Started

problem with circular resource movement in strategy game

22 February 2015 - 09:58 AM

problem.jpg

I have a problem.  I am making a game played on a grid (not necessarily the size above).  The orange dot denotes a "resource" producer.  The numbers represent the amount of resource in each cell.  The arrows are the ways that resources move from cell to cell and is selectable by the player to move the resources around the map.  Resources in each cell are capped at 100.

 

The problem is that on each update each cell is checked to see if it has an "arrow" moving out of it to a neighbor cell and if so it will transfer some resources.  It will only do so if it its own resources are at least 2 (since we must retain at least 1 in each cell) and if the neighbor cell is not already maxed out.  Cells are updated in order from bottom left to top right.  In the example in the picture I get a deadlock like situation where no additional resources make it into the system from the producer.  Since the updates take place from bottom left to top right the first one to get an update is the bottom left.  It checks it has more than one, has an arrow going up, the one going to it is not maxed so it transfers one resource reducing itself to 1 and the one above it to 100.  Next update is the bottom right "2" and it does same thing.  The issue that happens is that when it gets to the producer cell the producer cannot transfer a resource right into the connected cell because it was updated to 100 by the cell below it.  And then the next one updated is that new "100" which transfers resources to the cell to its right and falls back down to 99.

 

So what happens is that there in that tight loop those 4 keep passing around 1 resource to each other in a loop and doesnt allow the producer to inject more because its neighbor is at the max (100) when it is the producers turn.

 

yes i have considered updating from top down but it will still be the same problem just with a different corner or orientation of the loop.

 

I have also consider updating all producer cells first then go through the rest but the problem still remains if there is an additional cell between the producer and the loop.  Just image the loop moved one space to the right with an extra normal cell now linking the producer to the loop.

 

I do not want to limit the ability to make loops.  I have considered each arrow to be bi-directional and only allow resource movement to lower resource level cell but this causes all cells to update at same value and doesnt allow "surging" of resources to given areas.

 

How to overcome this prevention of introducing new resources by the producer?


prevention of loops in transfer of [consumable] between game entities

12 November 2014 - 11:34 AM

11huhkn.jpg

Question:  I have energy producers, energy storage, and energy consumers connected together by links as in the picture.  I can have a vast number of these but this is enough to illustrate my issue.  I am trying to work out how exactly to distribute the energy.  The producers will produce at set intervals and has no storage capability.  The storage can take energy from the producers and store it and can also send energy to consumers or other energy storage.  The user just takes energy and produces some action with it.

 

I have thought of two ways to approach it.

 

Method 1 - If the element is a user OR storage, then it will look at each other element it is connected to.  If that other element is a producer or storage then it will attempt to take energy from it  If it is a producer it does nothing in this method (but produce energy at a set rate and will then have it available to be taken).

 

Method 2 - If the element is a producer OR storage, then it will look at each other element it is connected to.  If that other element is a user or storage then it will attempt to give it energy.  The user does nothing but when it detect it now has energy it will do something with it.

 

So it is a choice between a push and a pull.  The problem lies between the two storage connected to each other.  In either method they take away from each other with a net transfer of 0.  And I dont think I can just do a detect that if I am a storage and the other is a storage then don't transfer anything.  That wouldnt work if the link between the left storage and the producer didnt exist because then further down the chain that left storage and the end user would never get energy from the right storage if I didnt allow storage to storage transfer.

 

Gets more complicated if say there were 3 storage connected in a triangle linkage with one of them connected to a producer.

 

So any ideas on how to do the energy transfer without getting it stuck in a loop?


movement as in Steam Birds

24 October 2014 - 12:07 PM

I am working on a game that I want to have movement similar to what Steam Birds use if you are familiar with that game.  If you are familiar with it you can skip the next little description for the uninitiated.
 
The game will start off paused.  You are able to select the direction you want your plane to move (and what "special powers" you want to use during the next turn but that isnt important to my question).  Once you have selected your movement then you click a "Go Button" and your movement and actions are carried out in 4-6 seconds of play where you have no input.  The game will then pause again and wait for your input....wash rinse repeat.
 
I would like to implement the movement selection in my game.  Your ability to move is restricted by your current speed and direction meaning you cant instantaneously move the opposite direction you were just moving last turn.
 
Below is a picture of a path selected for a plane in that game
 
How would I go about allowing this path selection?

NVIDIA OpenGL driver issue?

05 April 2013 - 07:33 AM

I am beginning to wonder if there is an issue with the OpenGL drivers from Nvidia on Windows 7. I do my normal programming on my laptop with a GTX 560M graphics card. I do have an external monitor plugged into my laptop and utilize both screens as an extended display setup. But the problem persists even when not using the external monitor.

I coded up a super simple program in C# using SFML2.NET with Visual Studio 2012. All it does is create a RenderWindow and move a RectangleShape across the screen and when it gets to the far right then moves it back to the left to repeat. If I run this in fullscreen mode then I have no issues. When I run this in windowed mode I get a strange graphical glitches. About 2-3 times per second (about every 20 or so frames since I run at 60FPS with vsync) then my image for a brief moment jumps backwards as if it were drawn where it was 10-15 frames ago, and then immediately jumps back to where it is supposed to be. Its as if for one frame, it is still drawing a frame from 15 frames ago instead of the current one.

I recreated the same exact program but in C++ with SFML2 using Visual Studio 2012 and has the same results. It is OK in fullscreen but has the issue in windowed mode.

I then recreated the same program in C++ except utilizing DirectX and there is no problems in Windowed mode or fullscreen.

I then recreated the same program in C++ with SFML2 on Ubuntu using the gcc compiler and Code::Blocks. It has no issue in windowed or fullscreen.

So it seems to me there is some kind of OpenGL driver issue on Nvidia in Windows 7. It could just be a bug in the Windows version of SFML2 before it even makes the call to OpenGL. I am going to code just straight to OpenGL instead of going through SFML to see if the problem still repeats itself.

I know this isnt any kind of physics or math issue on my part for the positioning as all I do each frame is do a +2 to the rectangle shapes x position every frame for this test.

Also put a breakpoint in to a conditional statement that if the x position is ever smaller than it was the last frame then it would hit the breakpoint and I could see it. I did make the exception that the breakpoint wouldnt trigger if it is when i manually set the x position to 0 while doing the screen wrap. This would let me detect if something was screwy with the simple math but it never hits the breakpoint saying that the x position is smaller than it was the last frame.

Anyone else have issues like this?

[Edit]Appologies for the formatting of this text. My work computer doesnt display this website correctly and isnt letting me put breaks in the text

recommendations for multiplayer roguelike battle system

09 October 2012 - 06:21 AM

I want to see what people would think is a good system to handle a multiplayer roguelike. Specifically the aspects of movement and battle. Here are a few options I came up with

1 – Allow player movement on the map as fast as they can mash the key to move (at least as fast as the server recognizes). The mobs on the map will move every update of 1 second (configurable). The mobs on the map will be like in Ultima 3 for the NES. If you and a mob occupy the same tile, then it will start an instanced battle that is completely turn-based like a normal roguelike. You will be put onto a battle map and will fight the mob/other player there. That way back on the normal map, other players can keep moving and the map mobs will keep moving/updating at its one second interval. Other players will see you on the map, but with some type of icon denoting the fact you are in an instanced battle.

2 – Allow player movement on the map as fast as they can mash the key to move. The mobs on the map will move every update of 1 second (configurable). However, battles are NOT instanced. If you agro a mob (or other player) or in some way become hostile (engage in combat) with a mob or other player, then you then step into an update pattern of say 1 updated every 2 seconds (configurable). Where you and the hostile mobs (players) select an action that will be performed on every update tick. If you didn’t select an action in time, then you don’t do anything that tick (or maybe an auto action such as auto-attack). Other players/mobs who are not involved in the battle (aggroed or hostile to you), then they keep moving as though nothing is going on. They can see you in battle on the map, but aren’t restricted to the update per tick because they haven’t aggroed or become hostile. Players keep moving as fast as they can mash the button, and other map mobs move at 1 update per second tick.

3 – Recommend to me something else.

PARTNERS