Foray in Game Making
Foray in Game Making
Foray in Game Making
Foray in Game Making
Foray in Game Making
Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making
Foray in Game Making Foray in Game Making
Foray in Game Making
Go Back  Xtreme Visual Basic Talk > > > Foray in Game Making


Reply
 
Thread Tools Display Modes
  #21  
Old 07-19-2011, 06:40 AM
passel's Avatar
passelForay in Game Making passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default


You are going to have to move the background yourself by drawing different areas as the car "moves", and you will have to stop moving the car image on the screen, always drawing it in the center.

The process now will be, calculate where the car has moved to in this frame.
Using that as your center point, draw your background to fill the screen around that point, then draw your car in the center.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #22  
Old 07-19-2011, 07:04 AM
murrray983 murrray983 is offline
Newcomer
 
Join Date: Jun 2011
Posts: 15
Default

ok sounds simple enough

so instead of the arrow keys moving the vehicle the map behind is moved, correct ?
Reply With Quote
  #23  
Old 07-19-2011, 08:21 PM
passel's Avatar
passelForay in Game Making passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

Depends on how you want to look at it.
I generally consider the movement of objects one task that needs to be done, and then the rendering of the scene another.
For instance I played around with a quick demo, which was posted on the Legacy VB side of the forums, that switched back and forth, between car centered and car moving.
In that case, if the car's position in world (or map) coordinates was not near any edge of the map, then the car was centered in the window, the upper left corner of the first tile that was potentially visible was calculated from that center position, and a loop done to fill the screen with the portion of the world visible around the car.
So, for the majority of the time, the car was centered and the "ground" flew by.
But when one of the edges of the game area was reached, the ground stopped moving, (at least in the one direction), so that you don't have a gap at the edge, and the car was drawn wherever its location mapped to on the ground.

I don't know how you plan on doing your background. One big bitmap that you draw a portion of to the window will work up to a few thousand pixels, but if you want a really big area, you need to be more efficient in your definition of your world, which ususally comes down to having a set of images, often referred to as tiles, that can be identified with a minimum of data and that data mapped into an array or list, or some structure so that you can loop through it based on location and draw the appropriate things at the appropriate place.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #24  
Old 09-24-2011, 06:03 PM
murrray983 murrray983 is offline
Newcomer
 
Join Date: Jun 2011
Posts: 15
Default

what would be the best way in cutting down my map into sectors and storing them in an array, so as they are called when they are needed and so only show the part of the map which is needed ??
Reply With Quote
  #25  
Old 09-26-2011, 05:36 PM
murrray983 murrray983 is offline
Newcomer
 
Join Date: Jun 2011
Posts: 15
Default

as my map at the moment is a huge 6000 * 6000 in fireworks and am looking at cutting it in to chunks and then recalling it when needed, heard bianry trees are good, this true
Reply With Quote
  #26  
Old 09-26-2011, 06:58 PM
passel's Avatar
passelForay in Game Making passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

I don't see where binary trees would help with a fully drawn map.
Trees are useful for searching for things that are ordered so that you can avoid having to examine every item.
So if you had objects that moved around, you might want to have some structure that was dynamically modified so that when you needed to find the objects that were near your position for things like drawing and collision detection, you can find them quickly and ignore all the items not near you.

But for a fixed map background, you would normally just divide it up so it can be accessed by grid coordinate and only draw the "cells" around your position.

Accessing the disk to read image data in while playing the game will most likely show up as periodic stutters in the game, if it is a car racing type game.

You could probably load the whole image into a bitmap and then use drawimage to transfer a portion of the bitmap to the screen, but I've found DrawImage to be quite slow in that paradigm.
To get the best performance from DrawImage you need to draw a whole source bitmap to a location.

So, in your case, the simplest bet would be to divide your 6000x6000 bitmap into thirty-six 1000x1000 bitmaps.
Load all 36 bitmaps into an array of 36 bitmaps, then depending on where you are in the gaming area, determine which four possible bitmap intersect with your display area and use DrawImage to draw the four of them to the proper offsets to fill your display area.
Definitely do not use the Destination Rectangle, Source Rectangle version of DrawImage.

To increase the size of your gaming area, the normal approach would be to "build" the map using reusable images. The "map" would be data describing what images are drawn where, rather than the images themselves.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Foray in Game Making
Foray in Game Making
Foray in Game Making Foray in Game Making
Foray in Game Making
Foray in Game Making
Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making Foray in Game Making
Foray in Game Making
Foray in Game Making
 
Foray in Game Making
Foray in Game Making
 
-->