Results 1 to 17 of 17

Thread: Maybe a dumb question but...

  1. #1

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547
    How can i make a field like they use in warcraft, where only you see a certain portion but u can move it around with your mouse and see others.

    ?

    How would the units and all move. Im very curious, please help me out!

    I was thinking of making a big pic and moving it, but that idea is NO good.

    And also, when u guys download sprites... and their in one picture, one after another, do u keep em like that or do u cut them out and open them 1 by 1 alter.
    Last edited by invitro; Jan 30th, 2001 at 01:27 AM.
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I suppose you want to make a tiled map, with terrain tiles. Generally what you do is keep an offset for the x,y in the topleft corner, which you change to have the screen moving. Your blitting procedure will then start at this coordinate in nested loops to run to the side and down like a typewriter, but with set tiles as types instead. Keep a pixel and tile variables separate and increment both.

    The units will move if you change their position and have a process for blitting them according to the screen offset. I'm not sure what you mean with the last qwestion

    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547
    What i mean is, when u download sprites they come in one picture, right? like... frame one he will move his leg and in frame two he is shooting a gun.

    I have seen some people use that one picture, without cuting out the inside and bitbliting them according to their coordinates on the picture.

    What i think is alot easier, is just cuting them out a and bilbliting the entire picture frame by frame, which way do u guys do it or do u still not know what im talking about?

    Thanks!
    Last edited by invitro; Jan 30th, 2001 at 01:10 PM.
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well, if i'm correct about what you said, you have a bitmap with all sprites on it, then you want to blit each of them off their positions. I think it's best you load each "frame" into an array of bitmaps, surfaces or whatever instead of getting them by coordinates under the ingame blitting process
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Exclamation

    Yeah your right, but the thing is its got like 50 different positions on them, im gonna have to open the bitmap, and cut out each position and save it as another picture. I guess that would work better but it takes alot more time!

    Thanks
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  6. #6

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547
    Ok, i cut out like 62 frames, and put em into an image list array. Now

    1. How do i get rid of the flickering
    2. How can i slow down the animation proccess
    3. How can i erase the old image without actually refreshing the form, because that causes flickering.
    I tried using BitBlt vbSrcErase but that causes wierd effects with this TransparentBlt API.

    I used a for i loop hehe but that dosent work very well, ... theres no way it can be used in a game. And second of all im thinking of making a timed loop.

    Code:
    Sample:
     dim intWalk as integer
    
    intwalk = 0
     do
      doevents
        intwalk = intwalk + 1
       if intwalk = 50 then CallWalk
     loop
    Any better ideas?
    (I hate timers)
    Last edited by invitro; Jan 30th, 2001 at 03:57 PM.
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    1&3, set autoredraw to true
    2 have a loop doing nothing waiting for gettickcount release it, or use sleep api.

    I think you should have a look at Fox famous programming site, there's a link on his signature
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8
    New Member
    Join Date
    Jan 2001
    Posts
    14

    Wink Dumb question?

    The only dumb question is the question never asked, Invitro.

    I'm a bit interested in this, as well, and also antialiasing. I don't totally understand how I would do something along the lines of making a point on a VB form, and antialiasing it, and perhapse animating it. I would really like to make some of those DLLs they use in the Windows Media Player that interact with music.

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Antialias - This concept might be a bit diffuse, i'm not sure if i'm right myself, i once tried to make a antialiased circle and it turned out well.

    I see it like lines shapes points or whatever, even bitmaps that are floating over the background, i mean that they have a non-integer position so that parts are hovering a set of several pixels in a different degree, and when you draw the shape or whatever on the background each pixel share a degree of the shape hovering it.

    A point at 5.23,2.14 would affect pixel 5,2 most and 6,3 least, i thought calculating the distance to it would be the right thing to do and then divide by the cumulative distances to share the right percentage of color affecting each pixel. The restering percentage for each pixel would mix with their own color having each color component multiplied with the percentage and added to shared components... might sound complicated but that's how i interpreted antialiasing
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10
    Addicted Member
    Join Date
    Aug 2000
    Location
    Croatia
    Posts
    200
    To Jotaf98:

    I think it would be better if you use a Byte value for the direction, and then define few constants to indicate movement, instead of a string...

  11. #11
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Nah, you shouldn't bother with that, a speed vector by it's component is how movement is arranged
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  12. #12

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Talking

    Jotaf98 you are the man, that is exactly what I was looking for, thanks!!!!!

    Damn i love this forum
    lol
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  13. #13

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547
    If anyone has some simple tutorials on DirectX... and i mean simple, like ways to make a texture, or even draw something on screen, ur more then welcome to E-Mail them or post up a link!
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  14. #14
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Thanks!

    I figured out you didn't know much 'bout games, so I kept it as simple as possible. If there aren't that many units in the game, there's no problem in using a bit more memory

    As to the tutorials, there's lots of them at Unlimited Realities (can't remember the URL) and at Fox's web page ( http://foxmccloud.tsx.org/ ). Have fun!

  15. #15
    Fanatic Member MoMad's Avatar
    Join Date
    Oct 2000
    Location
    Seattle, WA
    Posts
    625
    yes jotaf98, that is amazing stuff there.
    hey how about using a timer for the walking, use timeapi or i think it was called getTime api... anyways, you need to just use a constant walking rate based on the game settings, and then call walkAction or whatever...

    hey dont underestimate for loops, they are more powerful than you think. for the walking, you can say something like:

    Code:
     for i = 0 to 10000
      doEvents
     next i
     
     'that should slow down the game
     'but i recommend a timer();
    ill take that back, for loops are useless in vb... what was i thinking... vb does not give you controll over you for loops.

    good luck.
    :MoMad:
    Nice Sig!

    http://go.to/momad/ Status: Not Ready

  16. #16
    Guest
    In another answer to the flickering question...

    AutoRedraw Slows down the application A LOT... so its
    horrid for making games. I had the same problem, but
    Whn i saw the framerate hit the app took with auto
    redraw, i had to search for another alternative. My
    answer was the article on vbworld called "Stop That
    Flickering!" (handy, no?) when you render your frame,
    right before you clear the screen, lock the window (its in
    the article on the front page), clear the screen, draw
    the frame, unlock the window, then refresh/doevents. I
    think thats the order i used (this is off the top of my
    head). anyway, hope that helps a bit. =)

  17. #17
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    In my opinion, it's better to use the "GetTickCount" API (like you were trying to suggest).

    Code:
    'In the declarations:
    Private Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
    
    'In your main loop:
    
    Const MilisecondsPerFrame as Long = 100 'Set it to how long you want each frame to take
    
    Do While Running = True
      Static LastTick as Long
      
      If LastTick + MilisecondsPerFrame < GetTickCount Then
        LastTick = GetTickCount
        
        'Here you should put your game's code
        
      End If
    Loop
    That should do it

    Modify the speed to what you think is better.

    Usually 100 or 50 is good enough, but if a frame takes about 300 miliseconds instead of 100, you'll still get 300 miliseconds per frame!

    If you include special effects, give the user the option to disable them, because the make the game a bit slower (go to http://www.planet-source-code.com and search for a VB code sample called "Special Effects for BitBlt Games" - by me ).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width