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 Discussion / RPG Problems

Author
Message
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 26th Jul 2005 00:55
I thought that it would be a good idea to try and make a small RPG game during the summer break.

However, I when i tried to load a matrix which i made in MatEdit into my game i got very confused. Could someone explain how you load the matrix into the game. And also is it possible to have multiple matrixes so when you get to the end of one it loads the next one. Or is this something that i have to program.

Whenever i try to make something i also usually have a problem when it comes to the AI. What is the best way to have a enermy attack you when you get to close(i know the equation to work out the distance but how do i get it to face you)??

I have also stored the character stats as in arrays(is this the right thing to do??) And how would i display then onscreen? and be able to change then??

God so many questions!!! Well this is me first RPG
Jozers
Leeorg
19
Years of Service
User Offline
Joined: 5th Jul 2005
Location:
Posted: 26th Jul 2005 01:18
Can't help you with the matrix, but I assume there will be some code for it in the coding section.
If trying to work out if the badies are facing you, well how about obtaining both your own and the enemy rotational values? i.e. Y axis values.
If you assume your badies and player look at the Y-axis, then you can write some code to enable to the badie to turn towards the player and maintain that during battle by altering the y axis of the badie model - make sense?
Having your character stats in arrays is ok, but knowing which bit means what can be difficult. I would suggest a seperate varible for each of the 'hero's' stats such as health, magic, etc and for the baddies use arrays then such as enemyhealth(x), enemymagic(x)
hope this helps!
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 26th Jul 2005 03:58
would the "point object 1,xPos#,yPos#,zPos#" command be any good??

I think the only problem is that once you become in range and the badie runs towards when i then move while the badie is coming towards me, the badie just continues going to towards where it first saw me and doesn't turn towards my new position.

Also how could i get the badie to walk around randomly but as they turn they turn smoothly instead of quickly just doing a 180 turn and walking back in the other direction??

When i get a little further i will post my code as i have only a few hours work so far.

Thanks for the advice Leeorg
Jozers
Leeorg
19
Years of Service
User Offline
Joined: 5th Jul 2005
Location:
Posted: 26th Jul 2005 05:23
Probably for the badie to look at the main chracter and then use move object to move badie towards the hero.

If the badie only runs to the position it first saw you then it sounds like that in your main program loop you should include some code that will update the enemies thoughts. I.E every fifth loop of the main program look for the hero and change the direction its traveling.

With reference to changing direction, when a badie changes a direction use a flag (a term used to show a change of state).
I.E change_direction_flag(x)=0 means no change of direction
change_direction_flag(x)=1 means change of direction.
And while this flag remains 1 the program will know that the badie is changing direction and your ypos# can be increased/decreased by a constant (such as 1 degree) Once the badie has rotated to his new orientation then change_direction_flag(x)=0 and the program will then move the badie in said direction.
Hope this helps!
Drew Cameron
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 26th Jul 2005 06:52
Add the point command to every loop to have him continue to follow you.


Katie Holmes does not endorse D&C or Drew Cameron.
Leeorg
19
Years of Service
User Offline
Joined: 5th Jul 2005
Location:
Posted: 26th Jul 2005 15:44
Either way works.
If you have up to five loops in which the program will work out all the badies new directions, and divide you badies up in to this five. i.e. 25 badies = 5 in each loop. or 5 badies, 1 in each loop
You will save on processing power and maybe pick up a few fps depending on computer stats. This probably won't affect you as the AI is pretty simple, but if you use this for more complex AI games you'll save on time and have increased FPS.
Note that assuming each program loop is 1FPS a badie will be updated every 5 FPS and you won't notice a thing at all.
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 26th Jul 2005 18:10
I am going to do all the stats now then work on the AI later.

I am still stuck on importing a MatEdit matrix into DarkBASIC. It's probably something small that i haven't done. Could someone please tell me how you are meant to do it because its really annoying, i spent two hours trying to work out how you do it .

Well thanks for the advise on AI
Jozers
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 26th Jul 2005 22:11 Edited at: 28th Jul 2005 02:02
I am have a little problem with my menu at the moment if i can't fix it in about an hour i will post my source code.

Anyway back to programming

EDIT: I am still having problems but i am going to make my menu better and hopefully faster by using the mouse instead of the up and down keys.
Will post again if i have any other problems or have made good progress
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 28th Jul 2005 06:21
Ok i have changed my start menu so you use the mouse instead of the directional keys.

However, my menu doesn't seem to be running as smoothly as it should could someone please take a look at my code to see if they spot any problems i have missed.



Sorry that it hasn't got any comments.
Jozers
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 28th Jul 2005 21:25 Edited at: 28th Jul 2005 21:30
Jozers,

llNotice the code below, in that your program has to go through many if statements when passed to a new label to fill stats. These groups of code can be condensed to a much smaller amount of groups.

Example:


So that these variables are not reset each loop, you should place each group as so to only be reset when the mouse is clicked when upon a specific button, as so:

New:


Also notice in the above code, how that I combined the two like IF statements, to form one process, that checks for mouse collision, and then checks if the mouse is being clicked. If the mouse is clicked, only then are the stats changed. If there is no collision, the the ink color is changed to white. Condense IF statements together if all possible. If you ever have to code multiple collision check boundaries, that are exactly the same as eachother, combine them into one single collision check. Then, within side of the if statement, place more if statements, depending on what you need. This can speed your program up phenominally.

Once again, these two groups of code can be condensed down to one group.

Example:


New:



+NanoBrain+
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 29th Jul 2005 14:53
Cheers Nanobrain

That made my menu a little quicker. However when i want to select a Class or Race i have to click several times before it comes up that i have selected it. Do you know any way of fixing this??

Here is the new code



Thanks Jozers
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 30th Jul 2005 23:33 Edited at: 30th Jul 2005 23:36
Quote: "
WARNING: No such label used at line 277
"


"goto main" is the offender - You haven't got a line with 'Main:' written on it anywhere.

Did you mean "goto new"?

EDIT: Ooh, tried it. I have the screen 'flickering' problem, which makes my eyes hurt, so I didn't spend too long on it - But the buttons appear to be a bit mis-aligned - e.g., you have to click on the top-half of the text...

[Insert extremely witty comment here]
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 31st Jul 2005 18:17 Edited at: 31st Jul 2005 19:23
That is just a small part of the code. The main section is the actual game which i haven't posted the source code too.

I was pretty sure the buttons weren't in aligned very well i will fix that problem later.

But now i am working on the actual game i thought it would be good to have a day-night cycle. So i thought i might tackle that next. I think the best way to do this is to have a timer and when it is night chage the fog distant.

But this doesn't have a very smooth transition between the two. Is there a better way to change between Day and Night???

Cheers
Jozers


EDIT:
I have tried to do it but need a little help this is what i tried

First I made a variable(fogdist)=120

I made the fog distance number a variable.
fog distance fogdist#

then i did this

if fogdist# > 35
dec fogdist#,0.01
if fogdist#=35
inc fogdist#,0.01
Endif
endif

i know what the problem is i just don't know how to fix it. LOL
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 31st Jul 2005 21:49
BTW is there a command like ABS() (make value positive) which instead of making positive makes the number Negative.?Because i think i can complete my Day-Night Cycle if there is one
Jozers
Wraith Glade
22
Years of Service
User Offline
Joined: 3rd May 2003
Location:
Posted: 31st Jul 2005 22:28
Im going to enjoy answering your last question


just call ABS(...) with a negative sign (ie: "-ABS(...)"), or multiply it by -1

r333
19
Years of Service
User Offline
Joined: 18th Jul 2005
Location:
Posted: 1st Aug 2005 01:27
MatEdit has and option to just call the matrix, would that work It's been a while since I've used it, so I'm not completely sure, but I know it had two options to export the matrix. One was terribly complicated for beginners, and the other was relatively simple to use. Try that(but don't quote me, it's been a long time)

Thanks!(for..whatever it is you did...)
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 4th Aug 2005 12:22
Thanks for the Help.

I have finished my Day-Night Cycle but still need to work out how to import my matrix into DBC, thanks for the advice r333 i will have another go at it in a sec.

I thought i might have a go at modelling some weapons for my Game. I have never modelled before here is a screenie.

Attachments

Login to view attachments
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 4th Aug 2005 12:28
And Another.

Attachments

Login to view attachments
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 5th Aug 2005 14:20
I am having problems loading my matrix from MatEdit to DBC I have got the include file, arrays but when ever i run the code i get a syntax error at the line where i have LoadMatrix("filename",1) can someone please help because i have been having this problem for a while.

It is probably something stupid i have missed
Cheers
Jozers
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 5th Aug 2005 14:41
Most users who have problems loading MatEdit matrices usually haven't checked out the example demos that are supplied with it. The docs also cover the subject, but are quite large so many users don't bother with them.

However, the following topics are usually cause the most problems:

Matrix Not Built

First of all, did you use the Build option in MatEdit to create the MDF file and texture bitmap from your matrix?

If so, you need to copy this MDF file and associated bmp file into the same folder as your dba file.

Include File Not Found

You then have to #Include "LoadMatrix.dba" at the start of your program and make sure that the set of functions LoadMatrix.dba is also in the same directory as your program.

LoadMatrix Call Wrong

You load the matrix by using LoadMatrix("filename",1) as you said, where you replace 'filename' with the name of your mdf file. But, if your matrix mdf file is called 'MyMatrix.mdf', you would use:

LoadMatrix("MyMatrix",1) - NOT LoadMatrix("MyMatrix.MDF",1)

(The 1 is simply to say that when the matrix is created, it is matrix number 1).

Array DIM Block

Last but not least, take a look at the demo files that came with MatEdit as the loading process is well commented. One of the things many users miss is the section at the start of the demos which says something along the lines of "VERY IMPORTANT - PLEASE COPY THIS SECTION INTO YOUR OWN PROGRAMS".

This is the block of DIMS which initialise the arrays required for the #Include file functions.

Not sure which (if any) of these are causing your problems, but it's worth going through the list to double-check.

In your last post, you say you get a syntax error. Does it say anything AFTER that - eg Unknown command at line X?

If so, then your #Include file isn't loaded and DB can't find the LoadMatrix function.

Hope this helps...

TDK
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 5th Aug 2005 15:16
Thanks for that but i think have have done all that you have said above. I went through and checked and also had a look at you demos.
In some of your demos you have but Success=Loadmatrix("filename",1) so i though i should try that. But when i ran the program it came up with Parameter Mismatch. Array must have at least one Subscript I don't know what this means i might make sense to you.
Thanks again
Jozers
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 5th Aug 2005 18:31
don't worry i managed to fix the problem after playing around with it but i still don't know what the problem was and how i fixed it

Just wondering is there any Map Editors around which are compatible with MatEdit??

I'm going to either start a battle system now or a equipment and stats system.

Jozers
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 6th Aug 2005 01:54
There were a few world editors which were compatible with MatEdit, but as far as I can remember, as I kept updating MatEdit, they didn't update their programs to keep up with the new features.

I think the latest version to have a supporting world editor was V1.5.

Try looking for Magic World by All Seeing Eye (I think). That did support MatEdit, but I'm not sure which version.

TDK
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 8th Aug 2005 15:22 Edited at: 8th Aug 2005 15:25
Thanks for the help TDK

I am having a problem with my battle menu now
My menu is like the Final Fantasy 7 style when it is your turn to attack the command options appear at the bottom of the screen but i am using a plain to do this so when it appears the text which is printed (which should be below the pop up menu appears through it.

Is there anyway to stop this??

Thanks
Jozers

Btw does anyone have the equilibrium battle demo source code because i deleted it from my computer and i think this would help solve the problem.
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 8th Aug 2005 22:29
I solved the problem

I am working on the turn based battle system at the moment. I was just wondering what is the best way to save the skills, weapons and items you have. I thought you would do this be saving it as arrays.
Would this be a problem as i have saved my stats as variables or doesn't it matter.

Jozers
Non Official Company Owner
19
Years of Service
User Offline
Joined: 1st Jul 2005
Location: ???????????
Posted: 27th Aug 2005 23:09 Edited at: 27th Aug 2005 23:21
Jozers I was thinking about making an RPG but everyone says it is hard to make one can you help me make one? Need details on what RPG game I want to make go to http://www.freewebs.com/ssskewl/finaldrift.htm

Y wat' up
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 27th Aug 2005 23:50
Quote: "Freewebs Page Not Found"


I got this error when i tried to look at your site.

I can help you make an RPG game as much as i can but i'm not brilliant at programming This RPG project was just for a little fun and a challenge over the summer holidays but i think i am going to continue it when i get time at weekends. Then only thing is i suggest (if you havn't all ready done so) is that you do both the pong tutorial and binary moon tutorial. They may seem to have nothing to do with an RPG game but they teach you alot of the important things
(especially the binary moon tut) that most games have. For Example, Collision, Movement, Camera, Menu's,etc which are impotant in all/most games.

The Key to programming any game is starting simple and slowly making your game bigger and more complexed as it gets bigger. Planning is also important. Before i started, I briefly wrote down all the key things that i would need to do to complete the game. I managed to cover two sides of an A4 sheet of paper easily and am still adding to the list.

When i started programming all i wanted to do is make an RPG (i love them ) But i found it so complicated i struggled badly which but me of programming. But a few years later i decided to learn properly and follow some of the great tutorials on the site and within a few weeks i made a basic arcade style game, i then tried a FPS(and failed), and eventually move on to a RPG.

I am one of those people who have to be doing something i want to do and enjoy to benefit from otherwise i get bored easily. And i can fully understand if you are the same.

people are right in saying RPG's are hard because they take along time to make.

however, i will help you if you want it. Try and start with a cube which can move around a matrix using the up,down,left,right keys(start simple).
If you need any help either look at the tutorials or codebase or post a message (with any code).

Cheers
Jozers

BTW i am not telling you to not make an RPG neither am i telling you to make one. Do what you like, but trust me they are very quite difficult.

Life is like a box of chocolates...
Non Official Company Owner
19
Years of Service
User Offline
Joined: 1st Jul 2005
Location: ???????????
Posted: 28th Aug 2005 03:02 Edited at: 28th Aug 2005 03:15
well jozers go to Box Pong Team Request maybe you can help me make a RPG Puzzle game where you walk through worlds and challenge people to pong battles. Go to www.freewebs.com/ssskewl to get the RPG I was talking about to it select Final Drift

Y wat' up

Login to post a reply

Server time is: 2025-05-22 13:15:17
Your offset time is: 2025-05-22 13:15:17