Results 1 to 18 of 18

Thread: Terrain/gamearea editor question

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Question

    This is what i would like to do...

    -i have the graphics blocks 16x16 pixel Gif files
    160 different pieces

    -the gamearea or the terrain is in a file.
    Starting from 38618 and ending 42618,
    So it is 4000 values of size.

    - So first i open the file as binary
    - second i want to Get an array of 4000 values. as stated
    above

    Q u e s t i o n :

    How to: get the array in any tyoe of values, that are easy to convert to hex values ?

    How to: Show it on a form in an editable way ?
    50 Rows and 80 Columns

    I'm really a novice in vb programming but i (think) i know
    quite clearly that this is the way to start to do my Game-area-editor ; )
    Please help me

    Simo Salosara

  2. #2
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    What do you mean by easy to convert to hex? you can get the hex of every integer as string.

    Show them in an editable way:
    I normaly use a picturebox and I blt smaller versions of those bitmaps on there. Then just put some code on the mouse down event of the picturebox something like

    map(x/tilewidth,y/tileheight) = edittile
    that sets the value of "edittile" to the array.

    this works if you store your map in an 2d array, but you coul also use a normal array for this.
    write me an email if you are interested in one of my mapeditors.
    Sanity is a full time job

    Puh das war harter Stoff!

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Thumbs up

    Ok Maybe i have to ask just the specific Question, so you wont think i can infact do it already.
    Forget the stuff on the earlier post : )


    1.How to use the Get statement to get an array of (i.e) 40
    values

    Get #1 38618, values 'returns the first value
    'in this case 33

    2.How to show the values in hex

    (yes i have been studying the help files...)

    Thanks again for your reply!

  4. #4
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    That makes it easier for me.
    When I understand you right, all you need is hex(number) to get a string with the hex of a number in there. Is this what you want? (probably not)

    As far as I know, you can't just read an array. I alsways out it into a loop to get every singe value. I know that is slow, but in my applications that was always good enough.
    If this isn't good enough for you, you could try something like loading it to a string. Than what you do is get the pointer of your array and the string and use copymemory to copy the data of the string to the array. I think that should work, but I can't give you code.
    Sanity is a full time job

    Puh das war harter Stoff!

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Cool

    OK! Thanks

    so if i use a loop to
    get the values individually to a string,
    How will i do it ? with Do while...
    or with For... Next...

    And how to stop the loop when (for example) 40 values have been read ?
    And is it the Get statement that i use ?

    -please don't get bored of me

    Thanks again

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Misan! Great news for you, you can read an array, and it's tons faster than to loop.
    Salora, what type of array do you need to read? A fixed length datatype should be easy
    Code:
    Get #1,38618,yourArray
    Non fixed, like variable length strings and some UDT's need to be prebuffered.
    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.

  7. #7
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    So I just can read everything from my array? My array is 2d?
    And How do I save this? I couldn't just save the array!
    What is going on here??
    Sanity is a full time job

    Puh das war harter Stoff!

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Yes you can save any array in any dimensions

    PUT#filenumber,location,arrayname
    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.

  9. #9

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Smile

    Ok Kedaman gave this line a few posts back:

    Get #1,38618,yourArray

    and it's about the same as what i have been trying.


    Dim rivi1(1 To 4000) As Byte
    Get #1, 38619, rivi1

    but this seems to return only the value that's in
    38619 !! (it's the first of the 4000 values.)

    What am i doing wrong??


  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That should work, btw you have to open in binary, not random, if thats what youre doing? "rivi" sounds finnish, oletko suomalainen?
    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.

  11. #11

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Thumbs up

    Thanks & Kiitti !

    So, I have opened the file as binary.
    and then this:
    Dim rivi1(1 To 4000) As Byte
    Get #1, 38619, rivi1
    text1=rivi1

    And i get a bunch of ASCII codes wich are not what they should really be and there are just 2000 of them.
    with Dim rivi1(1 to 40) as byte , i get just 20 ASCII codes.
    So i think i'm getting close but i would need numerical values preferrably Hexcodes of the 4000 values.
    How can i do this??

    (Ja suomalainen versio...)
    No joo, oon Suomalainen, Morjesta vaan !
    Mutta ei tuo koodi kyllä vielä ihan toimi...
    vaikuttaisi siltä että arvo joka tuosta rivi1 tulee nyt on
    sarja ascii koodeja jotka ei täsmää sen kanssa mitä tiedostossa pitäisi olla,
    Ja esim Dim rivi1(1 to 40) antaa vaan 20 ascii koodia eli puolet vähemmän.

    textbox on varmaan väärä juttu mutta miten saisin numeeriset, mielellään hexakoodi arvot tästä?
    Kiitti jos pystyt vielä neuvomaan
    on ehkä silti parempi kirjottaa englantia, jos jollain olis tähän asiaan jotain sanottavaa vielä


  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    on ehkä silti parempi kirjottaa englantia, jos jollain olis tähän asiaan jotain sanottavaa vielä
    hehe, niin pitäisi, muuten misan ja muut eivät tajuaisi mitään

    Well misan, you could try figuring out what that was all about, hehe. Strings in vb are unicode by default so by converting a byte array to a string just using string=bytarray won't make it unicode.

    The solution is strconv:
    Code:
    text1=strconv(rivi1,vbunicode)
    'instead of
    text1=rivi1
    that should work
    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.

  13. #13

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Smile

    OK ! Kiitos jälleen !

    That seems to work!
    Now i'm still thinking how to let the user edit the values.
    now i get a screen full of weird ASCII-codes and if i wanted to replace let's say this character:

    " :ASCII = 34 :decimal = 22 :hex

    with this

    ! :ASCII = 33 :decimal = 21 :hex

    what do i call them in the code ?
    Can the unicode number ( !=33) be used ?
    let's say if i want to assign a terve.gif picture to unicodevalue 33

    for example if we have a line of four codes

    33 12 55 23

    I could present 4 different Gif files in a row according to the values.
    (as i wrote in the first post, this is going to be a Game/Terrain editor)

    Kedamanille sellaiset terveiset, että jos tuosta englannista ei saa selvyyttä, niin kysy pois ...
    Tämä alkaa kyllä tästä hahmottumaan!


    Simo Salosara


  14. #14
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    Hey you guys. Probably you have seen the "I want a muscian" thread. I was talking German in there with some others. Even though we talked English again, they deleted our thread!
    Sanity is a full time job

    Puh das war harter Stoff!

  15. #15

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Cool

    Thanks Kedaman, that was useful info also!

    Now i have done a total of 50 strings of unicode of the
    game area and i'm trying to enter the next phase of this project.

    So i have now on the gamearea 160 different unicodes and
    the next thing is that i must do a form where i make
    graphical display of this information.

    For example if the top row would be all "water", all 80 values. then the program should read the walues and check what they are.

    For example the first value on the first row could be 31
    and it would mean that on the upper left corner, the first
    16x16 pixel graphicalblock would be 31.gif

    Is a loop of some sort be a best way to go ??

    What is the best way to do this kind of thing,
    when i have the 160 GIF files on the disk separately ?




  16. #16
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well, i've been developing this kind of game some years ago, i suggest you could have a look at Fox programming site, he has the link on his signature There's a great demo on how you can blit terrains with bitblt Api.
    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.

  17. #17

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Cool

    Hello again !

    i managed to get the info to the MSFlexGrid
    and i was wondering
    how to use the: Cellpicture
    is it possible to make the what picture to load, depended
    on the value in the cell ?

    for example: if the value in the first cell is 33
    then the program would add C:\33.BMP to the first cell ?
    (as i read from the help, both can exist in the same cell at the same time.)

    i also found that i couldn't change the values in the flexgrid while the program is running, what i'm doing wrong?



    By the way, if you think i'm really going the wrong way with this, just tell me if this Flexgrid/cellpicture is no good!

    Simo Salosara

  18. #18

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Posts
    9

    Smile

    Thanks Kedaman...

    Ok the MSFlexgrid is forgotten i already have visited
    The Coding site from Fox McCloud and i planned to study
    His sources,tips and tutorial as the next thing

    Within a week or so i'm back with a new set of fresh problems




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