Advertisement



Go Back   Zune Boards > Zune Discussions > Zune Games > Development Discussions

New Member?



 
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Development Discussions All developers who are coding games may stop by here for any help, suggestions, and everything development related.

Reply
 
LinkBack Thread Tools
Old 05-28-2008, 06:35 PM   #1 (permalink)
Zuner
 
Join Date: May 2008
Posts: 64
Reputation: 11
Default Read from Text File


Is it possible to read from a text file on the Zune for maps and the like? I tried to port a game over that did, but I had to manually input the map to a string array because traditional file io did not work.



__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




amoo3 is offline   Reply With Quote
Old 05-28-2008, 07:53 PM   #2 (permalink)
Developper
Experienced Zuner
 
Khao's Avatar
 
Join Date: May 2008
Location: Qu�bec, Canada!
Posts: 104
Reputation: 25
Default

You can read a .txt file.. if you create it first So reading is only good for save games really..
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


My website is down! Temporary download link :
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


Feel free to contact me to get my msn/gtalk address if you develop games, I love to help and I know a lot about programming!

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




Khao is offline   Reply With Quote
Old 05-30-2008, 10:34 PM   #3 (permalink)
Zuner
 
Join Date: May 2008
Posts: 64
Reputation: 11
Default

Quote:
Originally Posted by Khao View Post
You can read a .txt file.. if you create it first So reading is only good for save games really..
So I cant create the txt in VS08 and deploy it?
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




amoo3 is offline   Reply With Quote
Old 05-30-2008, 10:39 PM   #4 (permalink)
zB Programmer
Experienced Member
 
LedZepp's Avatar
 
Join Date: Mar 2007
Posts: 975
Reputation: 119
Default

Quote:
Originally Posted by SimReality
Just click on the .txt file in your project (in Visual Studio). Now look at the Properties window. You will find a property called Build Action. Switch that to None. Now you won't get that error. Then find the property called Copy to Output Directory and switch that to Copy If Newer. Now your project will copy that file to the Zune anytime you update it. That's it. No need for all the weird XML workarounds or junk like that.




LedZepp is offline   Reply With Quote
Old 05-31-2008, 04:18 AM   #5 (permalink)
Jr. Zuner
 
Join Date: Apr 2007
Posts: 31
Reputation: 30
Default

That'll be useful for me too. Thanks
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



flattspott is offline   Reply With Quote
Old 06-04-2008, 07:13 AM   #6 (permalink)
Zewbie
 
myerspa's Avatar
 
Join Date: Jun 2008
Posts: 1
Reputation: 10
Default

I tried the txt file input using the properties settings specified by SimReality, and what I'm getting is an Unauthorized Access Exception or something along those lines. Anyone have any thoughts?

I can't paste the exact error in here currently as I am not at home with the code.

But basically I've got the txt file with the properties setup, I'm using a StreamReader to read in the txt file. What I was thinking was that was where the problem was.

Any help is appreciated.

Last edited by myerspa : 06-04-2008 at 07:22 AM.





myerspa is offline   Reply With Quote
Old 06-04-2008, 08:22 AM   #7 (permalink)
Jr. Member
 
SimReality's Avatar
 
Join Date: May 2008
Posts: 410
Reputation: 60
Default

You probably did:

StreamReader reader = new StreamReader("MyFile.txt");

which won't work on the Zune (or 360). They have no concept of a current directory nor can they use relative paths. What you need to do is add in the TitleLocation to get the full directory:

StreamReader reader = new StreamReader(Path.Combine(StorageContainer.TitleLo cation, "MyFile.txt"));



SimReality is offline   Reply With Quote
Old 06-07-2008, 02:34 PM   #8 (permalink)
Jr. Member
 
ZeroCool2021's Avatar
 
Join Date: May 2007
Location: Zune land
Posts: 261
Reputation: 14
Default

Just turn the text into Jpegs.
That's what I do for books and comic books




ZeroCool2021 is offline   Reply With Quote
Old 06-07-2008, 02:58 PM   #9 (permalink)
Jr. Member
 
SimReality's Avatar
 
Join Date: May 2008
Posts: 410
Reputation: 60
Default

But turning text into JPEGs is a giant waste of space. You are going to blow up the size of the text and then lose all the flexibility of changing fonts or sizes or arrangement at runtime. It's much better to simply load in the text as text and then handle drawing it.



SimReality is offline   Reply With Quote
Reply


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -8. The time now is 08:02 PM.

 
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC8
vB Ad Management by =RedTyger=
(C) ZuneBoards 2006-2007
Copyright © 2006 - 2008 Zune Boards | About Zune Boards | Legal | A member of the Crowdgather Forum Community