Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MrOnlineCoder

Pages: 1 ... 3 4 [5] 6
61
SFML projects / Re: First Game Showcase (with source code!)
« on: September 10, 2016, 05:30:03 pm »
Nice work! The text in console ending on "lol" just made my day :)

62
General / Re: Implementing spell system
« on: September 10, 2016, 05:14:14 pm »
Adding functions to Lua from C++ is not a problem, my question is: how can I call Lua function from c++ mulitple times?

For example:

In C++ I have Spell class:

class Spell {
  int manacost;
  string name;
  int type;
  //Handler function
};
 

And how can I store spell handler function in this class?

spell.act(); // How to do this?
 

63
General / Implementing spell system
« on: September 10, 2016, 03:45:47 pm »
Hello. I am adding "spell system" in my game. Spells are unique: one just do damage, another moves player in other position, another one adds buff, etc. Can it be implemented in Lua scripting? I mean something like
zeus_arrow.lua in spells folder:
function handler(target)
  --Implemented in C++
  DamageCharacter(target, 20);
end
--Implemented in C++
RegisterSpell("Zeus Arrow", handler);  
 

If yes, then how can I store handler function in C++, and call it everytime when spell is used?

64
Feature requests / Simple Message Box
« on: September 10, 2016, 02:42:17 pm »
Hello. Can SFML get a simple message box feature? It is useful for handling errors, and telling them to user. Like in SDL: https://wiki.libsdl.org/SDL_ShowSimpleMessageBox

65
General / Re: Best way for organizing turn-based game
« on: September 10, 2016, 09:55:02 am »
I found a nice solution for protecting Lua scripts (spells logic, AI) - LUAC compiler. https://www.lua.org/manual/5.1/luac.html

66
General / Re: Best way for organizing turn-based game
« on: August 28, 2016, 06:23:57 pm »
After some weeks of work, I ended in next design:
Hero class, that contains it HP, Damage, Speed, Range, Position in field coords (just Cell X and Cell Y) and sprite and has method for checking if sprite was clicked or not.
HeroCollection, which is shared between all game screens, and contains all heroes data.
Some pseudocode of game screen logic:
if (window.pollEvent()) {
  Vector2f = Mouse.getMousePos();
  if (wasUIUsed) //Check if menu, end turn button etc. were clicked  {
   doAction();
  }

  int cellX = transformRealX();
  int cellY = transformRealY();

  if (!clickInField) {
     continue;
  }

  for (Hero hero : players heroes vectors) {
   if (hero.isClicked() && hero.isEnemy()) {
    hero.damage();
    endTurn();
   }
  }

  if (getCurrentHero()->canMoveTo(cellX, cellY)) {
    getCurrentHero()->moveTo(cellX, cellY);
    endTurn();
  }

  //draw everything
}
 

Is it OK?

Sorry, maybe question can be too broad.

67
General / Re: Is it normal GPU usage?
« on: August 27, 2016, 08:34:01 pm »
If "--fps" flag is not set, then options.maxFPS = 60, it has same GPU usage without flag.

68
General / Re: Is it normal GPU usage?
« on: August 26, 2016, 11:01:18 pm »
Ok. So framerate limit is 60 by default but user can change it by setting "--fps XX" launch option. Main.cpp parses all launch options and send them to engine.

Engine::Engine(LaunchOptions options)
{
    Uint32 style = Style::Close | Style::Titlebar;

    if (options.fullscreen) {
        style = Style::Fullscreen;
    } else {
        style = Style::Close | Style::Titlebar;
    }
    eLog("Constructor called!");
    app.create(VideoMode(1024, 768), "Game", style);
    app.setFramerateLimit(options.maxFPS);
}

 


I send reference of window to my game screens (state).

69
General / Re: Is it normal GPU usage?
« on: August 26, 2016, 09:50:44 pm »
Nope, I set framerate limit on start. I used Process Hacker to get GPU/CPU Usage

70
General / Is it normal GPU usage?
« on: August 25, 2016, 07:40:46 pm »
Hello. I am drawing on game screen ~12 sprites each frame on 120 fps and it "eats" 20% of my GPU and CPU. My GPU is 775 MHz, so 20% is ~155 MHz. Is it normal?

71
General / Re: Using same textures for different things
« on: August 22, 2016, 09:44:59 pm »
Thanks, that helped me.

72
General / Using same textures for different things
« on: August 22, 2016, 07:56:36 pm »
Hello. In what way should I organize my code to make reusable things? For example, I have level browser, where every level icon is drawn on texture-background. How to make it easy to make and use both for me and PC CPU/GPU?

73
General / Re: Will one SFML project run on different computers?
« on: August 22, 2016, 04:33:55 pm »
So, I included libgcc_s_sjlj_1.dll in folder with executable, but it complained about libstdc++-6.dll. I included it and everything worked perfectly.

74
General / Re: Will one SFML project run on different computers?
« on: August 21, 2016, 11:48:18 pm »
If I want to make game public, publish to Steam, how can I make game runnable on every Windows system?

75
General / Re: Will one SFML project run on different computers?
« on: August 21, 2016, 10:47:29 pm »
Including this lib in program is not a problem. My question is: why my game runs on my pc very well, but crashes on other pc?

Pages: 1 ... 3 4 [5] 6
anything