Jump to content

Willicious

Members
  • Content Count

    125
  • Joined

  • Last visited

  • Days Won

    1

Willicious last won the day on May 29

Willicious had the most liked content!

Community Reputation

8 Neutral

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

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

  1. Willicious

    MAP2PDB - Profiling with VTune

    Thanks 🙂
  2. Willicious

    MAP2PDB - Profiling with VTune

    Replying again because I forgot to notify
  3. Willicious

    MAP2PDB - Profiling with VTune

    Hi, can anyone help me make sense of the following: In RAD 10.4.2, where can I find project linker options? And, do these expressly give the option to "output a detailed map file"? As in, from a command line? From within RAD? Do I need to type exactly what's here, or replace with a specific filename? So, I'm guessing this is done by running VTune whilst the application is running? Perhaps the other two steps are what link the project, so... all I need to do is run VTune? Oh, also - how can I get VTune?
  4. Willicious

    How to debug a Not Responding program element

    I'm not sure exactly how to do this. It was my (and, from what you've been saying, your) understanding that the program already did cache the loaded info, but it turns out it doesn't (at least not to any noticeable extent). I think it has to reload everything even in the same session (i.e. with SLX still open, but Level Select being closed and then re-opened).
  5. Willicious

    How to debug a Not Responding program element

    OK... I went ahead and: 1) Merged LoadIcons and LoadNodeLabels into InitializeTreeview 2) Removed the call to LoadNodeLabels in SetInfo 3) Moved the call to LoadIcons to DisplayLevelInfo (still called via SetInfo, but at least it's now in the right place!) 4) Removed the OnExpanded event handler And WOW! The difference is night and day. It takes much longer to load the Level Select initially (expected, and I'll do a progress bar for that), but once open it's super snappy and responsive, and doesn't bug out when switching between packs any more 🎉 Thanks for your help in narrowing down what was causing the delays. I clearly need to install VTune (is there a free/budget version?) as that displays exactly what's causing the delays very clearly, so it will no doubt come in very handy for other features of the program. The only thing I'd probably say is that it might be somewhat frustrating to use the slower-loading Level Select when only wanting to switch quickly between levels (e.g. for testing purposes). It might be worth doing a "Quick Select" version which only displays the treeview and nothing else; this would likely be the default. Then, a button for "Show Level Info" could go ahead and load the full version. I'll see what the feedback is after releasing this slower-loading but quicker-interfacing version of the Level Select. I'd say that pretty much wraps up this topic as resolved, but it would be good to continue the discussion around general optimization. Can the admins split the posts regarding range & overflow checking into a new topic? Happy to continue that discussion here if not. ---------------------- EDIT: After playing around with it for a bit, I think the (much!) slower loading time is too much of a cost for the slightly snappier treeview. Clicking into Level Select is done quite a lot, especially for testing purposes, and it gets old quick; I can see why it was set up the way it is (i.e. loading node labels only when actually needed). There may be other opportunities for optimization though; I'll take a look at the VTune diagram and see what's possible. Also, I've learned a ton via this thread, so thank you again!
  6. Willicious

    How to debug a Not Responding program element

    From what I can tell, none of the loading is done from the level select treeview. It's all done in LemLevel and LemNeoLevelPack and then the parsed data is merely accessed from LevelSelect. But, if that's the case, then what's causing the slow response times? It's very difficult to narrow it down to any one particular thing without guidance, hence this thread. EDIT: It's possible that, by accessing the data from LevelSelect, that causes it to be parsed in LemLevel. I'm not sure which way around it is.
  7. Willicious

    How to debug a Not Responding program element

    Yeah, it's not always the best resource for programming, but it can sometimes help with quick solutions (e.g. syntax errors) and can actually help with what you're suggesting (i.e. breaking a block of code down to analyze what it does). It absolutely still requires basic knowledge to be able to make good use of its output though. I'm not a complete beginner by now, and I do understand way more about how things work than I did this time last year (for example, I know the difference between functions, methods, variables, constants, types, classes, and what these are all for). I made my first enum type a couple of weeks ago, for example, and it was satisfying to get it right and have it optimise the code I was working on. That was done with the guidance of another programmer as well. I've been very lucky to have lots of help, and I hope I can one day provide the same for someone else. I generally do take this approach. It's more difficult with some things than others. For range check errors, from what I understand it's if something falls outside the specified bounds, for example: (i = 1 to 10) If I then somehow = 11, that would cause a range check error...?
  8. Willicious

    How to debug a Not Responding program element

    OK, thanks. It's good to have that confirmed. I'll look at ways to cache the data for later quick loading. The data that can be changed whilst the same instance of the Level Select dialog is open is level records and talisman completion data, which is all user-specific and parsed from a single text file, so this shouldn't be too problematic to re-load on the fly, as long as the actual baseline pack/level info itself is pre-loaded. When you say "optimisations in place that would prevent this from working", what do you mean by "this"? Fair question. The answer is simply because it will likely take me many months to bring the alternative UI into some semblance of usability. I'll need to learn how to load fonts and display them at the correct size for the size of the Window (or load the letters as bitmaps, and then have to increase the size of the base window so that the font can be more hi-res). Along with many other challenges, of course. So, I'd like to optiise the existing Level Select dialog in the meantime. That way, it's better sooner, and if the challenges of a brand new screen prove to be too large, I'll at least know more about how the existing one works and what I can do to optimise it. Also, I'd like to know how to cache info anyway; it may come in useful for other program elements. I'll add an option to the config menu to clear program cache, and make sure to clear it when a new copy is installed. I need to learn how to do it, though.
  9. Willicious

    How to debug a Not Responding program element

    A Google search for "integer overflow delphi" brought up the answer of using data types that are large enough to contain all values that may possibly be computed and stored in them, and a few responses suggested Int64. ChatGPT seemed to confirm this by suggesting that I change all integer types in the FadeOut procedure to Int64 instead. I went ahead and made this change, and still got the integer overflow error. So, I then applied the fix suggested by Kas Ob. (this one:) if GetTickCount > EndTickCount then // prevent integer overflow Break; And, this fixed the error. So, congratulation Kas Ob! What this has done is confirm to me that asking a person, and giving my specific case, is vastly more preferable to generic Googling and even using AI tools. How can I possibly have known that this would fix the issue? The best developer tools on the planet didn't even help solve the problem. In the end, it took a more experienced programmer applying their existing knowledge to the specific issue I was encountering. As a hobbyist with limited time to spend programming, how can I acquire that knowledge? We now have a range check error. Again, I tried googling "range check error delphi" and asking ChatGPT for a solution, neither has produced anything which fixes the issue: procedure TRenderer.ApplyRemovedTerrain(X, Y, W, H: Integer); var PhysicsArrPtr, TerrLayerArrPtr: PColor32Array; cx, cy: Integer; MapWidth: Integer; // Width of the total PhysicsMap begin // This has two applications: // - Removing all non-solid pixels from rlTerrain (possibly created by blending) // - Removed pixels from PhysicsMap copied to rlTerrain (called when applying a mask from LemGame via RenderInterface) PhysicsArrPtr := PhysicsMap.Bits; TerrLayerArrPtr := fLayers[rlTerrain].Bits; MapWidth := PhysicsMap.Width; for cy := Y to (Y+H-1) do begin if cy < 0 then Continue; if cy >= PhysicsMap.Height then Break; for cx := X to (X+W-1) do begin if cx < 0 then Continue; if cx >= MapWidth then Break; if PhysicsArrPtr[cy * MapWidth + cx] and PM_SOLID = 0 then begin if GameParams.HighResolution then begin TerrLayerArrPtr[(cy * MapWidth * 4) + (cx * 2)] := 0; TerrLayerArrPtr[(cy * MapWidth * 4) + (cx * 2) + 1] := 0; <---------------------- this line here TerrLayerArrPtr[((cy * 2) + 1) * (MapWidth * 2) + (cx * 2)] := 0; TerrLayerArrPtr[((cy * 2) + 1) * (MapWidth * 2) + (cx * 2) + 1] := 0; end else TerrLayerArrPtr[cy * MapWidth + cx] := 0; end; end; end; end; My question here would be: what exactly should I be Googling for, and how will I know if what I've found is helpful? If the answer is: "by testing out every single possible thing I find from a generic Google search", that's not exactly encouraging. Stack Overflow, in particular, is full of unspecific answers which usually require an existing level of knowledge and experience to understand in the first place, let alone put into practice for testing. Don't get me wrong, I've been using Google searches, this Forum and various AI tools over the past year to get to where I am now with SuperLemmix, so I can absolutely use these resources effectively, up to a point. When it comes to not actually knowing what I'm supposed to be searching for, or how to know whether the answer is at least relevant if not also correct, this is where I probably need a bit more specific help/mentoring. I've considered paying for lessons many times, because ultimately these are the biggest barriers to progress.
  10. Willicious

    How to debug a Not Responding program element

    Yes, let's get the thread back on track. The main thing I need help with here is fixing the slow-responding level select menu & treeview - the fixes that have been applied so far have helped for sure, but haven't eliminated the slow response times. I'm considering adding a progress bar, but if I do this then I'd want to load all information to the treeview at the start, rather than adding some when nodes are clicked. Node clicking should, then, access pre-loaded info (if this is at all possible). Please bear in mind, those that have offered suggestions so far, that I need step-by-step instructions if possible. If you say something like "just use a 3rd party treeview", that means nothing to me without instructions as to where to get it and how to intregrate it into the project. I understand that not everyone has time to type out instructions to a newbie though, so... it's fine if you don't, but chances are I probably won't get around to implementing your suggestion. Regarding general optimization though, it'd be nice to get some help with what to do with Overflow & Range checks. At present, they show a popup and point to a code area (this is great!), but I don't really know what to do from there.
  11. Willicious

    How to debug a Not Responding program element

    Thanks for the fix, I applied it and it fixed both of the leaks! I likely wouldn't have spotted this either, because on the surface it did originally appear to be the case that the cursors were being freed correctly. I also enabled Overflow and Range checking; so far, this Integer overflow is reported: procedure TGameBaseScreen.FadeOut; var RemainingTime: integer; OldRemainingTime: integer; EndTickCount: Cardinal; const MAX_TIME = 320; // mS begin EndTickCount := GetTickCount + MAX_TIME; OldRemainingTime := 0; RemainingTime := MAX_TIME; ScreenImg.Bitmap.DrawMode := dmBlend; // So MasterAlpha is used to draw the bitmap while (RemainingTime >= 0) do begin if (RemainingTime <> OldRemainingTime) then begin ScreenImg.Bitmap.MasterAlpha := MulDiv(255, RemainingTime, MAX_TIME); ScreenImg.Update; OldRemainingTime := RemainingTime; end else Sleep(1); RemainingTime := EndTickCount - GetTickCount; <--------------------------------------- this line here end; Application.ProcessMessages; end;
  12. Willicious

    How to debug a Not Responding program element

    Here are the screenshots as promised. This is graph & threads on opening the app: And then again a few mins later after loading and playing a level: 2 more memory leaks after playing, these I'll try to fix using the same method as msohn: Ignore this one, added it by accident and for some reason the site won't let me delete it:
  13. Willicious

    How to debug a Not Responding program element

    That's Lemmix, the original program. There has been NeoLemmix and now SuperLemmix since then. You can get the SuperLemmix source code here (it builds in RAD 10.4, not sure about later versions): https://github.com/Willicious/SuperLemmixPlayer I'll take another look at PE later today, thanks again for your help and advice.
  14. Willicious

    How to debug a Not Responding program element

    Whenever people say anything like this, I have to think: when will it not be too advanced for me? It's either advanced or it isn't. I'm either up to the challenge or I'm not. I'll only know if I go ahead and try it. With that said, allow me to be the first to admit that I am definitely no more than a novice programmer at best, my interest and experience in it is all from a hobbyist point of view. But, take a look at what I've achieved with SuperLemmix over the past year. You might be surprised at what a beginner is capable of given enough determination and some strong goals!
  15. Willicious

    How to debug a Not Responding program element

    As an aside, I'm looking at possibly implementing a totally new level select screen which is based on the same look and feel of the existing menu screens. Here's a mockup. This is dreamland at the moment, I only have vague ideas of how I might go about this (and I'd still need to solve the problem of parsing level info): (The row of text "buttons" along the bottom would change according to whether a pack or a level is selected - it wouldn't display both rows at the same time). Also, please excuse the haphazard layout, it's really a basic mockup at the moment.
×