Jump to content
  • Advertisement

All Activity

This stream auto-updates     

  1. Past hour
  2. r1ckparker

    Controlled Randomness

    You probably want a bit of randomness in your game, for example when enemies shoot a bullet or how long an explosion lasts. However sometimes you want it to be the same every game, so the player will know that an enemy will enter the stage and always shoot a bullet. You want some randomness, but consistent randomness so it is the same every time. "When replaying levels, enemies always appear in the same location and follow the same behavioral patterns" One way to do this is to have an array and load this with pre-calculated random numbers. When your game needs a number, call the next one off the stack and loop back to the top when you have run out. One cool thing you can do with this is save a replay. If you capture the player's inputs each tick, then in theory everything in the game should play out the same way. You could use this for demo mode or as a save feature.
  3. The information is stored here, but in a nutshell I am looking to work with a programmer to develop a voxel engine ( Nice chunk of this done !) and help with gameplay using unreal engine.
  4. Gnollrunner

    Vulkan? OpenGL? What........?

    From what I understand (and I may be wrong) only the Start Citizen modified version of CryEngine supports this and of course that's proprietary. I checked into Lumberyard before and I saw some banter about it but nothing that said it was implemented yet. In fact just about every major engine has some forum posts where a few people have asked for it. The only one which defiantly has it that I found is UNIGINE and that's kind of pricey. I guess you might be right. It's better to defer this stuff until later.
  5. Irlan Robson

    Points constraint approach

    Here is a summary of three approaches that can be used for hair/rope simulation: - Mass-spring System: Here particles are connected via linear springs. Equation of motion can be solved using an implicit integrator to support large time steps and avoid instability. This is typically used for cloth simulation in movies and some games (LucasArts, Blender, Pixar). - Position Based Dynamics: Kind of what you're using and commonly used in games. Fast but as an iterative solver, constraints can break. - Featherstone: Fast and supports any time step. Large velocities may lead to instability and blow up the simulation. Can be used for simulating inextensible hair. Featherstone is a single step approach. It works in reduced coordinates. Constraints are always satisfied. However, large time steps might lead to instabilities, but we can add damping to improve stability.
  6. Gnollrunner

    Vulkan? OpenGL? What........?

    If you know of any that are available, I'd be happy to hear about them. I've asked around quite a bit on various sites.
  7. Hodgman

    Vulkan? OpenGL? What........?

    IIRC CryEngine & Lumberyard do this by default? If you want portability in general, then you'll have to use more than one GPU API You can defer this decision to a future time by keeping a strong decoupling layer between higher level rendering algorithms (scenes, shadows, lights, models, materials) and platform-specific (D3D/VK/etc) implementation details. If by "portability" you mean "support Windows and Linux", then yeah, VK/GL can solve that particular problem... but if you mean "support Windows and game consoles", then VK/GL aren't very helpful 😉 D3D11 is probably the most stable GPU programming environment due to it being used by the majority of games for the last decade, so it's a great choice to use as your "primary" API if you do end up using more than one... You can also run D3D11 on Linux (Wine) via https://github.com/doitsujin/dxvk if you want.
  8. Hello, I want to know if it's good in this moment to begin to use wasm(2D game with webassembly using code C and Javascript). Because webassembly Is new and I dont know if it's compatible with all navigators. Thanks in advance.
  9. I assume you are on Windows (because of the WM_X events) and you are using some kind of Surface to test your app at? I might be wrong but from my experience Windows simulates a right-click on holding the tap, so check if your app is getting a WM_RBUTTONDOWN message instead
  10. Today
  11. RPTD

    Vulkan? OpenGL? What........?

    Huh? No engine with 64bit coordinates CPU side? I hardly belief this. I do this with my game engine and I don't think I'm unique in that department.
  12. Tom Sloper

    Inspirations

    You can talk or write all you want about any game. Commentary does not violate anyone's copyright as long as you use your own words. I'm not a lawyer, and my words are not to be construed as legal advice.
  13. Kosh Naranek

    T.P.O.R.T.

    Detailed Information: https://www.kickstarter.com/projects/1612428326/tport-a-first-person-puzzle-game
  14. Touny

    A new video

    Thank you for your response. I will be awaiting for a patreon or a similar page.
  15. I'm currently using Direct X 11 for my procedural world/MMO project. I've tried to find a freeish game engine or simply graphics engine that supports 64 bit coordinates (CPU side), but apparently there is no such animal. Right now my investment in Direct X is very small as the vast majorly of the code is straight C++ and the graphics is isolated into an interface class. However now I'm going get more into the GPU stuff and I was wondering if it would be better to switch to something else that would give the program better portability. I was leaning towards Vulkan for no other reason than it seems to be all the rage (ha, ha), but I wanted to get some opinions from folks with more GPU programming experience.
  16. Vivid3DDev

    Artist looking for team/partner!

    Hi, We are seven developers making an adventure/rpg game. It's only been in dev for a few weeks but we are making progress. We have our own domain/website with private files/forums sections.And we're looking for more members. So i'd like to see your work if you are interested. You can mail me at antonyrobwells@gmail.com if you are interested. Thanks. (We're using unity3d btw)
  17. KrisWolfe

    Taking a break

    This week was about relaxing and designing. Two games I had been waiting on came out this week that got me absorbed, Anno 1800 and Weedcraft. I'm done playing both of them, but they both had some interesting design concepts that I enjoyed. Anno 1800 has something called Expeditions. I absolutely loved the implementation of it. You would run into these events with about 2-4 options, and the options were ambiguous, without a "good" or "evil" option. You prepared for the journey with items and depending on how well prepared you are and some rolls, you succeeded or you didn't. This is similar to what I want to accomplish with Events once the rest of the game is hooked up. I want to have morally ambiguous choices that flow logically, but allow the player to have the freedom of playing how they want. Unfortunately, this means alot of design overhead, especially if you have deep trees. But I think having a shallow tree with a very wide dialog tree is important, and will allow the player replayability and also agency in their own game on choices. Which brings me to one of the design options I have. I want options that will probably get me delisted with a publisher. I really think it's important to have options that will make the player go "no way, I can DO this?" Either for shock value, or to get across that this is not your normal economy simulator, I want to set the tone from the beginning that you will have some very morally ambiguous choices for the entire game. This game is called Fraud Simulator, and one of my goals is to get accused of teaching people how to commit Fraud. The argument of course I will have is, how can you catch fraud if you don't know how to commit it? I plan to have both of these in the game. But enough of that for now, that's a long way off. The event system is not going to do much to my current systems in place, and I need to figure out how I'm going to design the scheduler. Last time, I thought I was going to create an editor for this. The problem with this, is that skills are going to need to have behavior coded in. I have no idea how to create an editor that codes behavior of skills, if that's even possible. So unfortunately, I don't think at this time I'll be able to let the player create skills. Sure, I can make some skills that give you bonuses to stats, and that's easy to code for the editor...but what about a skill that when you use it, it creates things from a recipe? What about a skill that mans the register at a store and sells to customers if they're in the store at that time? How do you allow coding of behavior that affects the game like that from an editor? So, this week I pulled up my design docs and tried to see what I could do in an editor. I don't think companies will be possible, since their behavior is so unique for each type. I can do some skills, but how I envision skills is probably going to change eventually as it is. Recipes and Goods I can absolutely put into an editor, because the game doesn't care what type of recipe or good they are, their behavior is uniform. I feel like I'm overthinking it as it is though, and I just need to get interaction with my economy running. I read up a lot of people that took 2.5 years on their game because they rewrote their code so much or started from scratch. I want to follow SOLID principles, but It's hard when you have no idea what your implementation is going to look like because I've never coded in C# before. On top of that, half of them I'm not even sure what the hell they mean. The other side of the coin is that I know for a fact that my coding is earning me code debt, and I will have to pay up when I refactor eventually. Constant debate in my head about when to start refactoring. I think I really want to start coding everything to an interface here soon. Everytime I watch an example on the SOLID principles, it's always using an interface. Sounds like that's my future. So for this week, just relaxing, catching up on Game of Thrones, checking out some actual games implementation of cool ideas, and doing some brainstorming.
  18. Hello everyone, I am an artist looking to find a long or short term game development partner or partners! I am new to the game development scene, but I've had a lot of fun in the past programming my own visual novels. I am looking for like-minded people who want to work with me on a free, or possibly paid if it's good enough, game! It doesn't have to be a visual novel, any type of game will do. If any of you need an artist, I'm open and ready for the job. I don't really have an idea for a game at the moment, I was hoping if anyone is a writer that they could come up with one and I'll do the art for it. Either that or we can come up with a game idea together. I don't have anything set in stone at the moment, besides the fact that I'm looking for a team. I've been working on art since I was in my late teens, I'm not the best artist but I try really hard; I'm also currently in university for an art degree! I mostly do anime art, but semi-realistic/cartoon styles are possible for me as well. If you want to see examples of my work, I can show you on Discord. Just send me a PM and I'll send you my username! What I'm looking for is someone who is friendly and willing to work with me. Someone who communicates well is also very important. I've tried to start projects with friends who never got back to me about their part so I'm hoping to find someone who doesn't do that... I really want to emphasize that I want to find someone who is passionate about this game we're going to make, and won't give up unless it's absolutely necessary. I want to motivate someone who motivates me to go through with our ideas! Whether you're a programmer, writer, musician, or another artist, I hope someone will get back to me soon! I'm very excited thinking about all the things we would be able to make together! Just send me a PM if you're interested. Thank you so much, this is a great community and I'm glad to finally be a part of it! - Cookie
  19. CortexDragon

    When do we need multiple FBOs?

    Are you talking about the "frame buffers" technique described in the "Hello Frame buffering" sample within the microsoft dx12 Hello world sample ? https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/Samples/Desktop/D3D12HelloWorld The same technique is also used in many later microsoft samples. A better example is the multithreaded sample, where they use a Frameobject class https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/Samples/Desktop/D3D12Multithreading The idea is you have 2 (or 3) frame objects that you rotate between, each one with its own render target, commandlists, and also its own cbchangeseveryframe cbuffer. A simple reason to do it is because commandlists can take a few frames from the time you called executecommandlists to the time they have been completed on the gpu and you want to feed it the next frames commandlist before the previous ones fence indicates it has finished. It also helps you make sure the gpu is getting the correct frames contents of cbuffers that you change every frame. If you had used the same cbchangeseveryframe cbuffer amoung all frames then you may end up updating it from the cpu before the gpu has finished doing a commandlist that is using it. This is what D3D12HelloFrameBuffering.h says " // In this sample we overload the meaning of FrameCount to mean both the maximum // number of frames that will be queued to the GPU at a time, as well as the number // of back buffers in the DXGI swap chain. For the majority of applications, this // is convenient and works well. However, there will be certain cases where an // application may want to queue up more frames than there are back buffers // available. // It should be noted that excessive buffering of frames dependent on user input // may result in noticeable latency in your app. "
  20. trill41

    Items and AI

    Items I was thinking about weapons and equipment's, which all are Items. So sooner or later some item system must be implemented. All items are stored in a database table (let's name it game_items) with a name, value, the type of the item (weapon, armor, crap...), a 3D model file (which is loaded by the client) and an optional Lua script file, because e.g. weapons are scriptable. In OOP terms the game_items table has a list of item classes. Now we just need another table with the objects, because when an item drops for a player and the player picks it up, the player doesn't want that this item disappears, so it must be stored in the database. Let's name this table concrete_items. This table contains what item it is (so the primary key of the item in the game_items table), where it is stored, to which player it belongs, item stats (like damage for weapons), and some other information like creation time, value etc. Drops When NPCs die, they may or may not drop a random item. Each item has a certain chance to drop on a certain map. This requires another database table which associates an item with a map and a chance to drop on this map. Selecting a random item from a pool of items that may drop on the current map isn't really hard, there are algorithms that do that, like WalkerMethod which is O(1), or my adaption of it. Items drop for certain players, other players can not pickup an item dropped for a different player. When an NPC dies and it drops an item, an item is picked from the item pool and a new concrete item is created and inserted into the database with random stats. A random player is selected from the party that killed the NPC and this new item drops for this player. If a player picks up an item, it is added the the players inventory. Technically just the storage place of the concrete item is changed from Scene to Inventory. AI First I thought I'll make a PvP only game because then I don't need to mess around with game AI, but I realized even PvP games need some NPCs that have some kind of AI. Then I came across a behavior tree library (SimpleAI) that seemed to be a nice fit. It was really easy to integrate this library into the game server. ai::Zone A Game instance has a Map object with the terrain, navigation mesh, the octree and now an ai::Zone object. ai::ICharacter and ai::AI The class hierarchy of game objects looks a bit like this. SimpleAI controls the NPC via the ai::ICharacter class. The NPC class could just inherit also from the ai::ICharacter class, but I try to avoid multiple inheritance where I can, so the NPC class has a ai::ICharacter member. Then the NPC has an ai::AI object which has the behavior and does all the "intelligent" stuff. Behaviors Behaviors are defined with simple Lua scripts, e.g.: -- Try to stay alive function stayAlive(parentnode) -- Executes all the connected children in the order they were added (no matter what -- the TreeNodeStatus of the previous child was). local parallel = parentnode:addNode("Parallel", "stayalive") parallel:setCondition("IsSelfHealthLow") parallel:addNode("HealSelf", "healself") -- TODO: Flee end -- Heal an ally function healAlly(parentnode) local parallel = parentnode:addNode("Parallel", "healally") parallel:setCondition("And(IsAllyHealthLow,Filter(SelectLowHealth))") parallel:addNode("HealOther", "healother") end -- Do nothing function idle(parentnode) -- This node tries to execute all the attached children until one succeeds. This composite only -- fails if all children failed, too. local prio = parentnode:addNode("PrioritySelector", "idle") prio:addNode("Idle{1000}", "idle1000") end function initPriest() local name = "PRIEST" local rootNode = AI.createTree(name):createRoot("PrioritySelector", name) stayAlive(rootNode) healAlly(rootNode) -- ... idle(rootNode) end So now we have a behavior with the name "PRIEST" and all NPCs with this behavior try to stay alive, heal an ally or do nothing. Conditions, Filters and Actions Of course the IsSelfHealthLow is not part of SimpleAI (although it already comes with a set of Conditions, Filters and Actions). The IsSelfHealthLow condition just checks if the health points of the NPC is under some threshold: class IsSelfHealthLow : public ai::ICondition { public: CONDITION_CLASS(IsSelfHealthLow) CONDITION_FACTORY(IsSelfHealthLow) bool evaluate(const ai::AIPtr& entity) override { const ai::Zone* zone = entity->getZone(); if (zone == nullptr) return false; const AiCharacter& chr = entity->getCharacterCast<AiCharacter>(); const auto& npc = chr.GetNpc(); if (npc.IsDead()) // Too late return false; return npc.resourceComp_.GetHealthRatio() < LOW_HP_THRESHOLD; } }; If now IsSelfHealthLow::evaluate() evaluated to true it executes the action HealSelf which is again a C++ class. It tries to find a skill that do some self healing, and uses it. For just staying alive, no Filters are needed, but for a Priest that may also heal others, Filters are need to select those Allies with low health points. Such a Filter class could look like this: void SelectLowHealth::filter(const ai::AIPtr& entity) { ai::FilteredEntities& entities = getFilteredEntities(entity); Game::Npc& chr = getNpc(entity); std::map<uint32_t, std::pair<float, float>> sorting; chr.VisitAlliesInRange(Game::Ranges::Aggro, [&](const Game::Actor* o) { if (o->resourceComp_.GetHealthRatio() < LOW_HP_THRESHOLD) { entities.push_back(o->id_); sorting[o->id_] = std::make_pair<float, float>(o->resourceComp_.GetHealthRatio(), o->GetDistance(&chr)); } }); std::sort(entities.begin(), entities.end(), [&sorting](int i, int j) { const std::pair<float, float>& p1 = sorting[i]; const std::pair<float, float>& p2 = sorting[j]; if (fabs(p1.first - p2.first) < 0.05) // If same HP (max 5% difference) use shorter distance return p1.second < p2.second; return p1.first < p2.first; }); } Now the HealOther class can get the filtered entities (which is just a std::vector<uint32_t> containing the IDs of the allies with low health points sorted by priority), and use some heal skill on that target. Conclusion SimpleAI is a great library, it is easy to integrate, easy to use and easy to configure, and as far as I can see now, it just works.
  21. Hello all. I'm newbie on this forum and my english not very good. Sorry >< I created a volumetric lighting with a shadow for my water. Right now I need to compute a max height relative to the water (like a volume water depth). So, I have only screen space uv and 4 clip space vertexes (graphics.blit of unity3d). How I can reproduce the water vertex world space position? My water always is horizontal. Like in this screen. I have one bad idea, but I don't like it. I can render the water depth to texture and use this depth for reconstruct world space position in the lighting post effect. Also, I can reuse this water depth for manual writing to unity depth buffer (for correct depth of field posteffect). Also, it's only way to write to depth texture with transparent geometry. I tried work with a matrix transformations of space (posteffect quad -> world space quad -> transform this quad using TRS (model) matrix of water -> view -> projectrive -> clip), but it does not work for me. Any idea?
  22. Rich Brighton

    Inspirations

    In a few weeks time, once I've upgraded my code to Scala 2.13 and I've sorted out my tooling story, I want to make a serious push to find collaborators. The natural way for me to begin that would be to start by describing both the old board games from decades ago and the video games that I have enjoyed playing. Ideally with a bit of a critique of what I liked and disliked. This is to help others identify if they share my passion for certain types of games. But also to explain why I feel there is an area of the video game design space that has been barely explored. Is this a legal no-no? Does it open myself and any future collaborators to being sued for copy right? I feel totally confident from a moral perspective that I'm not stealing anyone's hard work. In algorithmic terms, I actually find very little of use in the games I have played over the decades
  23. AtomicBrain

    Just Move

    Hi all. This is a small little arcade game that I have been working on for the past 6 months. Move the ball behind your finger and avoid obstacles. The speed of obstacles gradually increases, slowdown them with simple movements of a finger. Collect coins and discover new ball styles. More coins - more styles! Compete with friends: check whose finger is faster! Link: https://play.google.com/store/apps/details?id=com.Brain.JustMove Gameplay video: YouTube
  24. GoliathForge

    GC : Explosive Balls (game state)

    It turns out the pixel api thing has some neat extension headers dealing with sprite transforms. The 'engine' has static access so the necessity to pass an engine pointer to draw above can be refactored out. What these tools don't have is sprite animation. I'm happy for this. Don't try to do everything, do that put pixel thing you do and do it well. Modulate this... LOL...I'm on it.
  25. WrenchCrowbar

    'Neuronica' Space shooter: asking for your feedback.

    Hi Lorenzo, A fair point indeed. We will see if we can release some updated weaponry etc in a future update. Kind regards, Wrench
  26. In order to stay out of trouble, I'm going back to work. Previous Blog Entry Today's topic is my drop in game state manager system for moving between game screens such as an introduction sequence, main menu hierarchy, game play and first say on app termination. I don't remember where I initially found this gem because it has been quite a number of years that I've been reusing this. The concept is simple though. Manage screens as a stack. Push a screen pointer to the back to become active and pop to activate the previous. So how do we get a system like this up and running? The following are sloppy source grab copies. Two objects start us out, First a manager and an abstract base class. From the abstract, we derive the game screen objects. Each screen object handles their own behavior not knowing anything about the others. // file : GameState.cpp #include "olcPixelGameEngine.h" // <-- yours will be different #include "GameState.h" #include "States/intro.h" #include "States/game.h" #include "States/menu.h" using namespace Core; std::shared_ptr<States::Intro> introState; std::shared_ptr<States::Menu> menuState; std::shared_ptr<States::Game> gameState; void StateManager::initialize(olc::PixelGameEngine* engine, vec2 clientSize) { this->engine = engine; introState = std::make_shared<States::Intro>(this, clientSize); menuState = std::make_shared<States::Menu>(this, clientSize); gameState = std::make_shared<States::Game>(this, clientSize); states.push_back(menuState); #ifdef _RELEASE states.push_back(introState); #endif } void StateManager::shutdown() { introState->shutdown(); menuState->shutdown(); gameState->shutdown(); } void StateManager::changeState(States::Base_state* _state) {} void StateManager::pushState(States::Base_state* _state) {} void StateManager::popState() { states.pop_back(); } void StateManager::handleEvents(eStateAction _action) { switch (_action) { case eStateAction::pause: if (states.back()->name == "game_state") states.pop_back(); break; case eStateAction::play: if (states.back()->name == "menu_state") { int w = engine->GetDrawTargetWidth(); int h = engine->GetDrawTargetHeight(); RECT rect = { 0, 0, w, h }; // <-- I know --^ states.push_back(gameState); } break; case eStateAction::win: if (states.back()->name == "game_state") { MessageBox(0, "you win", "", 0); //winState->winnerName = gameState->getWinnerName(); //winState->winningTime = gameState->getTimeString(); //states.push_back(winState); } break; case eStateAction::loose: if (states.back()->name == "game_state") { MessageBox(0, "you loose", "", 0); //states.push_back(scoreState); } break; case eStateAction::quit: if (states.back()->name == "menu_state") PostQuitMessage(0); if (states.back()->name == "game_state") { ::ShowCursor(true); // umm, you're counting me aren't you ::ClipCursor(nullptr); states.pop_back(); } if (states.back()->name == "score_state") states.pop_back(); if (states.back()->name == "win_state") { // todo : record score gameState->reset(); states.pop_back(); } break; } // end switch(action) } void StateManager::update(float deltaTime) { states.back()->update(deltaTime); } void StateManager::draw() { states.back()->draw(); } With the manager out of the way, the base class for the stack-able objects. // file : base_state.h #ifndef _engine_core_states_base_state_h_ #define _engine_core_states_base_state_h_ #include <olcpixelgameengine.h> #include <string> namespace Core { namespace States { // abstract class Base_state { public: Base_state(void* _manager, std::string _name, vec2 _clientSize) { pManager = _manager; name = _name; clientSize = _clientSize; } virtual void initialize() = 0; virtual void shutdown() = 0; virtual void pause() = 0; virtual void resume() = 0; virtual void handleEvents() = 0; virtual void update(float _deltaTime) = 0; virtual void draw() = 0;s void* pManager; // que sara sara std::string name; // todo : refactor string to numeric id? :) vec2 clientSize; protected: Base_state() { /* empty constructor */ } }; } } #endif Correct me if I'm wrong (please) but of all the reasons to use polymorphism, this case is one of the better (subtyping). To be able to keep like items that are different in a common container. The derived class header would be as expected. Base class overloads in place plus specific functions and variables that would be required to make the new object behave as it will. Nothing new. I'll admit, I'm trapped in the common cycle that most online tutorials mold where the loop is divided into update / draw / check state / repeat. Is it correct? <shrug> So all this may be familiar and you hate it, or it's new and reader be cautious. The basic take away here is the stack concept. On the main loop side, we declare a Core::StateManager instance and initialize. During the loop, update and draw calls to the manager fire. I feel I don't need to list any additional modules but will list an example derived menu class. #include "menu.h" #include "../GameState.h" using namespace Core::States; void Menu::initialize() { rectPlay = { 360, 140, 440, 160 }; // 80 x 20 rectQuit = { 360, 165, 440, 185 }; // need more data or buttons are a known size } void Menu::shutdown() {} void Menu::pause() {} void Menu::resume() {} void Menu::handleEvents() {} void Menu::update(float _deltaTime) { } //template<typename ... Args> //std::string string_format(const std::string& format, Args ... args) //{ // size_t size = snprintf(nullptr, 0, format.c_str(), args ...) + 1; // Extra space for '\0' // std::unique_ptr<char[]> buf(new char[size]); // snprintf(buf.get(), size, format.c_str(), args ...); // return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside //} void Menu::draw() { olc::Pixel colorDefault = olc::Pixel(255, 255, 255); olc::Pixel colorHover = olc::Pixel(255, 255, 0); // _ // .--- todo : don't like handling user input inside a draw routine...fix me ----. \_(O,O)_ // V V ~ \ // ------------------- Game Menu ------------------------- Core::StateManager* manager = (StateManager*)pManager; olc::PixelGameEngine* e = manager->engine; POINT cursorPos; cursorPos.x = manager->engine->GetMouseX(); cursorPos.y = manager->engine->GetMouseY(); e->DrawRect(rectPlay.left, rectPlay.top, rectPlay.right - rectPlay.left, rectPlay.bottom - rectPlay.top); e->DrawRect(rectQuit.left, rectQuit.top, rectQuit.right - rectQuit.left, rectQuit.bottom - rectQuit.top); std::string cursorInfo = "CursorPos "; char buf[16] = ""; //string_format(cursorInfo, "Cursor Pos");// { %d, %d }", cursorPos.x, cursorPos.y); //manager->engine->DrawString(10, 20, cursorInfo); _itoa_s(int(cursorPos.x), buf, 10); e->DrawString(20, 20, std::string(buf)); _itoa_s(int(cursorPos.y), buf, 10); e->DrawString(70, 20, std::string(buf)); vec2 textOffset = { 25.f, 6.f }; int x = int(rectPlay.left + textOffset.x); int y = int(rectPlay.top + textOffset.y); // Play ------------------------------------------------- olc::Pixel textColor = colorDefault; if (::PtInRect(&rectPlay, cursorPos)) { textColor = colorHover; if(e->GetMouse(0).bPressed) manager->handleEvents(Core::eStateAction::play); } e->DrawString(x, y, "Play", textColor); // Quit -------------------------------------------------- x = int(rectQuit.left + textOffset.x); y = int(rectQuit.top + textOffset.y); textColor = colorDefault; if (::PtInRect(&rectQuit, cursorPos)) { textColor = colorHover; if(manager->engine->GetMouse(0).bPressed) { if (MessageBox(nullptr, "Are you sure you want to quit?", "Serious?", MB_YESNO) == IDYES) exit(0); } } manager->engine->DrawString(x, y, "Quit", textColor); } The game screen state would be similar but behave as what the main game play would be. Every valid screen pointer lives the life of the application but only the one at the back of the stack is active at a given time. This has served me well for adding game state transitions in custom work. Input and drawing are engine responsibilities so there is a member pointer to contend with in the manager. Perhaps not the best approach, but I don't know of alternatives other than a hard global or worse, singleton. But a subclass gets this functionality through the manager held engine pointer. Crappy note to end on perhaps, but that's where I am. It works, I called it good and have been reusing a number of times. Tips from the leet are always appreciated assuming my words are better than a hodgepodge of nonsense.
  1. Load more activity
  • 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!