Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Huge project, few questions
Index -> Programming, Turing -> Turing Help
Goto page 1, 2, 3, 4  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Nathan4102




PostPosted: Fri Jul 26, 2013 8:54 pm   Post subject: Huge project, few questions

Hey guys! I've been planning a huge project lately, it's a huge strategy game that will probably take me a couple months to make. I've got a question though. So in my game you'll be able to walk around a 2d town. How do you guys suggest I do this? I was thinking I could photoshop a huge map image, load it at the beginning, and then scroll it around when the character walks, with programmed obstructions and stuff, but is there a better way?

Thanks!
Nathn
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Jul 26, 2013 8:58 pm   Post subject: RE:Huge project, few questions

You could use an ASCII map, which is basically a text file representing, well, the map. Each character corresponds to a different object type- grass, roads, bushes, walls, doors, etc. All your movement, collisions, etc. take place on this map. You can then draw the world either with a photoshopped image, or by assigning a sprite to each character in the ASCII map and drawing the map based on that. Many old (and some new) games use this method.
Raknarg




PostPosted: Fri Jul 26, 2013 8:59 pm   Post subject: RE:Huge project, few questions

Personally I would make tile images for the whole game. That way you could have customizable maps and you could just draw a few small pictures instead of one huge one, which is a lot slower. Not only that, but it would be much easier to program obstructed areas, by far.

If you do go the way you're planning, split the map into a bunch of smaller maps so you can just draw whats visible rather the always the whole thing.

edit: Instectoid got there first. Mix text files with tiles, and it becomes a lot easier.
Nathan4102




PostPosted: Fri Jul 26, 2013 9:23 pm   Post subject: RE:Huge project, few questions

Wow, I never thought about using tiles... That would make everything A LOT easier. I like your idea about an ASCII map Insectoid, I'll probably use that!

I've got a decent idea on how to draw this, so we'll see how it goes! Very Happy

Thanks!
Raknarg




PostPosted: Fri Jul 26, 2013 10:06 pm   Post subject: RE:Huge project, few questions

I started an RPG a while ago, and it had a cool tile system... basically it was a text file, and each tile had two parts. The first part in lowercase would indicate what tile it was by name of the jpg, and the second part would indicate what directions it was inaccessible from. Thats how I could easily include objects with obstruction.

For instance, lets say you had a tile with a cliff that was high on top and low on bottom. The text for that could be clftB

That means cliff tile, top high, inaccessible from the bottom.

Just an idea
Nathan4102




PostPosted: Sat Jul 27, 2013 7:29 pm   Post subject: RE:Huge project, few questions

I'll use that too! xD Thanks!

I got another questions now. So I'm making my map in a txt file, but I don't want it to be easily editable. In turing, I don't think you can add files to your .exe without including it in the .t file, so I came up with another way.

I'd like to make the map in plain text, and then convert every character to binary. The binary would look like gibberish to anyone who isn't really tech savy. Now is there a way in turing to quickly convert a character to its binary form, and back? Sure, I could do a huge case statement, but I have a feeling theres a better way! :p

Thanks!
Raknarg




PostPosted: Sat Jul 27, 2013 8:15 pm   Post subject: RE:Huge project, few questions

Turing:

fcn toBinary (x : int) : string
    var total := ""
    var newX := x
    var n := 0
    loop
        if newX - 2 ** n < 0 then
            n -= 1
            exit
        else
            n += 1
        end if
    end loop
    for decreasing i : n .. 0
        if newX - 2 ** i < 0 then
            total += "0"
        else
            total += "1"
            newX -= 2 ** i
        end if
    end for
    result total
end toBinary

fcn toDec (x : string) : int
    var total := 0
    var len := length (x)
    for decreasing i : length (x) .. 1
        total += strint (x (i)) * 2 ** (len - i)
    end for
    result total
end toDec

put chr (toDec (toBinary (ord ("H"))))


make functions to convert from decimal to binary and from binary to decimal. I would encourage you to try it yourself.
Nathan4102




PostPosted: Sat Jul 27, 2013 10:36 pm   Post subject: RE:Huge project, few questions

O.o I'd need to read up on how to convert decimal to binary, I've never really looked into that stuff. For now, I'll use your function, but I'll make my own soon! Thanks!

I think I'm done for tonight, I can already tell this is going to be a lot of fun! Very Happy

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Sat Jul 27, 2013 10:42 pm   Post subject: RE:Huge project, few questions

It always is. Just make sure you set your priorities right, plan out how you're going to build this project before you throw yourself into it.
Nathan4102




PostPosted: Sat Jul 27, 2013 10:51 pm   Post subject: RE:Huge project, few questions

I've got a 4 page layout of what the game is gonna contain and stuff, but as for how I'm building it, I'm just build it, no plans, just keep adding to it and watch it grow. It seemed to work for my other projects, So.... Wink
Raknarg




PostPosted: Sat Jul 27, 2013 11:03 pm   Post subject: RE:Huge project, few questions

Haha well you might run into issues. I did the same thing a while ago, I started working on a big game in grade 10. Ended at well past 2000 lines, and it was hard to make any changes because there was just so much to change. For smaller projects its easy to change things on the fly, but for larger ones it's not always quite as easy
Nathan4102




PostPosted: Sat Jul 27, 2013 11:20 pm   Post subject: RE:Huge project, few questions

Jesus, a 2000 line project in grade 10? What on earth were you making? xD My summative was 400 lines, and I got 105%. This game will be around 3-5k lines when I'm done, I'm assuming, so HOPEFULLY I don't run into too many problems. If I do, at least its just a project for fun, and not a final!
Raknarg




PostPosted: Sat Jul 27, 2013 11:35 pm   Post subject: Re: Huge project, few questions

I was busy making this space shooting game, but if I remember correctly 1200 lines are dedicating to all the enemy drawings... I hard coded them so I could manipulate them.

It's also written like garbage haha I've rewritten it a couple times in the past

You wont be able to run it without removing all the picture stuff in the program though.



Shooting Game V 7.2 (useless for).t
 Description:

Download
 Filename:  Shooting Game V 7.2 (useless for).t
 Filesize:  93.25 KB
 Downloaded:  81 Time(s)

Dreadnought




PostPosted: Sun Jul 28, 2013 12:52 am   Post subject: Re: Huge project, few questions

If you're going to do any work at all in binary it would be good to learn bitwise operators. In Turing these are |, &. shl, shr, xor, and ~.
You can also look into storing the characters in hexadecimal, your text file will be about 8 times smaller and should be just as incomprehensible as the binary version.

Also Turing already has functions to convert to and from binary representation:
Turing:
intstr(10, 0, 2) >> "1010" % indentical to Raknarg's toBinary function

strint("1010", 2) >> 10 % identical to Raknarg's toDec function
Raknarg




PostPosted: Sun Jul 28, 2013 12:58 am   Post subject: RE:Huge project, few questions

haha wow I had no idea
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 4  [ 46 Posts ]
Goto page 1, 2, 3, 4  Next
Jump to:   


Style:  
Search: