Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 18th Jun 2004 18:17
Can anyone tell me how DarkBASIC Pro reads the ASCII map? I was following the tutorial "Huge Dungeons", but how does the compiler actually place the right object at the right place?

Second, less important question: Is there a way to take an image and store it as ASCII?

Thanks,
ZeroB~

GXEntertainment - http://gxe.dbspot.com/
-- The forums are here!
GameXaero forums - www.t4e0.4cybiko.com
Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 18th Jun 2004 19:01
Quote: "Can anyone tell me how DarkBASIC Pro reads the ASCII map? I was following the tutorial "Huge Dungeons", but how does the compiler actually place the right object at the right place?"


I'm not exactly sure about the HD example, but firstly, the compiler doesn't place the object. The compiler converts the code from "English" to machine code and produces the executable. That is all.

Basically if you have an ASCII map, which is say 10 characters wide by 10 lines deep, and you have different characters for different types of entity (floor, wall, enemy). Eg "F","W" or "E". You then decide on a scale, eg: the world will be 100 units from side to side. You then divide this by the number of characters in each line = 100/10 = 10 units. The first character on the first line goes at position 0,0,0, and then you increment the position by 10 units in the X direction for each character.

So if the first line of the ASCII map was WFFFWFFFFW, then the fifth character is a "W" for wall, and is placed 50 units along on the X axis. Similarly each line represents 10 units along the Z axis.

An ASCII character is just a way of representing a number from 0 to 256. For example character 9 is a tab. ASCII is not really a file format, its just a way of associating a particular character with a number.

The actual contents of the file may be 0x00001001 (that is what the computer sees), this is equivilent to the number 9 in decimal format, and Windows interprets it as a tab character.

BlueGUI:Windows UI Plugin - All the power of the windows interface in your DBPro games. - Plus URL download, win dialogs.
Over 140 new commands
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 18th Jun 2004 20:06
Still, that doesn't answer my question. Would the code by something like this?:



GXEntertainment - http://gxe.dbspot.com/
-- The forums are here!
GameXaero forums - www.t4e0.4cybiko.com
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 18th Jun 2004 20:40 Edited at: 18th Jun 2004 20:47
Quote: "Now, how do I position the walls, ceilings, floors, etc? I think it would be something like:

IF map(x,y)="w" position object ?,?,?,?"


rem Assmue that each 'tile' is a 10x10 object. Technically, a
rem wall can head in 1 to 4 directions. So, you could have up to 15
rem combinations of wall tiles. Values like -, +, and | would make
rem much more sense than 'w'. Unless 'wall' really means 10x10
rem block of stone. Then perhaps - and | could be used for doors.

if map(x,y)="w"
nextID = nextID + 1
load object "wall.x", nextID
position object nextID,x*10,0,y*-10
endif

Why -10 for the z axis? That's because while we read top to bottom, positive coordinates on the Z axis go away from the camera and not down the page.
--
TAZ

History did not begin with PONG. -- Greg Costikyan

Game Beavers

Login to post a reply

Server time is: 2025-06-06 16:10:36
Your offset time is: 2025-06-06 16:10:36