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 / Game's path: Seriously? another random bug?

Author
Message
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Sep 2015 04:54
The get dir$() command for some reason sometimes works properly, other times returns a wrong directory, I see it was reported as a bug since like 10 years ago, and never fixed, is there something in this engine that is not bugged?
Does anyone knows a different way to find the path? With a plugin for example
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Sep 2015 05:19
Let's explain it better, I have my game's data into .pak files, I extract them, load the content, delete the files, delete the folder.

The problem is that randomly instead of being extracted inside of the game's path, they are extracted outside, and the folders and/or the files obviously are not deleted there. (it happens just with some of them, randomly)

So the bug it's in the get dir() or more probably in the set dir command, this is the function I use to delete the file with the folders:

Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Sep 2015 07:59
Trying to make some changes the files are extracted in the correct folders made, the only problem is that some of the folders will not be deleted with the delete directory command, even if these folders are empty
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 17th Sep 2015 13:59
As usual we need to see a simple runnable snippet which produces the problem.

I tried your code and couldn't get it to fail - once I realised you'd used set dir ".." twice .



Powered by Free Banners
Chris Tate
DBPro Master
10
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 17th Sep 2015 14:36 Edited at: 17th Sep 2015 14:38
I don't like using Set Dir; I feel it creates unecessary potential for error; if there is not already enough potential.

I'd use it sparingly. It's a bit like opening the front door of your home, only open it if absolutely necessary, then close it back; otherwise something unexpected might happen.

I've used Set Dir about once in my 50,000 liner; in the function that searches my files for me; which I uploaded here.

I always reset current directory to the applications root folder immediately; which is quite easy to do with the Matrix1 library function called 'Dir EXE()'; in most cases I either use my file query library or use relative paths from Dir EXE() or some windows folder you could obtain using Matrix1. Using the ".." method is a bit too 'iffy'

All the best.

Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 17th Sep 2015 17:35
Quote: "I always reset current directory to the applications root folder immediately;"


Good advice.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Sep 2015 19:51
with a few changes I don't have anymore the wrong directory problem.
The only problem I have is that 2 folders don't get deleted (it seems like there are 2 files in both of them but even if I quit the game with alt+f4, after that, if I look inside the folders they are empty)
They get deleted though if I recall the delete folder function before the "end" of my game.

How can I fix this problem of "content update"? I mean, folders showing files but they actually have no files anymore inside, showing that later?

These 2 folders giving me nuts are: 1, a folder with files and 2 subfolders (maybe this one could be affected because of the subfolders not counted as files to remove in the perform checklist for files), and another one, that has just 2 video files (.avi), none of them get deleted.
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Sep 2015 20:10
mmm it's also happening with mp3 files, so mp3 and avi files do not update when removed and the folder it's impossible to remove it
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Sep 2015 22:34
This .pak system seems also unreliable, sometimes I get errors about files not loaded, very weird, completely random
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 20th Sep 2015 16:50
Quote: "(it seems like there are 2 files in both of them but even if I quit the game with alt+f4, after that, if I look inside the folders they are empty)"


Have you printed out the names of those two files? I believe the checklist includes the two dummy files . and .. . If that's all the problem is then you can ignore them.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 20th Sep 2015 17:51
I don't print them i just remove them with the function I use, btw i am not getting anymore random errors of files not found, and as I said before these 2 couples of files are actually deleted because if I quit with alt+f4 and I check the folders they are empty. these folders are deleted though when I quit correctly the game, I just don't understand why they behave differently than others folders which are deleted istantly
Morcilla
15
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 21st Sep 2015 13:08
I recall .mp3 files that have been loaded are not deleted until the program finishes. They are somehow 'blocked'.

So, they stay at their current folder even if a Delete File has been executed, but when the program execution ends, they got deleted.

One solution for updating the media would be to force the program to shutdown and re-start, or update the media before those files get loaded into DBPro.

Other than that, file commands at DBPro have no bugs, they just have a particular behaviour in some cases.

Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 22nd Sep 2015 13:15
Quote: "I just don't understand why they behave differently than others folders which are deleted istantly"


Neither do I. It's hard to advise you further when I cannot reproduce the symptoms myself.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 22nd Sep 2015 13:24
What about adding fog to the normal map shader I requested before? I have tried to paste the fog part from the relief map shader but it doesn't work (both evolved ones)
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 22nd Sep 2015 18:25
Quote: " I have tried to paste the fog part from the relief map shader but it doesn't work (both evolved ones)"


Could you post both shaders, i.e. the relief one you are trying to copy from and the edited one you are trying to change? Could be a simple error or oversight. I won't be able to test them till next week but I might be able to spot the problem.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 22nd Sep 2015 21:06
I have tried to redo it again starting from the default normalmapping.fx.
Probably I missed something last time because this time it seems to work.
I upload it here in case someone needs it.

Attachments

Login to view attachments
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 22nd Sep 2015 21:21
I have tried to edit as well the leaf shader of evolved, sadly the leafs disappear, this is the shader (attached).
Maybe GG if you can look at it because the trees looks really bad from the distance as they are not fading like all the other objects affected by fog.

Attachments

Login to view attachments
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 22nd Sep 2015 21:29
Quote: "I have tried to redo it again starting from the default normalmapping.fx.
Probably I missed something last time because this time it seems to work.
I upload it here in case someone needs it."


Well done!

Quote: "I have tried to edit as well the leaf shader of evolved, sadly the leafs disappear, this is the shader (attached).
Maybe GG if you can look at it because the trees looks really bad from the distance as they are not fading like all the other objects affected by fog."


I'll take a look - when my new granddaughter stops screeching in my ear.



Powered by Free Banners
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 22nd Sep 2015 21:53
OK, had a quick look.

My guess is that the vertex pipeline fog you are trying to use is conflicting with the use of the clip command in the leaf shader. You might need to pass your fog variable to the pixel shader just like any other variable and use it to lerp between the final output colour and the fog colour. Have a go at that and see what happens.

I can't compile or test it at the moment since I'm away from my machines - but I can help you get it working (hopefully).



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 22nd Sep 2015 22:17
mmm I don't know how to do that actually

I have been able to add the fog just copying and pasting the variables i saw in the relief map

Btw now that I got you here, can you look at my "Multisync post"?
I am ready to release my game on steam (it has been accepted the 9 sept, and I ve filled anything I should except the release date), but I am stuck getting the public IP of a host player, using sockets there is no way to get back the public IP of who request it by socket, using http seems like the http request data is bugged in dbpro, or I am not able to let it work.

Let's say I have a php script that returns me my ip with the "echo" command, how can I retrieve that result with dbpro?
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 22nd Sep 2015 22:50
if you make a GET request to the script, anything echoed will be returned.

Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 22nd Sep 2015 23:47
this is what I was trying to do, doing a get request with http request data command, but I can't get it to work, not in localhost and neither using my server
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 23rd Sep 2015 00:52
try hitting that page in a browser, do you get the echo? that is a basic GET request and can help determine if everything is good server side.

Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 23rd Sep 2015 02:11
Yes calling the page from the browser returns the ip as expected
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 23rd Sep 2015 19:32
Quote: "I have been able to add the fog just copying and pasting the variables i saw in the relief map"


Does that mean you've solved your problem of getting fog with leaves and trees?



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 23rd Sep 2015 21:41
No, I meant that for the normal map shader, doing the same with the leafs they disappear
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 23rd Sep 2015 22:39
Could you show me what you tried? I might be able to spot the problem.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 24th Sep 2015 02:28
This one

Attachments

Login to view attachments
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 24th Sep 2015 12:49 Edited at: 24th Sep 2015 12:51
Thanks. I've had a quick look but cannot see anything obviously wrong - unless it's the possible issue I mentioned before. I'll have to wait till I can test it at home next week.

I assume the shader works fine without the extra fog code.

Perhaps someone else can test it for you? Are you using trees from Evolved's TreeIt program?

Edit I doubt many people who know about this will find it unless you post on a thread about fog.



Powered by Free Banners
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 24th Sep 2015 17:15
Yes I am using that program
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 24th Sep 2015 18:59
Btw yes the shader works normally without the fog, adding the fog it makes the Leaves to disappear, so the trees are just trunk and branches
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 24th Sep 2015 19:43
Quote: "Yes I am using that program"


Thanks for confirming that. I have that program as well so I should be able to test both versions of the shader next week when I return home.

Quote: "Btw yes the shader works normally without the fog, adding the fog it makes the Leaves to disappear, so the trees are just trunk and branches"


Thanks. I have everything I need now (except the TGC software ).



Powered by Free Banners
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 29th Sep 2015 15:02
Quote: "Thanks. I have everything I need now (except the TGC software )."


The good news is that I am back home now.

The bad news is that the downloaded attachments are on a PC 250 miles away - and the forum attachments still aren't available.

I'll check this as soon as I can download your two attachments.


Powered by Free Banners
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 2nd Oct 2015 13:21
Ok, seen your fog shader for the trees. You left out two lines - I've marked them in the code. The trees disappeared because the shader wouldn't compile. See if this is any better. You will probably need to change the fog colour which I've set to mid grey.


Powered by Free Banners

Attachments

Login to view attachments
Cescano
4
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 2nd Oct 2015 16:59
Thank you very much! I am gonna try this now!

Login to post a reply

Server time is: 2018-10-15 16:44:01
Your offset time is: 2018-10-15 16:44:01