Giter Club home page Giter Club logo

Comments (16)

flibitijibibo avatar flibitijibibo commented on June 24, 2024 3

Right, it's basically just critical bugfixes and very minor accessibility features from here on out. (Maybe making controller support a little better too?)

from vvvvvv.

flibitijibibo avatar flibitijibibo commented on June 24, 2024 3

Pretty much all the large variables are off the stack now - if someone on Win64 finds an overflow they can reopen this, otherwise I think this is covered.

from vvvvvv.

InfoTeddy avatar InfoTeddy commented on June 24, 2024 2

Flibit's comments are a bit outdated now. #129 made it so that the core classes are now allocated outside of any function, which should mean they're no longer on the stack. Furthermore, #188 got rid of all the reference passing entirely.

from vvvvvv.

InfoTeddy avatar InfoTeddy commented on June 24, 2024 2

All that's being done now is waiting for the original author (or anyone who has had this problem happen to them before) to report back and say "Yes, this is fixed now" or "No, it's still a problem".

from vvvvvv.

0x08088405 avatar 0x08088405 commented on June 24, 2024

Could be related to how main apparently uses over 16kB of stack...
C6262: Function uses '17264' bytes of stack: exceeds /analyze:stacksize '16384'. Consider moving some data to heap.

from vvvvvv.

flibitijibibo avatar flibitijibibo commented on June 24, 2024

I suppose this only happens with Win64? I don’t see this with Win32, Linux, or macOS.

from vvvvvv.

flibitijibibo avatar flibitijibibo commented on June 24, 2024

You may have to add something like this to the Win32 portion of the CMake exe line:

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:???")

Not sure what a good value would be.

from vvvvvv.

JayFoxRox avatar JayFoxRox commented on June 24, 2024

The game does appear to use a surprising amount of stack. It's something that should be looked at.

Currently, the main() function keeps most game and asset related objects on the stack (which I assume to be pretty large in size), namely this block in main():

UtilityClass help;
// Load Ini
Graphics graphics;
musicclass music;
Game game;

I assume this was done because these classes depend on some libraries already being initialized.

Some other game objects are in the data section (outside of any function):

scriptclass script;
edentities edentity[3000];
editorclass ed;

from vvvvvv.

TijmenUU avatar TijmenUU commented on June 24, 2024

The game does appear to use a surprising amount of stack. It's something that should be looked at.

Currently, the main() function keeps most game and asset related objects on the stack (which I assume to be pretty large in size), namely this block in main():

UtilityClass help;
// Load Ini
Graphics graphics;
musicclass music;
Game game;

I assume this was done because these classes depend on some libraries already being initialized.

Some other game objects are in the data section (outside of any function):

scriptclass script;
edentities edentity[3000];
editorclass ed;

It's probably the array allocations you speak of later as there are no big stack allocations in the Graphics or musicclass as far as I can see. The large size objects are stored into std::vectors. Likewise for the strings std::string is used.

Perhaps the incredible amount of member fields used in these classes eventually add up too...

It could probably help getting rid of these array allocations and simply create an std::vector<T> of the desired size or just malloc it instead if you really want your raw pointers.

from vvvvvv.

flibitijibibo avatar flibitijibibo commented on June 24, 2024

I'd be up for one of two paths:

  • Get all the core classes allocated with new instead of just having them on the stack. This is way easier said than done, as the game uses those classes absolutely everywhere, and they're passed by reference so you can't just fix the .->-> in one function and call it a day. This is by far the most work you can do here, and doing it for individual members of the classes would be even worse.
  • Increase the stack size on Windows at link time. This is what I'm leaning towards, since every other platform I'm aware of has a MUCH bigger default stack size (except for one secret platform that can also fix this trivially), so doing a whole bunch of potentially breaking work for Win64 and only Win64 just seems like a bad idea.

from vvvvvv.

TijmenUU avatar TijmenUU commented on June 24, 2024

I'd be up for one of two paths:

* Get all the core classes allocated with `new` instead of just having them on the stack. This is _way_ easier said than done, as the game uses those classes absolutely _everywhere_, and they're passed by reference so you can't just fix the `.`->`->` in one function and call it a day. This is by far the most work you can do here, and doing it for individual members of the classes would be even worse.

* Increase the stack size on Windows at link time. This is what I'm leaning towards, since every other platform I'm aware of has a MUCH bigger default stack size (except for one secret platform that can also fix this trivially), so doing a whole bunch of potentially breaking work for Win64 and _only_ Win64 just seems like a bad idea.

I'd say the latter is definitely the better option then, given that vvvvvv isn't going to get major additions to it in the future?

from vvvvvv.

parkerlreed avatar parkerlreed commented on June 24, 2024

@flibitijibibo Yeah. Submitted an issue for that. #82

Including the built in SDL2 gamepad databaase and updating the button defs in Input.cpp may be all that's needed for updated support. I've been trying my hand locally but no luck as of yet.

from vvvvvv.

flibitijibibo avatar flibitijibibo commented on June 24, 2024

Just pushed a patch that moves the memory around quite a bit, does this still happen?

from vvvvvv.

dekrain avatar dekrain commented on June 24, 2024
  • Get all the core classes allocated with new instead of just having them on the stack. This is way easier said than done, as the game uses those classes absolutely everywhere, and they're passed by reference so you can't just fix the .->-> in one function and call it a day. This is by far the most work you can do here, and doing it for individual members of the classes would be even worse.

You can use std::unique_ptr instead of raw pointers and, since every function requires a reference, just pass the reference func(*obj_ptr) or even make a handle reference T& obj_ref = *obj_ptr (obj_ptr being std::unique_ptr<T> or T*)

from vvvvvv.

0x08088405 avatar 0x08088405 commented on June 24, 2024

You can use std::unique_ptr instead of raw pointers

The target for this repo is pre C++11 so you can't, no

from vvvvvv.

InfoTeddy avatar InfoTeddy commented on June 24, 2024

Honestly, at this point the issue should be more-or-less fixed. I'd check for myself, but getting a compiling environment set up on Windows is more annoying than it is on Linux, so I don't have the patience for it right now. (Also, I'd need to compile an initial commit build, check that it stack overflows, and if it doesn't figure out why, and then compile a latest commit build with the same settings. I predict I'll have trouble with the "get the initial commit to stack overflow" part in the first place.)

I'd be very surprised if this was still a problem.

from vvvvvv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.