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.

Newcomers DBPro Corner / Multiple questions

Author
Message
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 15th Jul 2008 01:26
Hello. I've gotten pretty far in the basic coding of my game. I'm almost ready to take a break and do lots of animating for my meshes. First through, there are some things I need to know:

1) I want to have a loading bar that smoothly loads based on the file size of the exe. Loading bars that just account for the objects tend to be jagged and ugly. How do I so this? (again, I don't want the conventional way -- I want something better)

2) One of the last things I'm working on is the message system (where you walk up to an NPC and press a key to talk to them). Right now, the only way I can get my NPC to say something is by constantly "walking into" him. Is there a way to make it so that you can start talking to the NPC when you're in a specific radius? (like a 5 unit radius, or 2 unit)If so, how?

3) Is it possible to put certain data (ie. class system, EXP curve, etc.) in a text file and call it from there? Because that's a lot of data to put in if not.

Thanks for your help.

a total noob.
Currently working on - getting Sparky's collision DLL to work!
Moe
18
Years of Service
User Offline
Joined: 1st Apr 2006
Location: Sunny California
Posted: 15th Jul 2008 03:43
for #2- what you would have to do would be.
1. to make a large sphere or cylinder around the NPC, and hide the object. Then check for collisions, if the character runs into the object, then the npc talks.

2. To constantly check the distances between the two units. The formula for that, im sure you know for 2d, (pythagorean theorum), for 3d, you simply add the third dimension. it ends up being

distance#=sqrt((person1x-person2x)^2+(person1y-person2y)^2+(person1z+person2z)^2)


Alternatively, you could use vectors.
null=make vector3(1)
set vector3 1, object position x(player1), object position y(player1), object position z(player1)
null=make vector3(2)
set vector3 2, object position x(player2), object position y(player2), object position z(player2)
subtract vector3 3,1,2
distance#= length vector3 3

Both of these, provided the same positions, would return the same values. The first way is easier to learn, its just the pythaggorean theorum applied to 3d. The second way, however, is better because it's faster. It makes use of dbpro's built in commands, and takes less time to calculate.

for question number 3? Sure, check out the file commands. I'd suggest using a type and an array, then saving that array to a file through dbpro's commands, and loading that file through dbpro's commands in a seperate program after the first one was saved.

For question number 1. Really, i cant figure out a good way to do that other than the regular way, and another variable that increases at a set rate until it reached the desired length

desiredlength=200
if length<desiredlength
inc length
endif

`the position of the loading box x is x, and y, is y.
box (x,y,x+length, y+10)

this would create a box that would increase in size until it reached the 200th pixel of the screen, and would be 10 pixels tall.

parrot
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 15th Jul 2008 03:50
1) The smooth loading would be caused by you having to load a ton of objects, and the actual size of your loading bar. If you have only a few objects to load and a long loading bar, the bar will have to increase by quite a bit, thus creating the sketchiness. So, it's all dependent on the count of objects you are loading.

2)This code:
to get the distance in units from the player to the npc. If this distance is less than a threshold, say 5 units, and the npc has not been put into a talk state, then put it into that talk state.

3)Check out the write and read file functions
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 16th Jul 2008 02:53 Edited at: 16th Jul 2008 02:54
Thanks. However, I have a new problem and rather than post it elsewhere...

It seems to me that when you #include a file that only has a function in it, and then you call that function from the main file, only the data in that #included file is active until the function is over. This is a problem because I have a text HUD and it disappears every time a message comes up (the message generator is the function in the other file). Is there a way to circumvent this?

Thanks for your help.

a total noob.
Currently working on - getting Sparky's collision DLL to work!
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 16th Jul 2008 09:46
Data in any function is local to that function in DBP. If you want global data you'll have to resort to global variables(arrays or variables defined using the 'global' command).
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 16th Jul 2008 20:48 Edited at: 16th Jul 2008 20:48
I don't think that was the problem. Made 'em global but that changed nothing. What the program is doing is erasing all the text on the screen before showing the message, and I want the message to show over the text. It's like the program is doing a CLS even though I'm not telling it to. :/

Any other way?

a total noob.
Currently working on - getting Sparky's collision DLL to work!
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 16th Jul 2008 21:31
for the text file if it hasnt been answerd
-this is taken from my game-
i have a folder called Data inside that is another folder called War Arena and then Campaign, and inside that is Default Campauign, and the file is called names.txt
this file gets names.

every read string is 1 line
so you cant mis out lines so what i do is i tell it that that line is Nothing$ and Nothing$ isnt used
i then put read sting and when i get to the line i want
(say 6 lines in that means theres 5 nothings$ before)

when i get to this line i can call the string what i want
EG:
enemy1$
then at the bottem i can change this into other types where i write
Enemy1 = Val(Enemy1$)
that means enemy1 is the enemy1$ found in the text file.


now that is loading and getting the info
saving is very simalar
this is also taken from my game and also covers deleting files:

the first few lines will check if this file exists and if it does it will delete it.
the next load of lines will save strings
so like loading i find the path i want to save it to.

Quote: "Open To Write 2, "Data/Version Data and Information/VersionData.txt""

i then do 'write string' and then the file name
and then using speach marks as if you were writing with the Print command
you write what you want to say
if you want to put it on a new line then you do another write string below
at the end you have to put close file



Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 16th Jul 2008 21:34 Edited at: 16th Jul 2008 21:36
what i said probable wont help but its a start.
you can get .dlls that do this progress bar and make it that you can choose where to save data
CLICK HERE FOR PROGRESS AND LOADING/SAVING LOCATION .DLLs

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 16th Jul 2008 21:54
cyangamer,

I'll need to see your code to help you out with the erasing problem. Would you post in in a code snippet please?
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 17th Jul 2008 00:03 Edited at: 17th Jul 2008 00:36
Sure.

Here's the message script #included from it's on file:


The main file should be attached.

Outscape: Thanks for your help. I'll be sure to try what you suggested.

a total noob.
Currently working on - A letter-by-letter Message Script

Attachments

Login to view attachments
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 17th Jul 2008 00:59
did i actually help somone?
normally im the one annoying people for their help =D
if you want a better explaination yahoo me

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 17th Jul 2008 02:21 Edited at: 17th Jul 2008 02:31
Let me guess. Your whole game stops when you display the message, correct? I think I figured out what your problem is.

Your "message_display" function uses a loop (in the form of WHILE/ENDWHILE), and whenever you use a loop ONLY the stuff in that loop will be visible on the screen so long as you use the SYNC command. No text or anything being printed outside of that loop will be visible on the screen while that loop is in action.

For example, have a look at this program. It demonstates the same issue you're having but it's simpler to look at.



Also, try to avoid using WAIT in game loops unless you actually want to pause everything.

I hope this was helpful .

Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 17th Jul 2008 20:15 Edited at: 17th Jul 2008 20:18
Cyangamer,

Here is an example of how you should probably set the menu function up so that it does not interfere with the workings of your main loop:



The menu function does not loop within itself, but is called at every program loop. So, its just as if the menu was in the main loop itself.
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 17th Jul 2008 21:18
Thanks. I fixed the disappearing HUD problem by calling the functions inside the message function. That way, the HUD reloads every time a message comes up that makes it disappear -- preventing it from really disappearing.

Thanks again for your help.

a total noob.
Currently working on - D3D_Text
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 18th Jul 2008 07:21
Cyangamer,

That works too. Congrats. Good luck and happy programming!

Login to post a reply

Server time is: 2024-09-27 18:17:12
Your offset time is: 2024-09-27 18:17:12