|
-
Apr 16th, 2000, 11:40 PM
#1
Thread Starter
Lively Member
I'm having trouble with this one. If I were to make an RPG, would I need a seperate form for each individual field? And should I use prerendered graphics in order to make the backgrounds, or should I just use some strange form of tiling?
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 17th, 2000, 02:04 AM
#2
Addicted Member
Tiles
Most RPG games use one file (-or maybe embed it in the EXE) filled with lots of tiles of diferent types. Like you have grass, trees, bushes, water, roads, and transitions. Then in your game you pick and choose tiles and build your map.
KENNNY, Fox, Harry, this is where you guys come in and take over the conversation, (the resident game experts) 
Good Luck!
---5 mins later---
Now I see that the answer I posted has no meaning in relation to you question...sorry. Lemme Try again.
Field - Do you mean the tiles that fit into the screen (or form) at the same time?
If so I think you maybe taking about scrolling... As the character walks around in this tiled world you constantly redraw the map with the new tiles in place...(am I making sence?)
Example:
The map is 100 by 100 tiles
The "screen" in only 9 by 9 tiles.
The character is always centered is the "screen." - FIG 1
When the caracter move right the "screen" needs to refresh and show the new tile on the right and getrid of the old ones on the left - FIG 2
Code:
FIG 1 the dot = character
------------------\
| . |\_screen | \
|____|/ | \
| | \_map
| | /
| | /
| | /
------------------/
FIG 2
------------------\
| | . |\_screen| \
| |____|/ | \
| | \_map
| | /
| | /
| | /
------------------/
Ok..I hope this helps more...if at all 
PS: If this sound like I'm talking down to you, I apologize.
[Edited by Cbomb on 04-17-2000 at 12:27 PM]
Cbomb
Techie 
-
Apr 17th, 2000, 03:03 AM
#3
Thread Starter
Lively Member
Hmm baba...
Ok. If I do what you say, and insert new tiles on the right, and remove those from the left, wouldn't that be very choppy? I mean isn't there a way to make a smooth scrolling motion? Like in Zelda 3? Or is that just not possible with plain VB?
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 17th, 2000, 05:51 AM
#4
Hyperactive Member
well yeah, you simply start drawing part-way along the tile.
ie.
your position in the map is 100,100
the map is 1000*1000
your tiles are say 64*64
you do (100 mod 64) to get where to start drawing from on the leftmost tile onscreen: 36 . You have to make sure you draw from the right tile, too, but you can figure that out.
It's not easy to explain, but good once you've got it working by the way, how are you doing your rendering?
"native VB" - ie PaintPicture just isn't up to it, so dont use it
buzzwords are the language of fools
-
Apr 17th, 2000, 06:23 AM
#5
Thread Starter
Lively Member
I want to use bitblt (I've gotten very accustomed to it), and I could simply change the x and y coordinates of my picture, but I can't blit into negative space. Otherwise it crashes. I'm totally at a loss of what to do, and I'm not going to make a game unless it can scroll. My god man, The Original Legend of Zelda could somewhat scroll, and it was on Nintendo.
Man, I played that Paradox II game, and now my screen fonts have ceased to be softened. EEWW!!!!
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 17th, 2000, 12:05 PM
#6
PowerPoster
Ok, Kenny already said the important things so... wanna download an example? You can find an older version of my engine here.
(Hm.. I should take more time to discuss here )
-
Apr 17th, 2000, 04:31 PM
#7
Hyperactive Member
LOL - I didn't write Paradox II, it was written by someone I know And he's not in Cintel. Everyone I know thinks it's crap
buzzwords are the language of fools
-
Apr 17th, 2000, 05:31 PM
#8
Frenzied Member
Hehe, me a game expert? *Wishes he was*
I can do the theory fine, but in practise I've done a little less than this guy has 
But thanks anyway. I hope to be an expert one day
Harry.
"From one thing, know ten thousand things."
-
Apr 17th, 2000, 10:54 PM
#9
Thread Starter
Lively Member
Kennny
Meeesa Thinksa it isa crapsa toosa.
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 17th, 2000, 11:00 PM
#10
Thread Starter
Lively Member
What in the hell is this?
I don't understand any of that class crap. What is it, and why are you people all using it in your games? And I downloaded that demo you told me about, and... I don't understand the class thing. At all.
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 17th, 2000, 11:33 PM
#11
PowerPoster
Well, do you know what a Type is? 
If not I'll short explain:
Types
---
A normal var can only contain 1 value... for example an integer can contain a number.
Code:
Dim A as Integer
A = 10
Well, but if we take something like a player, say the coordinates, you need more than 1 var:
Code:
Dim PlayerX as Long
Dim PlayerY as Long
Dim PlayerZ as Long
That isn't very easy to handle, say you want to copy the coordinates anywhere... you would make something like this:
Code:
ObjectX = PlayerX
ObjectY = PlayerY
ObjectZ = PlayerZ
So instead of this you can make a Type which contains these values:
Code:
Type tCoordinate
X as Long
Y as Long
Z as Long
End Type
Well, now we can access the coordinates easier, like this:
Code:
Dim Player as tCoordinate
'Set values
Player.X = 10
Player.Y = 20
Player.Z = 1
Also you can easy copy the values to another var of the same Type:
Code:
Dim Player as tCoordinate
Dim Object as tCoordinate
Player.X = 10
Player.Y = 20
Player.Z = 1
Object = Player
'Now Object.X is 10, .Y = 20 and .Z = 1
Thats all.
Classes
---
As you know Types can only contain values, so if you want to make a function to set a value, say again the coordinates, you have to do something like this:
Code:
Public Sub SetPosition(iX as Long, iY as Long, iZ as Long)
'If out of screen move back
If iX < 0 Then: iX = 0
If iY < 0 Then: iY = 0
If iZ < 0 Then: iZ = 0
Player.X = iX
Player.Y = iY
Player.Z = iZ
End Sub
Well, that's also a bit complicated because you always have to know which var you want to apply the values to. (Look at the example above, if you want to make the same function for enemies you have to copy it and replace Player with Enemy and also take another name like SetEnemyPos and so on...)
The easier way to do this is to take a class coz classes can also contain functions. So your would directly call the class function like this:
Code:
'In class
Dim X as Long
Dim Y as Long
Dim Z as Long
Public Sub SetPosition(iX as Long, iY as Long, iZ as Long)
'If out of screen move back
If iX < 0 Then: iX = 0
If iY < 0 Then: iY = 0
If iZ < 0 Then: iZ = 0
X = iX
Y = iY
Z = iZ
End Sub
'In form
Dim Player as new cCoordinate
Dim Enemy as new cCoordinate
Player.SetPosition(10, 20, 1)
Enemy.SetPosition(20, 12, 2)
With this method you can declare anything as cCoordinate and then use it's SetPosition -function.
Another difference is the declaration as you can see in the example. It's declared as New <classname> because else vb wouldn't find the object. You have to know that you can't copy Class values like Types, vb would make a pointer to the class you want to copy:
Code:
Dim Enemy as new cEnemy
Dim Pointer as cEnemy
Pointer = Enemy
Pointer.SetPosition(10, 10, 20)
'Now Enemy.X is 10, .Y = 10 and .Z = 20
That means if you change a value of the pointer you will also change the value of the Player.
End
---
Well, hope it's not too much and hope also I tould everything about classes. If not feel free to post...
-
Apr 17th, 2000, 11:34 PM
#12
PowerPoster
Eh, it's my longest post yet
-
Apr 18th, 2000, 12:05 AM
#13
Thread Starter
Lively Member
Oh.
But what about the camera and crap? How does that part of your project work?
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 18th, 2000, 04:17 AM
#14
PowerPoster
Well, nearly the same what I told above...
The camera-class contains 2 values, X and Y and one Function, LookAt. If you want to set the camera position you can directly call the function like
Code:
Camera.LookAt( -10, 100 )
The function will determine the correct coordinates (ie. set -10 to 0) and then move the camera there. Easy, isn't it?
-
Apr 18th, 2000, 04:27 AM
#15
Thread Starter
Lively Member
Alright.
Fox,
We've established how class modules work, now explain to me how you actually move and display the tiles. Mainly how you only display a part of one of them. That is the part of your program (the entire thing really) that I am confused about.
Do you have ICQ or AIM? If so tell me your contact, you seem to know what you're talking about.
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 18th, 2000, 04:33 AM
#16
-
Apr 18th, 2000, 08:39 AM
#17
Frenzied Member
Hey Fox, you beat MY longest post. Mine was this long logic thing on the general forum,answering a maths question. Some kid couldn't be bothered to do his homework, so he got people on the forum to do it for him 
Anyway back to BitBlt..
well yeah, you simply start drawing part-way along the tile.
ie.
your position in the map is 100,100
the map is 1000*1000
your tiles are say 64*64
you do (100 mod 64) to get where to start drawing from on the leftmost tile onscreen: 36 . You have to make sure you draw from the right tile, too, but you can figure that out.
Okay I'd just like to say that, as stated earlier, I haven't actually done this, but I'm pretty sure the theory is sound.
Your basic unit in BitBlt is the pixel right? And you're getting the tile from a bitmap, which you then stick onto the front buffer. Okay, so you just, like, shift one edge of the little square of tile that you take a bit so that you cut the tile down in size, and take a rectangle. You are (I think) defining the coordinates of the tile you take in terms of pixels, so, if you move the view 9 pixels to the left, you paint all your tiles 9 pixels to the right. That means the tiles on the right get 9 pixels shorter, and you add 9 pixels of a row of tiles on the left. This making sense? You just change the coordinates (in this case so that your x value is shifted by 9) that define where each tile is painted, and how large the tiles on the far left and right are. It's err.. kinda simple when you think about it. Well it is if I'm right anyway 
I haven't used BitBlt in a while, so I might have got it wrong. Anyway, Fox will post one of his usual well-explained replies soon and so you can just ignore me then
Harry.
"From one thing, know ten thousand things."
-
Apr 18th, 2000, 09:33 AM
#18
Thread Starter
Lively Member
Okay I don't know if this has any relevance to what you said but:
I can easily shift the tiles towards the right and bottom of the screen, but if I try to blit into negative space the program crashes. Any way I can fix this?
Oh Fox, I'm awaiting authorization. So if you're online reading this, go to ICQ and let me through.
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 19th, 2000, 06:54 AM
#19
Frenzied Member
Well my advice for Blitting into negative space is don't do it
I guess you mean you're trying to paint to coordinates that are outside the image box or picture box or whatever (can't remember which). The idea is you move the coordinates you're taking from and change the dimensions of the edge tiles so that you are painting to the edge of the box, not outside it.
Tell me if I have got completely the wrong end of the stick as I am saying all this purely based on what I have seen in some of Fox's work before and from my limited experience with BitBlt.
Harry.
"From one thing, know ten thousand things."
-
Apr 19th, 2000, 07:12 AM
#20
Thread Starter
Lively Member
Thanks Harry, Fox, and Kennny.
You guys all helped me understand this junk, I guess before I was too scared to experiment with my ideas, or something. The whole thing I was having a problem with was summed up in Harry's last post, Fox helped me on a chat, and Kennny, well I'm making graphics for his game ( ), which is fun for me.
Anyways thanks everyone, I'm that much more able to make games now.
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"
-
Apr 19th, 2000, 12:00 PM
#21
PowerPoster
No problem, just send us a free copy of your game *g*
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|