Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Green Gandalf's coding exercises and oddities thread

Author
Message
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Jul 2017 19:07
With luck, this thread will develop into a series of intriguing coding oddities to keep DBPro coders, both new and seasoned, amused.

Here's my first offering:

Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 6th Jul 2017 03:33

WELLLLLL...... admittedly, I didn't get the point, or the gist, or have any clue as to the meaning... then again, I have this altered state thing going on. Do I earn any points for just showing up?
Send your parents to noisy sprite demo hell... enter the D-Zone
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Jul 2017 06:37
An oddity i noticed a while back when building a file browser. Dbpro sometimes fails to execute a change directory unless its called twice or something that can momentary put a load on the program like a small loop or number crunch
A child's dream never dies.





Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Jul 2017 11:26 Edited at: 6th Jul 2017 11:27
Quote: " Do I earn any points for just showing up?"


Yes you do. And here they are:



I'll wait a little while longer in case anyone else wants to comment. I should have added that I'm using Rudolpho's excellent DBPro9Ex version of DBPro. No idea whether that makes a difference at the moment.

(Hint) Just to clarify, what sequence of output did you see when you performed Step 2? When I run it I notice something rather weird when I compare the output with the code.

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Jul 2017 11:37
Quote: " Dbpro sometimes fails to execute a change directory unless its called twice or something that can momentary put a load on the program like a small loop or number crunch"


Can you provide a simple code example? Sounds like a bit of an unhelpful feature to me.

I've often noticed something which may be related on my laptop: if I delete a file using File Explorer then the displayed list of files often doesn't update immediately. This can lead to thoughts such as: "I'm sure I just deleted that" (that's the family friendly version ). I've now got into the habit of hitting the File Explorer refresh button whenever I delete something. Tedious perhaps, but it does avoid confusion.
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 6th Jul 2017 13:48 Edited at: 6th Jul 2017 13:51
i don't want to be the party pooper here, but ...
Green Gandalf wrote: "When I run it I notice something rather weird when I compare the output with the code."

different compiler versions can come to different results. for me, the output from step 1 and step 2 is the same (with the difference of the cls of course).
most of the users on this forum may not get that "strange result" that you get.

if i did not miss anything:



or did i miss the point entirely?



EDIT: talking about oddities, the spoiler tag does not work...
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 6th Jul 2017 17:04
I didn't see anything interesting.



I have an intel laptop and an AMD desktop and I have had issues before with code doing different things on either computer.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Jul 2017 23:00 Edited at: 6th Jul 2017 23:01
@Mage and zero32 Which version of DBPro are you using? I'm using Rudolpho's DBPro9Ex. It should have occurred to me before my original post that this could be the real issue here.

For the record what I see is the following sequence of screens, i.e. S1, S2, S3 followed by S4, when I run the version without cls:



With cls included I get the same as Mage.

Attachments

Login to view attachments
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 7th Jul 2017 07:23 Edited at: 7th Jul 2017 07:31
i work with the U7.6, in the DBPCompiler.exe properties it says the file version is 1.0.0.5
i had problems working on different compiler versions before. on one version i could use dots in function names, on another i could not (which could have been an issue with the IDE). also there was a time where recursion did not work, which does now on U7.6.

for the sake of this thread, another "oddity":
(i think that has much to do with the problem CumQuaT had)



while i was making an example code for an oddity (step 1,2 and 3), i found another oddity (in step 3 and i made step 4). that's dark basic
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Jul 2017 12:03
Nice one. Maximum points for that submission.

I thought that the explanation for the disappearing/reappearing text in Step 2 of my first example had something to do with double buffering. But yours completely baffles me.
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 7th Jul 2017 13:44
my own attempt at explaining my post. it's more an assumption than a real explaination and not complete:

SPOILER
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 7th Jul 2017 16:03
Using latest official CD installed release of DBPro. 7.7 i believe.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Jul 2017 16:41
Interesting explanation.

Here's a simple demo of the slight superiority of the for/next loop - just follow the prompts:

Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 7th Jul 2017 19:03 Edited at: 7th Jul 2017 19:07
Sorry I don't really want to turn this into a horror stories thread. I know the focus is on providing little demo codes.
I wanna just say though that there are a lot of commands and things that I've seen people use over the years even in the early years like 2002 that people don't really use much or don't really get used in large projects as often as one might think. I kind of realize now what happens is people will make a small program and the bug will derail it and they just abandon it rather than report the issue as a bug.

For example I decided to make a bitmap font system with changeable font, colour, size, etc.
https://forum.thegamecreators.com/thread/207584
Well it turns out that, one of either, creating or scaling a sprite resets the UV coords on all other loaded sprites. So I'd have a master image with all the numbers/letters/symbols and the various bitmap font sprites would be set to pieces of it, then load an unrelated sprite somewhere else in the program and suddenly all the text is scrambled.
SET SPRITE TEXTURE COORD Maybe I will look into converting it to Image Kit or Advanced 2D.

I'm just saying that this gives me the impression that people really don't really make deep use of sprites beyond say, paste/scale/create/delete/hide/unhide. Like if I actually decided to make a sprite based game like Final Fantasy 3, realize the sprite system to it's potential, maybe I would find out that this thing people have been talking about for 15 years doesn't really work too well.

The AVI/Mpeg animation system I recently was posting about is another fairly unbeaten path in the world of DBPro. Try loading a few hundred of those and suddenly the program crashes. Some sort of memory leak. FLUSH VIDEO MEMORY keeps it in check but that's a very disruptive command to use. You can't really do that in real time, it kills all of the objects, textures, sprites, animations the program has loaded. Which means your program needs to be designed in a way to prevent it from crashing in that situation.
https://forum.thegamecreators.com/thread/202959

Make Image From Memblock - Doesn't create new mipmaps. It's been a few years since I was looking into this one. Sometimes I post (somewhat pretentious) screenshots of a (now aging) 3rd person game I work on (rarely). The characters bodies are layered textures where the layering is combined into a single texture by the game. This requires Make Image From Memblock. Well for some reason everyone looked like a naked ken doll at a distance and then the clothing would materialize as you approached. The mipmaps were not updated and using the original base skin texture. Lovely.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Jul 2017 16:42
Quote: "Sorry I don't really want to turn this into a horror stories thread. I know the focus is on providing little demo codes."


Doesn't really matter in my opinion. Some threads are destined to morph into something different (or more interesting ).

My impression is that lots of rendering issues are caused by DBPro's handling of 2D - especially when combined with commands really intended for use with 3D. I've had far fewer problems getting 3D scenes to render as expected despite their complexity in other ways.

Your mipmap problem is an annoying limitation of the make image from memblock command. I guess it ought to be possible to add mipmaps by saving and reloading the images - but that's hardly desirable in real time. Actually I thought I read a discussion somewhere of a way to add mipmaps simply in code. Completely forgotten now where I saw it. I suppose a C++ experienced DBPro coder could tell us how to call the relevant DirectX dll from DBPro - or how to write a wrapper for it.
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 10th Jul 2017 00:30
Quote: "Your mipmap problem is an annoying limitation of the make image from memblock command. I guess it ought to be possible to add mipmaps by saving and reloading the images - but that's hardly desirable in real time."

This should change your opinion some. DBPro already creates the mipmaps when loading BMP/JPG/PNG images. So it would be trivial for them to have given Make Image From Memblock a parameter to do that. Not to mention for consistency you'd expect the mipmaps to be made if Load Image does it. There's a block of code somewhere in the guts that's being under used.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Jul 2017 20:38
Why should it change my opinion? I agree with you.

The save/reload option refers to existing code and is easy to apply as a last resort.

Actually, I'm sure I've seen a discussion of this point in one of the early Game Guru or perhaps FPSC Reloaded discussions.
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 11th Jul 2017 23:51
Yeah i was brain dead reading your comment before.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Jul 2017 10:59
No problem.

Talking of brain dead, both my desktop and PC are behaving very weirdly this morning. For some bizarre reason several of my old exe files just will not run on either machine, yet others will.

They just exit silently as if nothing has happened. It's as if they were being blocked by some security feature - however, the desktop uses Windows Defender which denies blocking anything and the laptop uses Norton. Feeling rather baffled and annoyed today.

Any suggestions anyone? Incidentally a recompile doesn't help.
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 18th Jul 2017 01:27 Edited at: 18th Jul 2017 01:29
I would need more information. Initially try turning on compatibility mode for windows 8. When I updated to Windows 10 Creators Update, the first workaround I found was compatibility mode. It was kind of screen glitchy though with Flush Video Memory .
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jul 2017 13:17
Quote: "I would need more information."


Here you go.

Without exception the failing exe files give the following error report:



Obviously the precise details will vary but two things stay the same, i.e. these two lines:

Quote: "Exception code: 0xc0000005
Fault offset: 0x00000000
"


I've looked up the meaning of that Exception code but am no nearer a convincing explanation. Could it be caused by a hardware issue of some sort? I'm presently trying to see what, if anything, the failing exe's have in common (other than the fact that I wrote them of course ). At the moment, the main contenders are the use of Advanced Terrain and the use of IanM's version on the "make object plain" command. Interestingly, those two commands do something very similar, i.e. create multi-segmented plains. I don't yet know if other functions are implicated yet - certainly many of my other shader demos work perfectly. so it's not just a shader complexity issue and in fact shaders are not necessarily implicated at all. For example, the following very simple program is failing at the moment (yet the same exe works perfectly on my laptop):

Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 18th Jul 2017 13:31
Well what operating system is the laptop?


The fact the programs run there seems to suggest you other computer isn't arranged correctly.

It might be helpful to provide a small bare bones code example that crashes, using plugins or whatnot. That way it can be determined if others are affected.

If others are not affected then something like drivers,direct x or something else is wrong on your computer.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jul 2017 14:22
Quote: "Well what operating system is the laptop?"


The same - but without the Creators Update (because it won't install ).

Quote: "The fact the programs run there seems to suggest you other computer isn't arranged correctly."


Indeed it does. The question is - what exactly is wrong.

Quote: "It might be helpful to provide a small bare bones code example that crashes, using plugins or whatnot. That way it can be determined if others are affected."


What could be simpler than the one I posted in my previous post?

I'm fairly sure others are not affected except possibly those with same updates installed - as you say, it would be helpful if someone with a similar setup could test that simple example (it uses IanM's Matrix1 plugins).

Both my machines are nVidia, the problem machine has a GTX 1050 card and I'm currently running DBPro U77 RC7 (although I get similar problems with DBPro9Ex).

Incidentally, one of my demos, which uses both AT and a shader does work which just adds to the puzzle,
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 18th Jul 2017 15:21
yeah I was on a mobile phone and missed that code snippet you provided. That's a pretty bare and basic code example.

So just a rundown of the facts.

- These are old programs that were compiled a long time ago that now no longer work. These are not freshly compiled programs.

- No DBPro compiled programs are working.

- No plugins are being used in some of the affected programs.

If this is true then you surely must have a dependency issue or a virus. I do not see any .net framework or other redistributable mentioned on the website. Perhaps you can check your laptop and find out which .net frameworks you have installed and make sure they are installed on your big computer.
Make sure to also download Geforce Experience, and use it to update the video drivers. Select a clean install. Also download and install that latest DirectX 9 again and check to make sure the files are actually there in the System32 folder. The directx 9 DLL files are numbered up to about 42. Things that are missing can probably be compared with and copied from the laptop in some cases.

Also I once had to set an Exclude folder for Windows Defender, the entire DBP folder, and any project folders located elsewhere. I probably should have mentioned this first.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jul 2017 16:34 Edited at: 18th Jul 2017 16:36
Quote: "- These are old programs that were compiled a long time ago that now no longer work. These are not freshly compiled programs."


No. It doesn't seem to matter whether they are freshly compiled or created. Some work, others don't even start. I haven't noticed a useful clear pattern yet - the only consistent thing is that if a program will not run, it stays that way.

Quote: "- No DBPro compiled programs are working."


No. Many are - and those which do, still work after a fresh compile.

Quote: "- No plugins are being used in some of the affected programs."


I'm not sure about that one. I'd have to do a fair bit of checking to find out. But, yes, that is one issue still to check. Thanks for the nudge.

Quote: "If this is true then you surely must have a dependency issue or a virus. I do not see any .net framework or other redistributable mentioned on the website. Perhaps you can check your laptop and find out which .net frameworks you have installed and make sure they are installed on your big computer."


Yes, a virus is one possibility. I'll probably be able to install Norton easily since I have it already on other machines. I was hoping to keep this machine free of too many resource hogs.

Quote: "Make sure to also download Geforce Experience, and use it to update the video drivers. Select a clean install."


Already done that a while back. In fact earlier today I tried rolling back to an earlier driver since I had updated that shortly before I noticed things were wrong. Had no effect - the problem is still there. However, I usually use Express Install. Is a Clean Install on option in Custom Install as I can't see the Clean Install option? [Just checked. Yes, it's an option. I'll try that in a minute. ]

Quote: "Also download and install that latest DirectX 9 again and check to make sure the files are actually there in the System32 folder. The directx 9 DLL files are numbered up to about 42. Things that are missing can probably be compared with and copied from the laptop in some cases."


Already tried that - no obvious effect. (Although I haven't tried a file by file comparison, which could take a LOONG time. )

Quote: "Also I once had to set an Exclude folder for Windows Defender, the entire DBP folder, and any project folders located elsewhere. I probably should have mentioned this first."


Hmm? Not sure I can do that with this edition of Windows, i.e., I'd have to check again. This is what I see when I open up WD - no option to exclude things on any tab.

Attachments

Login to view attachments
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 19th Jul 2017 01:22 Edited at: 19th Jul 2017 01:30
This is Windows Defender in Windows 10 Creator's Update. You appear to have an earlier version.

If you did install Windows 10 Creator's Update, perhaps it did not successfully install.
In your version the settings for Excluded Folders and Files are in the Settings menu.

Green Gandalf wrote: "Already tried that - no obvious effect. (Although I haven't tried a file by file comparison, which could take a LOONG time. )"

These files.


You might also consider checking to see that the same .net frameworks are installed on your Laptop and Desktop.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Jul 2017 20:25
Never mind. It seems I had failed to implement other people's suggestions about missing DLLS correctly. After several detours I have today got DBPro working correctly again.

Incidentally , the last thing I tried was resetting Windows. A somewhat drastic step but it did eventually lead me to the correct solution. And I have a nice clean machine to play with now - and Windows Defender also looks like your screenshots.

So thanks for all your efforts and thoughts - much appreciated. I still love this forum - there are still loads of people here who know what they're doing and can offer help when disaster strikes.

Login to post a reply

Server time is: 2024-04-16 20:23:57
Your offset time is: 2024-04-16 20:23:57