Jump to content

XerShade

Contributors
  • Content Count

    38
  • Donations

    $5.00 
  • Joined

  • Last visited

2 Followers

About XerShade

  • Birthday 06/26/1992

Contact Methods

  • Website URL
    http://www.xershade.ca/

Profile Information

  • Gender
    Male
  • Location
    Canada
  • Interests
    Gaming, Coding, Bugging PandaCoder, Website Design

Profile Fields

  • My Project
    Esmiylara Online
  • Steam ID
    TheShadeGamer
  • LoL Name
    XerShade
  • Twitch.tv
    XerShade

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Right, you need a database context class that does this all when the server loads, shutdowns, or autosaves. Opening and closing a connection takes alot of resources that you should not be doing in the middle of a game loop. An example of how you would do this ideally when you start, stop or save is: DbContext context = new DbContext(GameData); context.Connect(); context.LoadBanks(); Etc. Etc. context.Close(); And your context might look something like this: public class DbContext { GameData data; Connection conn; public DbContext(GameData data) { this.data = data } public void Connect() { // Do the stuff to connect. } public void Close() { // Do the stuff to loeave. } public void LoadBanks() { var query = "SELECT * FROM banks;" var result = MySql.Query(query); foreach(var row in result) { data.Banks.Update(row); } } } That is just an idea though, you would have to actually code the Context, GameData, and other related classes correctly, but that is how most people recommend you poll databases, again polling a database requires a fair bit of resources that WILL lag down your game loop.
  2. This was the fruit of about four hours of trying to figure out how to do this, it's a simple script that reads the folder id of the page the block is displayed on, then lists the pages inside that folder. I mostly made this for use as an index page for most of the sites folders, however I am thinking of doing up a sidebar version at a later date. Source code: http://www.xershade.ca/content/articles.html/programming/invision-power-board/folder-index-block-r1/ Demo: http://www.xershade.ca/content/index.html/
  3. Not sure why I wanted to make a social login based site, just did thought it would be different. And @PhenomenalDev I do have a site, it should be on my profile. As it stands I have it setup so people can't make an account with the User/password login or change passwords. The login systems still enabled, with admins having passwords, in case the OAuth goes down like jc said.
  4. Anyone know how to disable Invisions username/password login method, I only want people to be using the OAuth stuff from google, etc. I mean short of disabling registrations and making it so you can't set a password I have no idea as the Enable/Disable button is locked.
  5. So I am currently trying to design the structures for entities in my game and have run into a little snag with how it calculates the max vitals for the vitals structure. The snag is that the formula needs EntityStats but EntityVitals does not have access to that, and I would prefer to keep it that way so I am not tossing references around the place. Here is my project structure for what I am working with. Data Entity - The entity object. Logic LogicEntities - The static class where my GetEntityMaxVital function will be. Strcutures EntityStat - A single entity stat structure. EntityStats - The structure that defines entity stats. EntityVital - A single entity vital structure. EntityVitals - The structure that defines entity vitals. Any help would be greatly appreciated. -XerShade
  6. Not sure if this should go here or not, but will try it out anyways. Anyhow coded me up a simple multi-threaded loop for my game Esmiylara Online and though I would share. Needs to be optimized though, very optimized. Demo of the code in action: https://www.youtube.com/channel/UCgedQWDNldjmHiFJvjN3Hxg using Esmiylara.Online.Client.Media.Graphics; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using SFML.Graphics; using SFML.Audio; using SFML.System; using SFML.Window; using Timer = Esmiylara.Online.Components.Timer; using KeyEventArgs = SFML.Window.KeyEventArgs; using System.Windows.Forms; namespace Esmiylara.Online.Client { /// <summary> /// Esmiylara Online game engine, defines engine functions. /// </summary> public static partial class Engine { private static Thread cpu; private static Thread gpu; private static bool RunEngine; static SfmlWindow win; public static void Run() { if (!RunEngine) thread(); } public static void Stop() { RunEngine = false; } private static void thread() { RunEngine = true; cpu = new Thread(() => { Timer tickMove = new Timer(1000 / 60); while (RunEngine) { if(tickMove.CheckInterval()) { if (TempCode.Move.Up) { TempCode.Direction = TempCode.DIR_UP; if (TempCode.Y - 1 > TempCode.MinY) { TempCode.Y -= (TempCode.Movement * 1); } } if (TempCode.Move.Down) { TempCode.Direction = TempCode.DIR_DOWN; if (TempCode.Y + 1 < TempCode.MaxY) { TempCode.Y += (TempCode.Movement * 1); } } if (TempCode.Move.Left) { TempCode.Direction = TempCode.DIR_LEFT; if (TempCode.X - 1 > TempCode.MinX) { TempCode.X -= (TempCode.Movement * 1); } } if (TempCode.Move.Right) { TempCode.Direction = TempCode.DIR_RIGHT; if (TempCode.X + 1 < TempCode.MaxX) { TempCode.X += (TempCode.Movement * 1); } } if (TempCode.Move.Up || TempCode.Move.Down || TempCode.Move.Left || TempCode.Move.Right) TempCode.Step = (TempCode.Step >= 60 - (TempCode.Movement * 2)) ? 0 : TempCode.Step + (TempCode.Movement * 2); else TempCode.Step = 0; tickMove.Update(); } if (TempCode.Test.CPU) { Thread.Sleep(TempCode.Random.Next(50, 200)); } } }); cpu.Start(); gpu = new Thread(() => { Timer tickMove = new Timer(1000 / 60); Image sprite_img = new Image("whitemage_f.png"); Texture sprite_tex = new Texture(sprite_img); Sprite sprite = new Sprite(sprite_tex); win = new SfmlWindow(); win.Closed += (a, b) => { RunEngine = false; }; win.KeyReleased += Win_KeyReleased; win.KeyPressed += Win_KeyPressed; while (RunEngine) { if (tickMove.CheckInterval()) { win.Clear(Color.Green); int st = (TempCode.Step / ((60 - (TempCode.Movement * 2)) / 4)); st = (st >= 4) ? 3 : st; sprite.Position = new Vector2f(TempCode.X - 16, TempCode.Y - 48); sprite.TextureRect = new IntRect(32 * st, 48 * TempCode.Direction, 32, 48); win.Draw(sprite); win.Display(); win.DispatchEvents(); if (TempCode.Test.GPU) { Thread.Sleep(TempCode.Random.Next(50, 200)); } tickMove.Update(); } } sprite.Dispose(); sprite_tex.Dispose(); sprite_img.Dispose(); sprite = null; sprite_tex = null; sprite_img = null; win.Dispose(); win = null; }); gpu.Start(); while (RunEngine) { Thread.Sleep(1); Application.DoEvents(); if (win != null && win.IsOpen) win.DispatchEvents(); } cpu = null; gpu = null; } private static void Win_KeyPressed(object sender, KeyEventArgs e) { switch(e.Code) { case Keyboard.Key.Up: TempCode.Move.Up = true; TempCode.Move.Down = false; break; case Keyboard.Key.Down: TempCode.Move.Up = false; TempCode.Move.Down = true; break; case Keyboard.Key.Left: TempCode.Move.Left = true; TempCode.Move.Right = false; break; case Keyboard.Key.Right: TempCode.Move.Left = false; TempCode.Move.Right = true; break; case Keyboard.Key.LShift: TempCode.Movement = 2; break; } } private static void Win_KeyReleased(object sender, KeyEventArgs e) { switch (e.Code) { case Keyboard.Key.Up: case Keyboard.Key.Down: TempCode.Move.Up = false; TempCode.Move.Down = false; break; case Keyboard.Key.Left: case Keyboard.Key.Right: TempCode.Move.Left = false; TempCode.Move.Right = false; break; case Keyboard.Key.LShift: TempCode.Movement = 1; break; case Keyboard.Key.Num1: TempCode.Test.CPU = false; TempCode.Test.GPU = false; break; case Keyboard.Key.Num2: TempCode.Test.CPU = !TempCode.Test.CPU; TempCode.Test.GPU = false; break; case Keyboard.Key.Num3: TempCode.Test.CPU = false; TempCode.Test.GPU = !TempCode.Test.CPU; break; } } public static class TempCode { public static int X; public static int Y; public static int Direction; public static int Movement = 1; public static int MinX = 16; public static int MinY = 48; public static int MaxX = 1024 - 16; public static int MaxY = 576 - 48; public static int Step = 0; public const int DIR_UP = 3; public const int DIR_DOWN = 0; public const int DIR_LEFT = 1; public const int DIR_RIGHT = 2; public static Random Random; static TempCode() { X = (1024 / 2) - (32 / 2); Y = (576 / 2) - (48 / 2); Direction = DIR_DOWN; Random = new Random(); } public static class Move { public static bool Up; public static bool Down; public static bool Left; public static bool Right; } public static class Test { public static bool CPU; public static bool GPU; } } } }
  7. Engine's are not coded over night. Took me four hours now to code an extremely basic, bare bones, buggy as all banannas game loop. Still got at least a few days to go on something simple like that.
  8. Started to work on multi-threading the loop, code can be seen here: https://gitlab.com/XerShade/Esmiylara.Online/blob/master/source/Esmiylara.Online.Client/Engine.cs I will be re-writing it from scratch later to be more optimized and for two threads instead of one. Suggestions are still appreciated.
  9. So I have the game loop for my game coded here. I've been trying to figure out how to make Update() not get lagged out when Draw() takes it's time and slows the game out. Game Loops have always been a weak point so any help would be greatly appreciated. Source Code: https://gitlab.com/XerShade/Esmiylara.Online/blob/master/source/Esmiylara.Online.Client/Engine.cs using Esmiylara.Online.Client.Components; using System; using System.Threading; using System.Windows.Forms; using Timer = Esmiylara.Online.Client.Components.Timer; namespace Esmiylara.Online.Client { /// <summary> /// Esmiylara Online game engine. /// </summary> public partial class Engine { /// <summary> /// The game loop's thread. /// </summary> private static Thread LoopThread; /// <summary> /// Tells the engine if it should continue looping. /// </summary> private static bool DoLoop; /// <summary> /// [Hook] GameLoopInitialize, called when the game loop is initialized. /// </summary> public static event EventHandler<EventArgs> GameLoopInitialize { add { GameLoop.GameLoopInitialize += value; } remove { GameLoop.GameLoopInitialize -= value; } } /// <summary> /// [Hook] GameLoopStart, called when the game loop is started. /// </summary> public static event EventHandler<EventArgs> GameLoopStart { add { GameLoop.GameLoopStart += value; } remove { GameLoop.GameLoopStart -= value; } } /// <summary> /// [Hook] GameLoopUpdate, called when the game loop is updated. /// </summary> public static event EventHandler<EventArgs> GameLoopUpdate { add { GameLoop.GameLoopUpdate += value; } remove { GameLoop.GameLoopUpdate -= value; } } /// <summary> /// [Hook] GameLoopDraw, called when the game loop is drawn. /// </summary> public static event EventHandler<EventArgs> GameLoopDraw { add { GameLoop.GameLoopDraw += value; } remove { GameLoop.GameLoopDraw -= value; } } /// <summary> /// [Hook] GameLoopStop, called when the game loop is stopped. /// </summary> public static event EventHandler<EventArgs> GameLoopStop { add { GameLoop.GameLoopStop += value; } remove { GameLoop.GameLoopStop -= value; } } /// <summary> /// [Hook] GameLoopDispose, called when the game loop is disposed. /// </summary> public static event EventHandler<EventArgs> GameLoopDispose { add { GameLoop.GameLoopDispose += value; } remove { GameLoop.GameLoopDispose -= value; } } /// <summary> /// Runs the game engine. /// </summary> public static void Run() { // Call the loop method. Loop(); } /// <summary> /// Stops the game engine. /// </summary> public static void Stop() { // Tell the engine to stop looping. DoLoop = false; } /// <summary> /// Aborts the game engine thread. /// </summary> public static void Abort() { // Do the thing! LoopThread.Abort(); } /// <summary> /// The game engine loop function, do NOT call this directly. EVER. /// </summary> private static void Loop() { // Construct a new thread and assign the game code. LoopThread = new Thread(() => { // Tell the engine to loop. DoLoop = true; // Construct the game loop's variables. GameTime tick = new GameTime(); Timer tickUpdate = new Timer(1000 / 30); Timer tickDraw = new Timer(1000 / 30); // Initialize the game. GameLoop.Initialize(); // Start the game. GameLoop.Start(); // The game loop, simple for now. while (DoLoop) { // Update the GameTime object. tick.Update(); // Check to see if we need to update the game. if (tickUpdate.CheckInterval(tick.Value)) { // Update the game, do NOT draw any part of the game here. GameLoop.Update(tick); // Update the timer. tickUpdate.Update(tick.Value); } // Check to see if we need to draw the game. if (tickDraw.CheckInterval(tick.Value)) { // Draw the game, do NOT draw any part of the game here. GameLoop.Draw(tick); // Draw the timer. tickDraw.Update(tick.Value); } // Update the message pump. Application.DoEvents(); } // Stop the game. GameLoop.Stop(); // Dispose the game. GameLoop.Dispose(); }); LoopThread.Start(); } } }
  10. ARK: Survival Evolved PVE Server Server Information Name: lodicolo (on the ARK Unofficial Server browser) Host: ark.lodicolo.info Port: 7777 DLC: The Center (Free) Mods: Will auto-install on first connect to the server (make sure you don't have any first though) ARK Server Discord Information Invite URL: https://discordapp.com/invite/aQ4bZh7 Channel: ARK: Survival Evolved
  11. One of the beauties of the newer language is unlike older engines like Mirage built in VB6, i that the newer languages are smarter about how they serialize types. On older engines changing any data in the middle of a class would break the data and require a manual conversion. The newer languages are smarter about this. So as long as JCS doesn't do anything drastic you should be good, even then he would probably write up a manual updater if it was required.
  12. True, just whenever I do fonts in SFML the framerate takes a hit, not sure if its my gpu or what but will probably go for SFML, failing that SharpDX.
  13. Long story short, my project Xeris is getting to the point where I need to start working on rendering the game objects so I can actually see them processing on screen. I was thinking of going with SFML.NET but figured I would ask around for opinions first. Please keep in mind that being able to google information on how to use the library is a plus, as I am not too familiar with them.
  14. In most 2D games cliffs don't have auto tiles as they are walls. Auto tiles are usually meant for "flat" surfaces like floors and ceilings, not vertical ones like walls. Anyhow if you want a cliff auto tile just take the image and edit it so its in auto tile format, will look into exactly how to do this as I haven't touched auto tiles in a while.
×
×
  • Create New...