Jump to content
  • Advertisement
    1. Past hour
    2. Hi Fleabay, I understand what you're talking about now, it makes sense now. Thanks. This not only applies to this interview but others as well.
    3. Today
    4. Julie.chan

      Options/Advice for Selling Mod on Open-Source Game?

      I haven't tried it, but I think that already exists: https://colobot.info/ It seems to just be single-player, but adding multi-player to Colobot might be easier than making a whole new programming RTS. In the case of a multiplayer game, you can make money by hosting a server and charging for access to it. Yeah, that sounds like a nice idea. Actually, I wish more people would do this kind of thing. You'd just need to modify the game so you can run a premium server of sorts. Just one modification/clarification: anyone who receives a copy of a program under the GPL has to be given access to the corresponding source code, so while you don't need to advertise it, you still need to include either the source code or access to the source code for everyone who gets a copy of the binary from you (I usually just give everyone source code directly because that's simpler, but it depends how big the source tree is I figure). And one little suggestion/idea: make it so that people who haven't paid for access can still watch games on your server. That can help entice them to want access.
    5. Rutin

      A Low requeriments Engine?

      Then I would suggest you look into LITIengine -> https://litiengine.com/ If you actually want to program your own stuff using a framework then you do have options like: libGDX -> https://libgdx.badlogicgames.com/ Let me know if you still need some suggestions.
    6. CosmosDevelopment

      A Low requeriments Engine?

      System -Windows 10 Graphics Card - Intel(R) HD Graphics I Have Experience Programing In Java Also I Want to Export My Game To Nintendo Switch 💜
    7. invent71

      IRIDIUM Demo and Kickstarter

      Hi GameDevs, We have been busy working on a new Retro Shoot em up called "IRIDIUM", A frantic new 2D shoot 'em up with huge levels and truly massive enemy ships. Mixing game styles from Uridium, Xenon 2 and Nemesis. We do have a demo to play for PC https://nebula-design.itch.io/iridium If you love shootemups as much as us, please let us know your thoughts. Some example images below We'd love to get this on NintendoSwitch if we can reach our goal.
    8. duke_meister

      Mostly done

      using System; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace ConsoleSnake { /// <summary> /// All code written by duke_meister (Valentino Rossi) /// except keyboard reading technique /// </summary> class Program { // our unchanging values: // playfield height & width const int PlayfieldWidth = 80; const int PlayfieldHeight = 40; // game pieces const string EmptyCell = " "; const string SnakeHeadCell = "@"; const string SnakeBodyCell = "o"; const string FoodCell = "."; // timeout to adjust speed of snake static int MillisecondsTimeout = 50; // our playfield; stores FieldVals instead of ints so we don't have to remember them static readonly FieldVals[,] PlayField = new FieldVals[PlayfieldWidth, PlayfieldHeight]; // not yet used until we increase length of snake static int _snakeBodyLen = 4; // not including head // which direction (SnakdDirs enum) the snake is currently moving static SnakeDirs _snakeDir; // position of the one-and-only piece of food; use our own coordinate class, Pos static readonly Pos FoodPos = new Pos(0, 0); static readonly Pos EraserPos = new Pos(0, 0); // defines the snake; each element tells us which coordinates each snake piece is at static int _maxSnakeLen = 20; static Pos[] _snakeCells = new Pos[_maxSnakeLen]; // guess static int _score = 0; // for randomizing things like food placement static Random _rnd; // how many body pieces the snake will increase by when it eats food static int SnakeSizeIncrease = 2; // could've used something existing, but made a simple screen coordinate class public class Pos { public int X { get; set; } public int Y { get; set; } public Pos(int x, int y) { X = x; Y = y; } } // these make it easy (for the human) to know what each cell contains enum FieldVals { DontDraw, Empty, SnakeHead, SnakeBody, SnakeFood } // these make it easy (for the human) to read snake the direction enum SnakeDirs { Up, Right, Down, Left } static void Main(string[] args) { _rnd = new Random(); Console.Clear(); // create the initial snake cell coords (place it on playfield) SetUpSnake(); // start with an initial piece of food MakeNewFood(); // draw the border, once DrawBorder(); // game loop; this was the easiest but might switch to Timer, etc. // function names should explain purpose for (;/* ever */;) { AdjustGameSpeed(); CheckForKeyboardCommand(); UpdatePlayfield(); CheckForSnakeOutOfBounds(); CheckForSnakeCollisionWithSelf(); UpdateSnakeBodyPosition(); CheckSnakeHasEatenFood(); } } private static void CheckForSnakeCollisionWithSelf() { if( _snakeCells.Skip(1).Any(pos => pos.X == _snakeCells.First().X && pos.Y == _snakeCells.First().Y)) { EndGame(false); } } /// <summary> /// Work out the initial coordinates of the snake's body parts /// </summary> private static void SetUpSnake() { // create the empty snake array cells for (var i = 0; i < _snakeCells.Length; i++) { _snakeCells[i] = new Pos(0, 0); } // randomly choose snake's initial direction _snakeDir = (SnakeDirs)_rnd.Next((int)SnakeDirs.Up, (int)SnakeDirs.Left + 1); int[] xOffsets = { 0, _snakeBodyLen * -1, 0, _snakeBodyLen}; int[] yOffsets = { _snakeBodyLen, 0, _snakeBodyLen * -1, 0}; int xOffset = xOffsets[(int) _snakeDir]; int yOffset = yOffsets[(int) _snakeDir]; // First randomly choose the position of the snake's head // We'll work out the rest of the snake body coords based on which // direction it's initially facing. _snakeCells.First().X = _rnd.Next( xOffset * _snakeBodyLen * -1, PlayfieldWidth + xOffset * _snakeBodyLen + 1); _snakeCells.First().Y = _rnd.Next( yOffset * _snakeBodyLen * -1, PlayfieldHeight + yOffset * _snakeBodyLen + 1); switch (_snakeDir) { case SnakeDirs.Up: // make the snake's body go below the head, as it's moving up for (int i = 1; i < _snakeBodyLen; i++) { _snakeCells[i].X = _snakeCells.First().X; _snakeCells[i].Y = _snakeCells[i - 1].Y + 1; } break; case SnakeDirs.Right: // make the snake's body go left of the head, as it's moving right for (int i = 1; i < _snakeBodyLen; i++) { _snakeCells[i].X = _snakeCells.First().X - 1; _snakeCells[i].Y = _snakeCells.First().Y; } break; case SnakeDirs.Down: // make the snake's body go above of the head, as it's moving down for (int i = 1; i < _snakeBodyLen; i++) { _snakeCells[i].X = _snakeCells.First().X; _snakeCells[i].Y = _snakeCells[i - 1].Y - 1; } break; case SnakeDirs.Left: // make the snake's body go right of the head, as it's moving left for (int i = 1; i < _snakeBodyLen; i++) { _snakeCells[i].X = _snakeCells.First().X + 1; _snakeCells[i].Y = _snakeCells.First().Y; } break; } } private static void AdjustGameSpeed() { // delay so the game isn't too fast. Halve the delay (to go faster) when going left or right // as it appears that going up/down is faster Task.Delay( _snakeDir == SnakeDirs.Up || _snakeDir == SnakeDirs.Right ? MillisecondsTimeout / 2 : MillisecondsTimeout).Wait(); } /// <summary> /// Check the keyboard for arrow keys /// I got the code off the net (see bottom of code); no point re-creating this /// </summary> private static void CheckForKeyboardCommand() { if (NativeKeyboard.IsKeyDown(KeyCode.Down)) // player hit Down arrow { // can't hit down while going up; game over if (_snakeDir == SnakeDirs.Up) EndGame(false); // change snake direction to down _snakeDir = SnakeDirs.Down; } else if (NativeKeyboard.IsKeyDown(KeyCode.Up)) { // can't hit up while going down; game over if (_snakeDir == SnakeDirs.Down) EndGame(false); // change snake direction to up _snakeDir = SnakeDirs.Up; } else if (NativeKeyboard.IsKeyDown(KeyCode.Left)) { // can't hit left while going right; game over if (_snakeDir == SnakeDirs.Right) EndGame(false); // change snake direction to left _snakeDir = SnakeDirs.Left; } else if (NativeKeyboard.IsKeyDown(KeyCode.Right)) { // can't hit right while going left; game over if (_snakeDir == SnakeDirs.Left) EndGame(false); // change snake direction to right _snakeDir = SnakeDirs.Right; } } /// <summary> /// See if snake has eaten the food /// </summary> private static void CheckSnakeHasEatenFood() { // if snake head is in the same x,y position as the food // NB: First() is a Linq function; it gives me the first element in the array if (_snakeCells.First().X == FoodPos.X && _snakeCells.First().Y == FoodPos.Y) { IncrementScore(); MakeNewFood(); IncreaseSnakeSize(); } } private static void IncreaseSnakeSize() { if (_snakeBodyLen + SnakeSizeIncrease < _maxSnakeLen) { _snakeBodyLen += SnakeSizeIncrease; UpdateScore(); } } private static void UpdateScore() { WriteAt($"Score: {_score} Snake Size: {_snakeBodyLen}", 0, 0); } private static void IncrementScore() { ++_score; UpdateScore(); } /// <summary> /// Put food item at random location /// </summary> private static void MakeNewFood() { int x, y; do { // this ensures we're not putting the food on top of the snake, or the border x = _rnd.Next(1, PlayfieldWidth - 1); y = _rnd.Next(1, PlayfieldHeight - 1); } while (_snakeCells.Any(pos => pos.X == x || pos.Y == y)); // set the food coords FoodPos.X = x; FoodPos.Y = y; // update the playfield position with the food value PlayField[FoodPos.X, FoodPos.Y] = FieldVals.SnakeFood; } static void CheckForSnakeOutOfBounds() { // snake mustn't be on any border cell, or game over if (_snakeCells.First().Y < 1 || _snakeCells.First().X > PlayfieldWidth - 2 ||_snakeCells.First().Y > PlayfieldHeight - 2 || _snakeCells.First().X < 1) { EndGame(false); } } /// <summary> /// Move the snake pieces appropriately. I just did the simplest thing that I thought of. /// </summary> static void UpdateSnakeBodyPosition() { // remember the position of the snake's last piece so that later, // after drawing the snake, we can set it to the 'don't draw' value EraserPos.X = _snakeCells[_snakeBodyLen].X; EraserPos.Y = _snakeCells[_snakeBodyLen].Y; // Last piece of snake's tail will always become empty as the snake moves // NB: Last() is a Linq function; it gives me the last element in the array (end of snake tail) PlayField[_snakeCells[_snakeBodyLen].X, _snakeCells[_snakeBodyLen].Y] = FieldVals.Empty; // move the 'middle' section of the snake one cell along for (int i = _snakeCells.Length - 1; i > 0; i--) { _snakeCells[i].X = _snakeCells[i - 1].X; _snakeCells[i].Y = _snakeCells[i - 1].Y; } // move the snake's head, depending on direction moving // the body was already moved above switch (_snakeDir) { case SnakeDirs.Up: // moved the snake head up 1 (-ve Y direction) --_snakeCells.First().Y; break; case SnakeDirs.Right: // moved the snake head right 1 (+ve X direction) ++_snakeCells.First().X; break; case SnakeDirs.Down: // moved the snake head up 1 (+ve Y direction) ++_snakeCells.First().Y; break; case SnakeDirs.Left: // moved the snake head left 1 (-ve X direction) --_snakeCells.First().X; break; } // Set the playfield position at the head of the snake, to be... the snake head! PlayField[_snakeCells.First().X, _snakeCells.First().Y] = FieldVals.SnakeHead; // Set the positions on the playfield for the snake body cells // so we know to draw them // NB: Skip(1).Take(4) is Linq; it gives me the array left after // skipping the first item, then grabbing the next 4 (so in this // case misses the first and last). foreach (var cell in _snakeCells.Skip(1).Take(4)) { PlayField[cell.X, cell.Y] = FieldVals.SnakeBody; } } /// <summary> /// Just show a message and exit (can only lose right now) /// </summary> /// <param name="win"></param> static void EndGame(bool win) { Console.Clear(); Console.WriteLine($"YOU DIED. Score: {_score} Snake Length: {_snakeBodyLen}"); Console.ReadKey(); Console.ReadKey(); Environment.Exit(0); } /// <summary> /// Set the console size appropriately & draw the border, leaving room for the score /// </summary> static void DrawBorder() { Console.SetWindowSize(PlayfieldWidth, PlayfieldHeight + 2); WriteAt("╔", 0, 1); WriteAt("╗", PlayfieldWidth - 1, 1); WriteAt("╚", 0, PlayfieldHeight); WriteAt("╝", PlayfieldWidth - 1, PlayfieldHeight); for (var i = 1; i < PlayfieldWidth - 1; i++) { WriteAt("═", i, 1); WriteAt("═", i, PlayfieldHeight); } for (var i = 2; i < PlayfieldHeight; i++) { WriteAt("║", 0, i); WriteAt("║", PlayfieldWidth - 1, i); } } /// <summary> /// Go through every element of the 2d array, only drawing a cell /// if it has a value (other than 0). This way we only draw the /// cells that need to be updated. A bit like Invalidate() in GDO. /// Pretty self-explanatory; if a cell has a value, draw the character /// appropriate for it. The space is only used to overwrite the last /// piece of the snake's tail. /// </summary> static void UpdatePlayfield() { var cellsDrawn = 0; for (var i = 1; i < PlayfieldWidth - 1; i++) { for (var j = 1; j < PlayfieldHeight - 1; j++) { switch (PlayField[i, j]) { case FieldVals.Empty: WriteAt( EmptyCell, i, j + 1); break; case FieldVals.SnakeHead: WriteAt(SnakeHeadCell, i, j + 1); break; case FieldVals.SnakeBody: WriteAt(SnakeBodyCell, i, j + 1); break; case FieldVals.SnakeFood: WriteAt(FoodCell, i, j + 1); PlayField[FoodPos.X, FoodPos.Y] = FieldVals.DontDraw; break; } ++cellsDrawn; } } Debug.Assert( cellsDrawn <= _snakeBodyLen + 3); // Debug.WriteLine($"Cells drawn: {cellsDrawn}"); PlayField[EraserPos.X, EraserPos.Y] = FieldVals.DontDraw; } // From Microsoft sample protected static void WriteAt(string s, int x, int y) { try { Console.SetCursorPosition(x, y); Console.Write(s); } catch (ArgumentOutOfRangeException e) { Console.Clear(); Console.WriteLine(e.Message); } } } /// <summary> /// Codes representing keyboard keys. /// </summary> /// <remarks> /// Key code documentation: /// http://msdn.microsoft.com/en-us/library/dd375731%28v=VS.85%29.aspx /// </remarks> internal enum KeyCode { Left = 0x25, Up, Right, Down } /// <summary> /// Provides keyboard access. /// </summary> internal static class NativeKeyboard { /// <summary> /// A positional bit flag indicating the part of a key state denoting /// key pressed. /// </summary> const int KeyPressed = 0x8000; /// <summary> /// Returns a value indicating if a given key is pressed. /// </summary> /// <param name="key">The key to check.</param> /// <returns> /// <c>true</c> if the key is pressed, otherwise <c>false</c>. /// </returns> public static bool IsKeyDown(KeyCode key) { return (GetKeyState((int)key) & KeyPressed) != 0; } /// <summary> /// Gets the key state of a key. /// </summary> /// <param name="key">Virtual-key code for key.</param> /// <returns>The state of the key.</returns> [System.Runtime.InteropServices.DllImport("user32.dll")] static extern short GetKeyState(int key); } } Can't seem to put text above the code. Anyway, this is playable except you sometimes die immediately. Need to tweak the snake placement code. Metro Exodus has downloaded, so off to play that Have fun
    9. duke_meister

      First instalment

      Ok this is basically complete, except sometimes you die immediately. Need to tweak the snake initial position code. (BTW why does this site absolutely kill my browser...) Have fun. using System; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace ConsoleSnake { /// <summary> /// All code written by duke_meister (Valentino Rossi) /// except keyboard reading technique /// </summary> class Program { // our unchanging values: // playfield height & width const int PlayfieldWidth = 80; const int PlayfieldHeight = 40; // game pieces const string EmptyCell = " "; const string SnakeHeadCell = "@"; const string SnakeBodyCell = "o"; const string FoodCell = "."; // timeout to adjust speed of snake static int MillisecondsTimeout = 50; // our playfield; stores FieldVals instead of ints so we don't have to remember them static readonly FieldVals[,] PlayField = new FieldVals[PlayfieldWidth, PlayfieldHeight]; // not yet used until we increase length of snake static int _snakeBodyLen = 4; // not including head // which direction (SnakdDirs enum) the snake is currently moving static SnakeDirs _snakeDir; // position of the one-and-only piece of food; use our own coordinate class, Pos static readonly Pos FoodPos = new Pos(0, 0); static readonly Pos EraserPos = new Pos(0, 0); // defines the snake; each element tells us which coordinates each snake piece is at static int _maxSnakeLen = 20; static Pos[] _snakeCells = new Pos[_maxSnakeLen]; // guess static int _score = 0; // for randomizing things like food placement static Random _rnd; // how many body pieces the snake will increase by when it eats food static int SnakeSizeIncrease = 2; // could've used something existing, but made a simple screen coordinate class public class Pos { public int X { get; set; } public int Y { get; set; } public Pos(int x, int y) { X = x; Y = y; } } // these make it easy (for the human) to know what each cell contains enum FieldVals { DontDraw, Empty, SnakeHead, SnakeBody, SnakeFood } // these make it easy (for the human) to read snake the direction enum SnakeDirs { Up, Right, Down, Left } static void Main(string[] args) { _rnd = new Random(); Console.Clear(); // create the initial snake cell coords (place it on playfield) SetUpSnake(); // start with an initial piece of food MakeNewFood(); // draw the border, once DrawBorder(); // game loop; this was the easiest but might switch to Timer, etc. // function names should explain purpose for (;/* ever */;) { AdjustGameSpeed(); CheckForKeyboardCommand(); UpdatePlayfield(); CheckForSnakeOutOfBounds(); CheckForSnakeCollisionWithSelf(); UpdateSnakeBodyPosition(); CheckSnakeHasEatenFood(); } } private static void CheckForSnakeCollisionWithSelf() { if( _snakeCells.Skip(1).Any(pos => pos.X == _snakeCells.First().X && pos.Y == _snakeCells.First().Y)) { EndGame(false); } } /// <summary> /// Work out the initial coordinates of the snake's body parts /// </summary> private static void SetUpSnake() { // create the empty snake array cells for (var i = 0; i < _snakeCells.Length; i++) { _snakeCells[i] = new Pos(0, 0); } // randomly choose snake's initial direction _snakeDir = (SnakeDirs)_rnd.Next((int)SnakeDirs.Up, (int)SnakeDirs.Left + 1); int[] xOffsets = { 0, _snakeBodyLen * -1, 0, _snakeBodyLen}; int[] yOffsets = { _snakeBodyLen, 0, _snakeBodyLen * -1, 0}; int xOffset = xOffsets[(int) _snakeDir]; int yOffset = yOffsets[(int) _snakeDir]; // First randomly choose the position of the snake's head // We'll work out the rest of the snake body coords based on which // direction it's initially facing. _snakeCells.First().X = _rnd.Next( xOffset * _snakeBodyLen * -1, PlayfieldWidth + xOffset * _snakeBodyLen + 1); _snakeCells.First().Y = _rnd.Next( yOffset * _snakeBodyLen * -1, PlayfieldHeight + yOffset * _snakeBodyLen + 1); switch (_snakeDir) { case SnakeDirs.Up: // make the snake's body go below the head, as it's moving up for (int i = 1; i < _snakeBodyLen; i++) { _snakeCells[i].X = _snakeCells.First().X; _snakeCells[i].Y = _snakeCells[i - 1].Y + 1; } break; case SnakeDirs.Right: // make the snake's body go left of the head, as it's moving right for (int i = 1; i < _snakeBodyLen; i++) { _snakeCells[i].X = _snakeCells.First().X - 1; _snakeCells[i].Y = _snakeCells.First().Y; } break; case SnakeDirs.Down: // make the snake's body go above of the head, as it's moving down for (int i = 1; i < _snakeBodyLen; i++) { _snakeCells[i].X = _snakeCells.First().X; _snakeCells[i].Y = _snakeCells[i - 1].Y - 1; } break; case SnakeDirs.Left: // make the snake's body go right of the head, as it's moving left for (int i = 1; i < _snakeBodyLen; i++) { _snakeCells[i].X = _snakeCells.First().X + 1; _snakeCells[i].Y = _snakeCells.First().Y; } break; } } private static void AdjustGameSpeed() { // delay so the game isn't too fast. Halve the delay (to go faster) when going left or right // as it appears that going up/down is faster Task.Delay( _snakeDir == SnakeDirs.Up || _snakeDir == SnakeDirs.Right ? MillisecondsTimeout / 2 : MillisecondsTimeout).Wait(); } /// <summary> /// Check the keyboard for arrow keys /// I got the code off the net (see bottom of code); no point re-creating this /// </summary> private static void CheckForKeyboardCommand() { if (NativeKeyboard.IsKeyDown(KeyCode.Down)) // player hit Down arrow { // can't hit down while going up; game over if (_snakeDir == SnakeDirs.Up) EndGame(false); // change snake direction to down _snakeDir = SnakeDirs.Down; } else if (NativeKeyboard.IsKeyDown(KeyCode.Up)) { // can't hit up while going down; game over if (_snakeDir == SnakeDirs.Down) EndGame(false); // change snake direction to up _snakeDir = SnakeDirs.Up; } else if (NativeKeyboard.IsKeyDown(KeyCode.Left)) { // can't hit left while going right; game over if (_snakeDir == SnakeDirs.Right) EndGame(false); // change snake direction to left _snakeDir = SnakeDirs.Left; } else if (NativeKeyboard.IsKeyDown(KeyCode.Right)) { // can't hit right while going left; game over if (_snakeDir == SnakeDirs.Left) EndGame(false); // change snake direction to right _snakeDir = SnakeDirs.Right; } } /// <summary> /// See if snake has eaten the food /// </summary> private static void CheckSnakeHasEatenFood() { // if snake head is in the same x,y position as the food // NB: First() is a Linq function; it gives me the first element in the array if (_snakeCells.First().X == FoodPos.X && _snakeCells.First().Y == FoodPos.Y) { IncrementScore(); MakeNewFood(); IncreaseSnakeSize(); } } private static void IncreaseSnakeSize() { if (_snakeBodyLen + SnakeSizeIncrease < _maxSnakeLen) { _snakeBodyLen += SnakeSizeIncrease; UpdateScore(); } } private static void UpdateScore() { WriteAt($"Score: {_score} Snake Size: {_snakeBodyLen}", 0, 0); } private static void IncrementScore() { ++_score; UpdateScore(); } /// <summary> /// Put food item at random location /// </summary> private static void MakeNewFood() { int x, y; do { // this ensures we're not putting the food on top of the snake, or the border x = _rnd.Next(1, PlayfieldWidth - 1); y = _rnd.Next(1, PlayfieldHeight - 1); } while (_snakeCells.Any(pos => pos.X == x || pos.Y == y)); // set the food coords FoodPos.X = x; FoodPos.Y = y; // update the playfield position with the food value PlayField[FoodPos.X, FoodPos.Y] = FieldVals.SnakeFood; } static void CheckForSnakeOutOfBounds() { // snake mustn't be on any border cell, or game over if (_snakeCells.First().Y < 1 || _snakeCells.First().X > PlayfieldWidth - 2 ||_snakeCells.First().Y > PlayfieldHeight - 2 || _snakeCells.First().X < 1) { EndGame(false); } } /// <summary> /// Move the snake pieces appropriately. I just did the simplest thing that I thought of. /// </summary> static void UpdateSnakeBodyPosition() { // remember the position of the snake's last piece so that later, // after drawing the snake, we can set it to the 'don't draw' value EraserPos.X = _snakeCells[_snakeBodyLen].X; EraserPos.Y = _snakeCells[_snakeBodyLen].Y; // Last piece of snake's tail will always become empty as the snake moves // NB: Last() is a Linq function; it gives me the last element in the array (end of snake tail) PlayField[_snakeCells[_snakeBodyLen].X, _snakeCells[_snakeBodyLen].Y] = FieldVals.Empty; // move the 'middle' section of the snake one cell along for (int i = _snakeCells.Length - 1; i > 0; i--) { _snakeCells[i].X = _snakeCells[i - 1].X; _snakeCells[i].Y = _snakeCells[i - 1].Y; } // move the snake's head, depending on direction moving // the body was already moved above switch (_snakeDir) { case SnakeDirs.Up: // moved the snake head up 1 (-ve Y direction) --_snakeCells.First().Y; break; case SnakeDirs.Right: // moved the snake head right 1 (+ve X direction) ++_snakeCells.First().X; break; case SnakeDirs.Down: // moved the snake head up 1 (+ve Y direction) ++_snakeCells.First().Y; break; case SnakeDirs.Left: // moved the snake head left 1 (-ve X direction) --_snakeCells.First().X; break; } // Set the playfield position at the head of the snake, to be... the snake head! PlayField[_snakeCells.First().X, _snakeCells.First().Y] = FieldVals.SnakeHead; // Set the positions on the playfield for the snake body cells // so we know to draw them // NB: Skip(1).Take(4) is Linq; it gives me the array left after // skipping the first item, then grabbing the next 4 (so in this // case misses the first and last). foreach (var cell in _snakeCells.Skip(1).Take(4)) { PlayField[cell.X, cell.Y] = FieldVals.SnakeBody; } } /// <summary> /// Just show a message and exit (can only lose right now) /// </summary> /// <param name="win"></param> static void EndGame(bool win) { Console.Clear(); Console.WriteLine($"YOU DIED. Score: {_score} Snake Length: {_snakeBodyLen}"); Console.ReadKey(); Console.ReadKey(); Environment.Exit(0); } /// <summary> /// Set the console size appropriately & draw the border, leaving room for the score /// </summary> static void DrawBorder() { Console.SetWindowSize(PlayfieldWidth, PlayfieldHeight + 2); WriteAt("╔", 0, 1); WriteAt("╗", PlayfieldWidth - 1, 1); WriteAt("╚", 0, PlayfieldHeight); WriteAt("╝", PlayfieldWidth - 1, PlayfieldHeight); for (var i = 1; i < PlayfieldWidth - 1; i++) { WriteAt("═", i, 1); WriteAt("═", i, PlayfieldHeight); } for (var i = 2; i < PlayfieldHeight; i++) { WriteAt("║", 0, i); WriteAt("║", PlayfieldWidth - 1, i); } } /// <summary> /// Go through every element of the 2d array, only drawing a cell /// if it has a value (other than 0). This way we only draw the /// cells that need to be updated. A bit like Invalidate() in GDO. /// Pretty self-explanatory; if a cell has a value, draw the character /// appropriate for it. The space is only used to overwrite the last /// piece of the snake's tail. /// </summary> static void UpdatePlayfield() { var cellsDrawn = 0; for (var i = 1; i < PlayfieldWidth - 1; i++) { for (var j = 1; j < PlayfieldHeight - 1; j++) { switch (PlayField[i, j]) { case FieldVals.Empty: WriteAt( EmptyCell, i, j + 1); ++cellsDrawn; break; case FieldVals.SnakeHead: WriteAt(SnakeHeadCell, i, j + 1); ++cellsDrawn; break; case FieldVals.SnakeBody: WriteAt(SnakeBodyCell, i, j + 1); ++cellsDrawn; break; case FieldVals.SnakeFood: WriteAt(FoodCell, i, j + 1); PlayField[FoodPos.X, FoodPos.Y] = FieldVals.DontDraw; ++cellsDrawn; break; } } } Debug.Assert( cellsDrawn <= _snakeBodyLen + 3); // Debug.WriteLine($"Cells drawn: {cellsDrawn}"); PlayField[EraserPos.X, EraserPos.Y] = FieldVals.DontDraw; } // From Microsoft sample protected static void WriteAt(string s, int x, int y) { try { Console.SetCursorPosition(x, y); Console.Write(s); } catch (ArgumentOutOfRangeException e) { Console.Clear(); Console.WriteLine(e.Message); } } } /// <summary> /// Codes representing keyboard keys. /// </summary> /// <remarks> /// Key code documentation: /// http://msdn.microsoft.com/en-us/library/dd375731%28v=VS.85%29.aspx /// </remarks> internal enum KeyCode { Left = 0x25, Up, Right, Down } /// <summary> /// Provides keyboard access. /// </summary> internal static class NativeKeyboard { /// <summary> /// A positional bit flag indicating the part of a key state denoting /// key pressed. /// </summary> const int KeyPressed = 0x8000; /// <summary> /// Returns a value indicating if a given key is pressed. /// </summary> /// <param name="key">The key to check.</param> /// <returns> /// <c>true</c> if the key is pressed, otherwise <c>false</c>. /// </returns> public static bool IsKeyDown(KeyCode key) { return (GetKeyState((int)key) & KeyPressed) != 0; } /// <summary> /// Gets the key state of a key. /// </summary> /// <param name="key">Virtual-key code for key.</param> /// <returns>The state of the key.</returns> [System.Runtime.InteropServices.DllImport("user32.dll")] static extern short GetKeyState(int key); } }
    10. jbarrios

      Where are we now (DEMO)

      Hey badramgad, I had to a chance to play your demo and I recorded it: https://www.youtube.com/watch?v=fffgK5pGbrc&feature=youtu.be - I like the mystery that is set up of who the player character is and what's going on with the world - I like the music - The writing is good - My laptop didn't like holding the inventory key and using the mouse at the same time. I would have rather had the inventory be a toggle - I had a hard time selecting items, but that may have been my strange laptop. - I wasn't able to solve the TV puzzle. - When I walked into the edge of the island I got a jumpy collision effect. Overall I like it. I would have liked to keep playing, but I got stuck. Probably because I'm dumb. I'm excited to see how this turns out.
    11. Wysardry

      A Low requeriments Engine?

      AppGameKit should run okay on your system.
    12. Rutin

      A Low requeriments Engine?

      What operating system are you using? What graphics card do you have? Do you have any programming experience? If not are you willing to learn to code?
    13. invent71

      IRIDIUM

      Album for IRIDIUM
    14. phil67rpg

      c# console snake game

      well I am making a graphics c# program. can you give me just a hint as how to make the snake smooth animation.
    15. Touchmybow

      How to avoid open-world grind?

      I heartily disagree, as with this method you eliminate the need for the player to think for himself because you provide everything he needs on his way to the main goal. You want the player to use his wits and knowledge of the game and seek out what he wants to gather. And secondly, it's also a form of player choice. Should I get X or Y? And how much should I get? Third, the activity itself loses its identity since it just becomes part of the conglomerate of the main path. I can't know if its the realism that makes it feel grindy, but anyone can tell you that some realism kills fun factor. What I can tell you is if it does feel grindy, its because the activity (or activies) is no longer producing a positive experience. You need to add meaning to the activity or clean up the activity itself so that it flows pleasantly. You can add meaning in several ways. Make the player feel like he's partaking in a cool, interesting activity. That's the role playing aspect of the activity; make the context interesting and engaging. Another way to add meaning to the activity is to tweak the rewards of the activity, which is the bigger context, such as the gains in stats, the material rewards, the progression towards completing the game, and any other type of progression. I may be missing some forms of meaning, but this is just what I can think of atm. The point is that if the player is enjoying the activity, it won't feel like a grind because he won't be thinking about it as work, but as play. The other thing I mentioned was cleaning up the activity so that its a pleasant activity without hick ups, annoyances, or tedious snags that bring down the level of enjoyment, which leads to the feeling of grind. So grind isn't just repetition. It's work without play, which is found in repetition, yes, but repetition can be enjoyable and not feel like a grind. Finally, you mentioned the open world, nonlinear progression as possibly a problem making the game into a grind, but its not clear to me how so and you'd need to elaborate. My only guess is you're afraid you're overwhelming the player with too many activities and giving him a lack of a feeling of completion? I don't know what you're asking.
    16. Hello, I have an idea for a game: It would be just like a traditional Real-Time Strategy game, but with a twist: the user is given the ability to write AI for their units. There would be a a development mode of the game where you could access basic unit functionality (like move here, move there, attack, etc.), and basic information (like type and position of enemy units you have detected), and write your own AI. I think this would be really cool , both for people who already know how to code, and for people just starting to learn. It occurs to me that it would be waaaay easier for me to modify an existing open source game to add this functionality than it would be for me to write my own RTS game from stratch. Like probably the difference between me being able to do it and not (I am doing this on the side of my day job). However, I think it would be cool to at least try to make money from this game. So I was looking into licensing, and it looks like almost all open source games are released under the GNU GPL license, meaning that they are legal to modify and redistribute, even for money, provided that the mod is also released under GNU GPL, and provides the source code. This makes sense, but it of course makes it difficult to make money selling a game, because anyone who buys it can then redistribute it for free if they choose. I also read about the GNU Limited GPL (LGPL), which looks like closer to what I want--open source stuff that can be included in proprietary works. You don't have to provide the source code for your modification. It looks like you have to clearly separate your work from the LGPL work by using them as dynamically linked libraries, or something like that. I'm not sure how technologically viable that is for my idea yet. I tried to find RTS games made with this license. I might have found one (Evolution RTS: https://github.com/EvolutionRTS/Evolution-RTS/blob/master/license.txt), but it's ambiguous, and I'm unsure. Generally though, it seems like LGPL might be more of a thing for tools like game engines rather than whole games. One idea I have is to modify a regular GPL game, then host it with servers for competitive play on some site like steam. I of course wouldn't advertise that the code is open source, but people would probably be able to get the game itself for free in this way if they looked into it. However, they wouldn't be able to play it competitively against other people without paying on steam. Any advice? I'd be happy to hear feedback on the legal issue and/or the idea in general. Thanks!
    17. Don't ask anything, you are not in position to do so, it is silly. Reply with that foundation if oportunity comes.
    18. He has disabled existance of depth buffer and is in the fall space of XY in projection space
    19. CosmosDevelopment

      Need some ideas

      Maybe , Different Kinds Of Dragons or Elemental Dragons like Enemies If you Tink Your History Is Going Nowhere, You Should Add A Rival To Challenge Your Character
    20. CosmosDevelopment

      2D A Low requeriments Engine?

      Hi Everyone! I need help to develop my project My PC isn't Powerful Enough To Program My Project In An Engine Like GameMaker Studio 2 So... Do You Know An Engine Which A PC Like Mine Can Run To Make An Videogame Like Freedom Planet? My PC Especifications: Intel Celeron 2.4 Gz 4 GB RAM 2 TB Of Space 💜
    21. Rutin

      My Footsteps Sound Effects !

      Wow! Very cool! I was on your site today and wanted to know if you do a lot of custom music as well or just SFX? I noticed you have a music section but only 8 tracks.
    22. duke_meister

      c# console snake game

      No problem. I've created a blog for it, so as not to confuse yours. See some updated code there. As for 'easier'.... that's a subjective concept
    23. duke_meister

      First instalment

      This code is similar to that I posted in @phil67rpg 's blog but with comments and updated to remove some unnecessary stuff. I'll finish it off by making the snake grow longer, otherwise it's not much of a challenge. Be kind on the code, I wanted to see what I could do before bed last night PS: there's a big bug in the code.. using System; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace ConsoleSnake { /// <summary> /// All code written by duke_meister (Valentino Rossi) /// except keyboard reading technique /// </summary> class Program { // our unchanging values: // playfield height & width const int PlayfieldWidth = 80; const int PlayfieldHeight = 40; // timeout so game isn't too fast static int MillisecondsTimeout = 50; // our playfield; stores FieldVals instead of ints so we don't have to remember them static readonly FieldVals[,] PlayField = new FieldVals[PlayfieldWidth, PlayfieldHeight]; // not yet used until we increase length of snake static int _snakeBodyLen = 4; // not including head // which direction (SnakdDirs enum) the snake is currently moving static SnakeDirs _snakeDir = SnakeDirs.Right; // position of the one-and-only piece of food; use our own coordinate class, Pos static readonly Pos FoodPos = new Pos(0, 0); // defines the snake; each element tells us which coordinates each snake piece is at static readonly Pos[] SnakeCells = { new Pos(14, 10), new Pos(13, 10), new Pos(12, 10), new Pos(11, 10), new Pos(10, 10) }; // guess private static int _score = 0; // for randomizing things like food placement private static Random _rnd; // could've used something existing, but made a simple screen coordinate class public class Pos { public int X { get; set; } public int Y { get; set; } public Pos(int x, int y) { X = x; Y = y; } } // these make it easy (for the human) to know what each cell contains enum FieldVals { Empty = 1, SnakeHead, SnakeBody, SnakeFood } // these make it easy (for the human) to read snake the direction enum SnakeDirs { Up, Right, Down, Left } static void Main(string[] args) { _rnd = new Random(); Console.Clear(); // start with empty playfield for (var i = 0; i < PlayfieldWidth; i++) { for (var j = 0; j < PlayfieldHeight; j++) { PlayField[i, j] = 0; } } // start with an initial piece of food MakeNewFood(); // draw the border, once DrawBorder(); // game loop; this was the easiest but might switch to Timer, etc. // function names should explain purpose for (;/* ever */;) { AdjustGameSpeed(); CheckForKeyboardCommand(); UpdatePlayfield(); CheckForSnakeOutOfBounds(); UpdateSnakeBodyPosition(); CheckSnakeHasEatenFood(); } } private static void AdjustGameSpeed() { // delay so the game isn't too fast. Halve the delay (to go faster) when going left or right // as the playfield isn't square Task.Delay( _snakeDir == SnakeDirs.Up || _snakeDir == SnakeDirs.Right ? MillisecondsTimeout / 2 : MillisecondsTimeout).Wait(); } /// <summary> /// Check the keyboard for arrow keys /// I got the code off the net (see bottom of code); no point re-creating this /// </summary> private static void CheckForKeyboardCommand() { if (NativeKeyboard.IsKeyDown(KeyCode.Down)) // player hit Down arrow { // can't hit down while going up; game over if (_snakeDir == SnakeDirs.Up) EndGame(false); // change snake direction to down _snakeDir = SnakeDirs.Down; } else if (NativeKeyboard.IsKeyDown(KeyCode.Up)) { // can't hit up while going down; game over if (_snakeDir == SnakeDirs.Down) EndGame(false); // change snake direction to up _snakeDir = SnakeDirs.Up; } else if (NativeKeyboard.IsKeyDown(KeyCode.Left)) { // can't hit left while going right; game over if (_snakeDir == SnakeDirs.Right) EndGame(false); // change snake direction to left _snakeDir = SnakeDirs.Left; } else if (NativeKeyboard.IsKeyDown(KeyCode.Right)) { // can't hit right while going left; game over if (_snakeDir == SnakeDirs.Left) EndGame(false); // change snake direction to right _snakeDir = SnakeDirs.Right; } } /// <summary> /// See if snake has eaten the food /// </summary> private static void CheckSnakeHasEatenFood() { // if snake head is in the same x,y position as the food // NB: First() is a Linq function; it gives me the first element in the array if (SnakeCells.First().X == FoodPos.X && SnakeCells.First().Y == FoodPos.Y) { IncrementScore(); MakeNewFood(); } } private static void IncrementScore() { ++_score; WriteAt( $"Score: {_score}", 0, 0); } /// <summary> /// Put food item at random location /// </summary> private static void MakeNewFood() { int x, y; do { // this ensures we're not putting the food on top of the snake, or the border x = _rnd.Next(1, PlayfieldWidth - 1); y = _rnd.Next(1, PlayfieldHeight - 1); } while (SnakeCells.Any(pos => pos.X == x || pos.Y == y)); // set the food coords FoodPos.X = x; FoodPos.Y = y; // update the playfield position with the food value (plus the update value) PlayField[FoodPos.X, FoodPos.Y] = FieldVals.SnakeFood; } static void CheckForSnakeOutOfBounds() { // snake mustn't be on any border cell, or game over if (SnakeCells.First().Y < 1 || SnakeCells.First().X > PlayfieldWidth - 2 ||SnakeCells.First().Y > PlayfieldHeight - 2 || SnakeCells.First().X < 1) { EndGame(false); } } /// <summary> /// Move the snake pieces appropriately. I just did the simplest thing that I thought of. /// </summary> static void UpdateSnakeBodyPosition() { // Last piece of snake's tail will always become empty as the snake moves // NB: Last() is a Linq function; it gives me the last element in the array (end of snake tail) PlayField[SnakeCells.Last().X, SnakeCells.Last().Y] = FieldVals.Empty; // move the 'middle' section of the snake one cell along for (int i = SnakeCells.Length - 1; i > 0; i--) { SnakeCells[i].X = SnakeCells[i - 1].X; SnakeCells[i].Y = SnakeCells[i - 1].Y; } // move the snake's head, depending on direction moving // the body was already moved above switch (_snakeDir) { case SnakeDirs.Up: // moved the snake head up 1 (-ve Y direction) --SnakeCells.First().Y; break; case SnakeDirs.Right: // moved the snake head right 1 (+ve X direction) ++SnakeCells.First().X; break; case SnakeDirs.Down: // moved the snake head up 1 (+ve Y direction) ++SnakeCells.First().Y; break; case SnakeDirs.Left: // moved the snake head left 1 (-ve X direction) --SnakeCells.First().X; break; } // Set the playfield position at the head of the snake, to be... the snake head! PlayField[SnakeCells.First().X, SnakeCells.First().Y] = FieldVals.SnakeHead; // Set the positions on the playfield for the snake body cells // so we know to draw them // NB: Skip(1).Take(4) is Linq; it gives me the array left after // skipping the first item, then grabbing the next 4 (so in this // case misses the first and last). foreach (var cell in SnakeCells.Skip(1).Take(4)) { PlayField[cell.X, cell.Y] = FieldVals.SnakeBody; } } /// <summary> /// Just show a message and exit (can only lose right now) /// </summary> /// <param name="win"></param> static void EndGame(bool win) { Console.Clear(); Console.WriteLine($"YOU {( win ? "WIN" : "LOSE")}"); Console.ReadKey(); Environment.Exit(0); } /// <summary> /// Set the console size appropriately & draw the border, leaving room for the score /// </summary> static void DrawBorder() { Console.SetWindowSize(PlayfieldWidth, PlayfieldHeight + 2); WriteAt("+", 0, 1); WriteAt("+", PlayfieldWidth - 1, 1); WriteAt("+", 0, PlayfieldHeight); WriteAt("+", PlayfieldWidth - 1, PlayfieldHeight); for (var i = 1; i < PlayfieldWidth - 1; i++) { WriteAt("-", i, 1); WriteAt("-", i, PlayfieldHeight); } for (var i = 2; i < PlayfieldHeight ; i++) { WriteAt("|", 0, i); WriteAt("|", PlayfieldWidth - 1, i); } } /// <summary> /// Go through every element of the 2d array, only drawing a cell /// if it has a value (other than 0). This way we only draw the /// cells that need to be updated. A bit like Invalidate() in GDO. /// Pretty self-explanatory; if a cell has a value, draw the character /// appropriate for it. The space is only used to overwrite the last /// piece of the snake's tail. /// </summary> static void UpdatePlayfield() { for (var i = 1; i < PlayfieldWidth - 1; i++) { for (var j = 1; j < PlayfieldHeight - 1; j++) { switch (PlayField[i, j]) { case FieldVals.Empty: WriteAt( " ", i, j + 1); break; case FieldVals.SnakeHead: WriteAt("@", i, j + 1); break; case FieldVals.SnakeBody: WriteAt("o", i, j + 1); break; case FieldVals.SnakeFood: WriteAt(".", i, j + 1); break; } } } } // From Microsoft sample protected static void WriteAt(string s, int x, int y) { try { Console.SetCursorPosition(x, y); Console.Write(s); } catch (ArgumentOutOfRangeException e) { Console.Clear(); Console.WriteLine(e.Message); } } } /// <summary> /// Codes representing keyboard keys. /// </summary> /// <remarks> /// Key code documentation: /// http://msdn.microsoft.com/en-us/library/dd375731%28v=VS.85%29.aspx /// </remarks> internal enum KeyCode { Left = 0x25, Up, Right, Down } /// <summary> /// Provides keyboard access. /// </summary> internal static class NativeKeyboard { /// <summary> /// A positional bit flag indicating the part of a key state denoting /// key pressed. /// </summary> const int KeyPressed = 0x8000; /// <summary> /// Returns a value indicating if a given key is pressed. /// </summary> /// <param name="key">The key to check.</param> /// <returns> /// <c>true</c> if the key is pressed, otherwise <c>false</c>. /// </returns> public static bool IsKeyDown(KeyCode key) { return (GetKeyState((int)key) & KeyPressed) != 0; } /// <summary> /// Gets the key state of a key. /// </summary> /// <param name="key">Virtual-key code for key.</param> /// <returns>The state of the key.</returns> [System.Runtime.InteropServices.DllImport("user32.dll")] static extern short GetKeyState(int key); } }
    24. BlueBirdGamesDevelopment

      Need some ideas

      I've been creating a game for a few weeks now, but as I was creating the map I realized that it was a boring one... The game I'm creating is called Avalon Tales of the Brave, a 2D RPG turn-based game. It is based on the story of King Arthur (but mostly just refers to it) and how a corrupt evil has occurred and it is the player's mission to save the world of Avalon. The images attached are the Title, a few drawing of the characters and a small image of one of the levels of the map. The issue with the map is that there isn't really anything interesting about it. If my game was a side scroller, then it would be no problem, as I could add in obstacles along the way. You see, the way the player plays this game is that in a map, they roam around trying to find a gate that would lead them to the next level. Throughout the map, enemies would be roaming around. If the player comes into contact with the enemy, the player would be transitioned into a scene (image 6) where the player takes turns with the enemy to defeat them. Thus, if the map didn't have enemies, then it has nothing else to offer. I just need help with some ideas that I could add to make the game more interesting. Thanks!
    25. Yesterday
    26. THE PROJECT INT is a 3D Sci-fi RPG with a strong emphasis on story, role playing, and innovative RPG features such as randomized companions. The focus is on the journey through a war-torn world with fast-paced combat against hordes of enemies. The player must accomplish quests like a traditional RPG, complete objectives, and meet lively crew members who will aid in the player's survival. Throughout the game you can side and complete missions through criminal cartels, and the two major combatants, the UCE and ACP, of the Interstellar Civil War. Please note that all of our current positions are remote work. You will not be required to travel. For more information about us, follow the links listed below. INT Official website IndieDB page Also follow social media platforms for the latest news regarding our projects. Facebook Twitter TALENTS NEEDED 3D Animator 3D Character Modeler 3D Environment Modeler Unity Engine Programmer REVENUE-SHARE The project is marching increasingly closer to be ready for our crowd-funding campaign. Being an Indie team we do not have the creative restrictions often imposed by publishers or other third parties. We are extremely conscientious of our work and continuously uphold a high level of quality throughout our project. We are unable to offer wages or per-item payments at this time. However revenue-sharing from crowd-funding is offered to team members who contribute 15-20 hours per week to company projects, as well as maintain constant communication and adhere to deadlines. Your understanding is dearly appreciated. TO APPLY Please send your Cover Letter, CV, Portfolio (if applicable), and other relevant documents/information to this email: JohnHR@int-game.net Thank you for your time! Please feel free to contact me via the email provided should you have any questions or are interested to apply for this position. We look forward to hearing from you! John Shen HR Lead Starboard Games LLC
    27. I think the question shows you're eager to learn. And you've looked at the employer's product with a critical eye.
    28. No, I'm saying it's most likely irrelevant to whatever is planned next. I would show interest in knowing more about what they are working on now. The guy you say will be interviewing you is looking to the future. He wants to go forward not dwell on the past. If you haven't seen it... https://lootkitstudios.wordpress.com/2019/02/09/so-whats-ahead/
    29. phil67rpg

      c# console snake game

      thanks duke I am doing the graphics c# because observer said it is easier. I am able to get the snake to move up and down and left and right but I want it to move smoother animation. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = this.CreateGraphics(); SolidBrush greenBrush = new SolidBrush(Color.Green); SolidBrush blackBrush = new SolidBrush(Color.Black); Rectangle rect_green = new Rectangle(340 + x, 280 + y, 10, 10); Rectangle rect_black = new Rectangle(330 + x, 280 + y, 10, 10); g.FillRectangle(greenBrush, rect_green); g.FillRectangle(blackBrush, rect_black); greenBrush.Dispose(); g.Dispose(); } int x = 0, y = 0; Random rnd = new Random(); private void timer1_Tick(object sender, EventArgs e) { int move = rnd.Next(1, 5); switch (move) { case 1: for (int i = 0; i <= 20; i++) { x++; } break; case 2: for (int i = 0; i <= 20; i++) { x--; } break; case 3: for (int i = 0; i <= 20; i++) { y++; } break; case 4: for (int i = 0; i <= 20; i++) { y--; } break; } if (MouseButtons == MouseButtons.Left) { } Invalidate(); } private void Form1_MouseDown(object sender, MouseEventArgs e) { } } }
    30. duke_meister

      c# console snake game

      You said you'd changed your mind from doing console, so I went for it Take a piece and analyse it. I'm happy to go over each aspect one at a time. Want me to do that? If so I'll add comments in the code. Much of it is relevant to your GDI project.
    31. hplus0603

      Some questions about UDP in C++

      1. In general, you can do fine with a single socket. Perhaps some OS/library combinations make throughput higher if you have multiple sockets open, but I haven't actually run into that in practice. Also, if you want to receive on multiple ports, you'd need multiple sockets. Finally, some red/green "always-up" deployment methods may need multiple sockets to support the roll-forward / roll-back scenarios. That's pretty esoteric, though. 2. Yes, in general, the two programs need to use different ports. Two different programs, using the same port, running on the same host, will not work well. Multiple processes can bind to the same UDP port on the same host (network interface, really) using the appropriate setsockopt() (REUSEPORT or REUSEADDR) and this is sometimes useful (see above.) 2b. If you want to run multiple instances of the server for the same game that binds to the same port on the same host, you will need to expose multiple IP addresses for the same network interface, which you typically do by creating multiple virtual interfaces that alias to the same physical interface. As long as none of the processes bind to the "every interface" address (IPADDR_ANY, or 0.0.0.0) and each process binds to its own virtual interface address, it'll work fine. Obviously, clients need to talk to the correct IP address. 3. For UDP, you still need to open a port, because if a packet shows up at the router, saying "hey, I'm here for port X," the router won't otherwise know where to forward that packet. There are ways around this, called "NAT punch-through," that requires collaboration with some shared host on the outside of the router for both client and server. Regarding how "real games" do this, you may end up with some kind of proxy or gateway, that receives UDP packets from all possible clients, and then maps the incoming packets to the appropriate address/port/process on the back-end by inspecting which client it came from, for example. That intermediate proxy would have to build its own session state for the game, even though UDP itself doesn't have session state.
    32. I have a few questions regarding using UDP in C++. Since UDP is connectionless, is there any reason for a UDP server to have more than one socket created? Let's assume you are running two programs on your pc that both use UDP. Program A and program B. What is stopping program A from reading all of the packets that are intended for program B to receive before program B can read them? Is it just the specific port that is originally used when the socket is bound? If this is the case, how can you run multiple instances of a game that uses UDP if they are all set up to use the same designated port? For TCP, if you want to host a server you have to open ports through your router for the port your server will use for listening. Is this not required for UDP since no actual connection exists? If it is not required, why is there an option to forward ports for UDP in router configurations?
    33. I made a project for Visual Studio 2015: SortFunctions.zip This project will show you how set up GoogleTest and run simple unit test. I set up already. You need to: open the solution select your version of VS, for example VS 2017 instead of VS 2015 (see screenshot below) set SortFunction_UnitTests project as StartUp project press Ctrl+F5 to run unit tests I set up it like this: I created the "Libs" folder I copied the "gtest-1.8.1" folder to the "Libs" folder I opened Setting of the project and add these lines to "C/C++" -> "General" -> "Additional Include Directories": Note. If you have another version of VS than before you will run unit tests you need to select VS 2017, like in this screenshot: This solution include two projects: SortFunctions SortFunctions_UnitTests SortFunctions project has two files: SortFunctions.h #pragma once extern void bubbleSort(int *array, unsigned int amount); extern void countingSort(int *array, unsigned int amount); SortFunctions.cpp #include "SortFunctions.h" void bubbleSort(int *array, unsigned int amount) { } void countingSort(int *array, unsigned int amount) { } SortFunctions_UnitTests project has tests. For example, this is the "bubbleSortTests.cpp" with two tests. The first test is for positive numbers and the second test is for negative numbers: bubbleSortTests.cpp #include <gtest/gtest.h> #include "SortFunctions.h" TEST(bubbleSortTest, AllPositiveElements) { // Arrange const unsigned int amount = 5; int actualArray[amount] = { 5, 3, 10, 2, 7 }; int expectedArray[amount] = { 2, 3, 5, 7, 10 }; // Act bubbleSort(actualArray, amount); // Assert for (size_t i = 0; i < amount; i++) { ASSERT_EQ(expectedArray[i], actualArray[i]); } } TEST(bubbleSortTest, AllNegativeElements) { // Arrange const unsigned int amount = 5; int actualArray[amount] = { -5, -3, -10, -2, -7 }; int expectedArray[amount] = { -10, -7, -5, -3, -2 }; // Act bubbleSort(actualArray, amount); // Assert for (size_t i = 0; i < amount; i++) { ASSERT_EQ(expectedArray[i], actualArray[i]); } }
    34. tyree

      run attack

      character L rue https://youtu.be/UwsQx9zkJ6k
    35. This question concerns OpenGL. I have found some code for checking the y value with a grid to place an object on a mesh (a type of collision detection). However, I want to check the height over and over again to change the velocity of the ball depending on the height of the changing y value. How do I repeatedly check every height, or is there a different way? I'm using C++. Thanks, Josheir
    36. For the vertices, change Z to slightly above 0
    37. desc.DepthStencilState.DepthEnable = false; /**< disable depth testing */ desc.DepthStencilState.StencilEnable = false; /**< disable stencil testing */ This is pretty unstandard to do. Check if your driver is not crazy by enabling at least depth buffer. (Also the comments are inappropriate, it does not disable depth testing as there is a command call in pipeline to do that any time, in desc it creates depth-buffer-less back buffer) Also check your scissor test values
    38. Hello there ! Today I want to share with you my footsteps sound effects. This is just a selection among a long list of footsteps that I have in my collection. In this list you will find of people wearing different sort of equipment like armors, chain mails, and space suits or traditional clothes walking on surfaces like snow, sand, concrete, gravel, water, wood and so on. Don't forget to check out my website and subscribe to my newsletter to get some really cool free sounds all along the year: www.ogsoundfx.com
    39. As I understand it, @fleabay says that the person doing the interview may not know that particular detail at all. If you have N persons working on a game, it's quite fair to say that anyone has deep knowledge about 1/N part of the game (as a pessimistic estimate), ie (N-1)/N part of the game, the person knows less to nothing about.
    40. phil67rpg

      c# console snake game

      well duke thanks for the code but I cant learn by copying someone else code. let me work on what observer has sent me. I can only digest so much code at one time.
    41. Well the guy interviewing me is the founder and developer himself of the game. So you're saying that it would reflect negatively on my part if I start questioning his design practices? My intention was to show how much I know in a form of a question. Man glad I asked before hand.
    42. Kylan Haffie

      Some reviews for your game!

      Hi Kapitoshka, As a Student Game Developer, I am always looking for new ways to improve my game and to recieve feedback from players. Would you be interested in reviewing a free android game? It's called Leapy Frog and available on the Google Play Store (Link to page). Here is a brief description; Let me know how you feel, Kylan Haffie
    43. kapitoshka765

      Some reviews for your game!

      Hello! Im here to make kind a trade with you. I can make you some real reviews that could let you know, what you need to fix or add. From you i need only some keys of your games(only you can decide how much). So, thats all, have a nice day!
    44. Here is my first result, the arch bridge use case I was talking about, in a "slightly" unrealistic way 😀 Since the new version of the game has no 3D interface yet, I exported this generated mesh from the game to a Wavefront .obj file and rendered it with Blender. The mesh is generated from a hand-made straight bridge model piece with one arch and a half-pillar on each end (see second screenshot below). That piece is repeated and curved to follow the track. The mesh is not just rotated as a whole, its vertices are displaced to "bend" the mesh, fitting the curvature of the track- that's not very well visible in that image).
    45. Hi, I added you on Discord, I'm interested on a Java dev position
    46. I wouldn't ask questions about a game that was already released. Do you even know if the person(s) interviewing you would know how that game was designed/developed?
    47. I want to have some more originality to my rpg classes for a tactical rpg. These are my names for now, and they are a little bit too much standard... The names come from the architypical role I want that class to fill in the game, but yeah, any idea of name variations? Strong frontliners: Templar Barbarian Cleric (healer and knight sort of. Paladin style) Black knight Medium range, agility based: Mercenary (soldier type, lots of weapon flexibility) Assassin Ranger (outdoorsman type of class) Archer (specialist in bows and crossbows) Squishy magic users: Sorcerer (classic damage class) Priest (support and healing) Warlock (dark magic)
    48. Hi guys, I'm a little nervous about this interview that I'm about to go for next week, and I'm planning questions to ask to the employer. I'm not sure if those questions are spot on or offensive? While watching how the game works online, I came up with a few questions: I can see that drawing a line from ship to landing spot was done using a line renderer component, but did you also use a Navigation component to make the ships follow the line to the landing spot? I've also noticed that the line drawn gradually changes to their respective colors. Is there some error checking that happens during that time frame to make sure the color of the ship matches the color of the landing spot? I'm applying for LootKit Studios interview, and they have this game already established for the PC called Cosmic Control. They are looking for an Unity developer. I'm trying to ask questions regarding how their game works. Would it back fire on me in some way or does it show that I'm interested in the project?
    49. = {} doesn't give you defaults. You probably want CD3DX12_<state object type>(D3D12_DEFAULT) from d3dx12.h. Not sure if that's the problem, but it's the first thing that jumped out to me.
    50. Gabz

      Special Effects For Games

      Unique Toon Projectiles Vol.1 - Showcase Cartoon projectiles are awesome! Had a blast creating this package, check it out! WebGL Demo Asset Store Patreon Enjoy & Thank you!
    51. Irusan, son of Arusan

      Question about making meshes for spritesheets

      Er, actually, I misunderstood slightly. Listen to Zakwayda
    52. Hello there! Welcome to this installment of your favourite Weekly Update blog! I'm gonna say this outright: there are two new mechanics and some freshen aesthetics too! So let's get right to it! Alt Fires First up, let's talk about that lonely right mouse button. Previously that button was used to trow crystals around, but due to the previous update, there's no more crystal trowing anymore. This made right click very lonely indeed. To remedy this I've decided to implement secondary actions to weapons. For melee weapons, it's a blocking mechanic while in range ones it's a zoom mechanic. Guarding In melee weapons, the secondary action is some kind of guard. It doubles your defence stat while pressing and holding the secondary action button. You can block any actual attacks, both melee and ranged too. But there's more! Parry Another possible thing is to parry an attack. To do this the player needs to let go of the secondary action button precisely as an enemy attack. Unlike guarding, this technique mirror back the attack to their opponent. This is extremely gratifying to pull it off, but all of this needs to be planned ahead, as you only get a couple of frames to parry an attack. Also, you cannot do a quick parry. If you quickly let go of the secondary action button you will instead get punished by not only not doing a parry but also have a long cooldown too. parry.mp4 Zoom Secondly, range weapons (such as bows and guns) also get a secondary action as some kind of zoom. While holding the secondary action button the player's view will zoom in, making it easier to aim. While zoomed in, the mouse sensitivity will be greatly reduced, helping along with the aiming. There are no statistical benefits with zooming whatsoever. It's just really useful when you're having bad aim. Like guarding, getting in and out of it will induce a longer cooldown, so don't screw around too much! The Jungle Secondly, there's also been some kind of aesthetic upgrades, especially to the first level. Basically, I've changed my prop algorithm to add support for level-specific ones. This effectively meant that different props will appear in different levels, making each level feel a little bit different from each other. Right now I'm focusing on the jungle one, so let's see what's up... Super Ferns First new prop is the super ferns. In rainforests (the main type of forest casually associated with jungles), there is a lot of types of perennial vegetation, especially ferns. So it was a no-brainer to include those in the game (especially for the first level). Luckily, I already fully modelled a leaf of those type of ferns. It was just a matter of merging several duplicates of that model and boom, got yourself a rainforest fern. take a look : Anthurium Sagittatum Another really striking rainforest plant that I've fallen in love with is the Anthurium sagittatum plant. As you can see their leaves got a really distinctive shape that I just got to include in the game. Here's what I got: The Liana is back Also, the liana is back from the dead! It previously used as a placeholder to test my room algorithm, but now it's back in full force! With the new shader and Ambient Occlusion, I've got to say that it looks a whole lot better than previously. And with all those new props the jungle level slowly starts to look a whole lot like a jungle: And I'm technically not done yet! Minor Updates The refactor continues! I was able to shed about 10 MB whit all that duplicated code removed. With all those duplicated codes removed, it's now a whole lot cleaner. I've even managed to remove some typos and duplication corruptions here and there too. Fixed a bug with the animation state machine not being properly set up, meaning that attacks and guarding can override each other. Fixed a bug with 3D catenary slopes (like lianas and bridge ropes) not ending correctly. Upgrade the double-sided shaders to have better lighting when the geometry's normals are facing away from the camera (i.e. when we're looking inside the mesh) Also added some two-sided shading to appropriate models too! Fixed some problems with the level mesh generator generating meshes where it shouldn't. Removed most lighting probes references to static assets (because, you know, procedural generation) Next Week So next week I'm going to continue with the level-specific props and whatnot while looking at bugs too. I'm still planning to have something by the end of the month, or maybe by mid-March if there's any holdup, but we'll see. Otherwise, it's the usual suspects. So that's pretty much it! See you next week!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!