![]() |
#1 |
FFR Player
|
![]() Well, I'm trying to program an FFR clone so that I can upload my own files at will, and everything was going smoothly until I realized that I had no idea how to read the contents of .sm files (this took about 2 seconds, so there wasn't actually much "going smoothly"). Would any of the programmers here mind telling me, or giving me a page that would?
|
![]() |
![]() |
![]() |
#2 |
FFR Player
Join Date: Oct 2006
Posts: 133
|
![]() Are you trying to write it in Flash?
|
![]() |
![]() |
![]() |
#3 |
FFR Player
|
![]() Well, yes, but that isn't really important right now. The .sm file doesnt change depending on what language you're using...
|
![]() |
![]() |
![]() |
#4 |
FFR Player
|
![]() I'm assuming you don't know how to read the arrows off of a *.sm file. Everything else is really obvious (except maybe stops, bpms, and difficulty types).
Here's a standard measure: 1000 0100 0010 0001 , Since there is only 4 lines, the most complicated note in there is a 4th note. If I have 8 lines, each line would indicate an 8th, etc. This would be a 16th roll: 1000 0100 0010 0001 1000 0100 0010 0001 1000 0100 0010 0001 1000 0100 0010 0001 ; Both measures take the same amount of time, but the second one has 16ths, and the first one has 4ths. Also note that a comma signifies the end of a measure, and semicolons signifies the end of a chart. |
![]() |
![]() |
![]() |
#5 |
FFR Player
Join Date: Oct 2006
Posts: 133
|
![]() Now that you have some idea of the structure of an SM file, on to programming: EDIT: You might end up using a variation of the following:
1. Find out how to open a file using whatever language. 2. Find out how to read and store ALL of the contents of said opened file, line by line. 3. For each line in the file, remove the comment "//" if any, because SM comments are unimportant data for parsing. Also clean out unnecessary spaces and tabs in each line. Then store the cleaned line. 4. Group the cleaned lines together into a single string per SM tag. Hint - use the semicolon as a split point between commands. (e.g., one group for tag "#BPMS" one group for tag "#NOTES", etc.) 5. Find out how to scan for a certain character(s) in a string, and keep the data that is not that character(s) 6. For each tag in #4, do #5 according to the way that tag handles data (e.g., for "#GAP:XXX" take the number after the "colon", that's your gap, for "#BPMS:XXX, XXX, XXX, XXX" extract all the BPM values between the commas and store them in a array/variable(s), those are your BPMs). Any decent "How to program" book/website will give you information on #1-#5 in the book's "how to work with strings" and "how to work with files" sections, and give you the actual command(s) to use. There may be existing code (like an XML-type parser, or various existing string parsing functions, or SM's source code) that may help you. If you code from scratch it might take ~100-300 lines for a basic sm parser. And of course, test this to death, because the SM parser is the most straightforward bit of code in making such a game, yet the part most prone to error because of the sheer variation of SM files. Hope that helps, and good luck.
__________________
I designed ddreamstudio. The FFR Community has kindly compiled a ddreamstudio guide/downloads here-> http://goo.gl/nq5Ad Last edited by jyris1; 09-27-2007 at 07:25 PM.. |
![]() |
![]() |
![]() |
#6 |
FFR Player
|
![]() Thanks for the help. Oh and I already know how to program reasonably well, it's just the reading .sm files that I didn't understand.
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|