Page 1 of 2

NXTasy Salvaging

Posted: 17 Oct 2010, 19:34
by muntoo
Post all "useful" threads you can get from NXTasy [Forums] here. By useful, I mean stuff that people want back from NXTasy. Try not to discuss too much here... just post NXTasy stuff.

Re: NXTasy Salvaging

Posted: 17 Oct 2010, 19:35
by muntoo
From
nxtasy.org forums > LEGO Mindstorms NXT > NXT Software
http://webcache.googleusercontent.com/s ... en&ct=clnk
18 July 2008:
RRR wrote:Hello all.

Maybe someone of you remember the little tool nxtRICedit which was developed more than 2 years ago by myself. Since the release of this tool a lot of time is gone and the NXT firmware became open source. This was the initial step for having more information about the RIC file format and I was able to create the new version of nxtRICeditV2:

Please feel free for doing a download from my RIC-Page: http://ric.dreier-privat.de

The new version includes a lot of new features:

- Support of all nine different RIC elements
- Any sequence of RIC elements within a RIC file
- No limitation of count of RIC elements inside a RIC file
- Direct usage of given parameters
- Translated parameters by using VarMap elements
- Monochrome bitmaps inside Sprite element up to 1024 x 512 pixels
- More than one bitmap inside a RIC file
- Merge of RIC files
- Save and store of parameter values for late usage
- Import of values for defining the VarMap elements
- Import of graphic files for creating of Sprite elements
- Additional tools for manipulating of Sprite elements

But unfortunately NXT-G doesn't support forwarding of parameters for displaying of RIC files --> Not all of the new features can be used by NXT-G. But together with NXB/NXC you can all the functions which are already implemented inside the Lego standard firmware of the NXT!

Don't hesitate to send me a mail when you have questions!

Have a nice day
Andreas
ronmcrae wrote: As a frequent user of RICEDIT version 1 I have admired your work for some time. Today I have downloaded V2 and from what I have seen after just a few minutes of playing you have made creating terrific animated graphics very easy for all of us NXC'ers.

Thank you very much.

(IMG:style_emoticons/default/rolleyes.gif) (IMG:style_emoticons/default/rolleyes.gif) (IMG:style_emoticons/default/rolleyes.gif) (IMG:style_emoticons/default/rolleyes.gif) (IMG:style_emoticons/default/rolleyes.gif) (IMG:style_emoticons/default/rolleyes.gif) (IMG:style_emoticons/default/rolleyes.gif)
mike1 wrote: Quite the opposite for me. I find it a little difficult to use for more lower level people. The v1 made it much more straight forward as this, it takes sometime. What exactly are perameters. BTW I'm a NXT-G'er (IMG:style_emoticons/default/smile.gif)
John Hansen wrote: To create an RIC just like what you could with version 1 just follow these simple steps:

1. Add a Description.
2. Add a Sprite.
3. Draw your image on the sprite canvas.
4. Add a CopyBits.
5. Click "adapt parameters to sprite".
6. Click on the Description in your list of steps.
7. Enter Width and Height to match the size shown for your sprite.
8. Save

You don't need to use parameterized values or any of the fancier features available in Andreas' new utility.

John Hansen
mike1 wrote: What I did in RIC edit V1 is just make a picture and save it. Now I getting confused with sprites, bites, and parameters.
I'm not to good in thoose vocabulary...
NXTboy wrote: This is fantastic!!
NXTFreak wrote: Hm, I really liked the first version, but this one just confuses me. I have no clue what sprites and bitmaps and varmaps are. I know I sound very stupid and ignorant, but I don't know NXC, so that may be why. But I bet this is really great for all who do program in NXC and other text based languages. With all of the new advanced options (which I don't know how to use (IMG:style_emoticons/default/laugh.gif) ), this is probably a great new tool for most users. Thanks for putting in the time to create this program for the Mindstorms community. NXTFreak

Re: NXTasy Salvaging

Posted: 17 Oct 2010, 19:40
by muntoo
From the dusty, dark recesses of my computer's hard drive:
(Custom font size has been set to 200.)
nxtboy_iii wrote: NXT WWG (World War Game)
Download here: [attachment=3020:World_War_Game.zip]

I WILL BE CHANGING VERSIONS CONSTANTLY, SO KEEP DOWNLOADING


HELP WANTED:
If people would like to contribute, it would be very much appreciated -- I will give credit to people who do. They can post code, or any other things for it. If you want to help, PM me or tell me on this topic. Just explain what your code does, so I can understand what you want me to do. Then I can put it all together. We can all help. :)

-I am picturing machine guns in it, army men, defense bases, tanks, and other war things. Someone can create sprites for it.


RECENT ADDITIONS:
NEW VERSION!
Version 2.0 (a.k.a.: THE ULTIMATE UPGRADE)
-Music AND sound effects. :D
-Other stuff, mostly listed in "INSTRUCTIONS" (below)
-I added some comments to the variables section.


INSTRUCTIONS:
-1st menu is buy a gun, 2nd menu is buy a tank, 3rd menu is upgrade, 4th menu is buy spikes for $800 (2 available), 5th menu is get a army man to send out (dies if hits tank), 6th menu is sell a gun(#1 is bottom gun, #2 is middle gun, #3 is top gun).
-If you press the abort button it sends out a nuke that destroys all(Costs $200).
-If you press the touch sensor (Port 1) then you send out a missile(Costs $50).
-If you don't have the machine gun yet, then press the dark gray button to drop a bomb on the plane.

-Don't download the HOW_TO_PLAY by itself. There is already a #include in the main file.


CREDITS:
Original Program Author: nxtboy_III
Helpers:
-WarGames007 for volunteering to help me
-muntoo for helping me (and still is)
-Spiller for giving me some ideas


THIS IS THE BEST NXT WAR GAME EVER!! (And the only one, as of April 15, 2010)


Thanks, and have a nice day,
nxtboy III



[attachment=3020:World_War_Game.zip]

Re: NXTasy Salvaging

Posted: 17 Oct 2010, 20:40
by nxtreme
Tutorial by Guy Ziv about how to use the Ultrasonic sensor in Ping mode. Brian Davis also talked about this a bit on TheNXTStep blog (Ping!)but I haven't seen him around at all since the move to MiBo... hope we haven't lost him as well :cry:.
Guy Ziv wrote:One of simplest, yet quite cool, stuff you can do with the I2C Write block is work with your US sensors in “ping” mode, i.e. measure distance by command instead of continous operation. Let’s look at the following sample NXT-G program (click to expand):

The first US Block initializes the US sensor (i.e. set’s the sensor to LOWSPEED_9V and RAWMODE), and performs a read call. Since this is the first read call in the program, it also sets the sensor to work in continous mode. Any other US sensor blocks afterwards DON’T do either of these operations, only read from the US sensor ‘measurement 0′ byte (i.e. distance of closest object). The first time the I2C Write in the loop is called it turns the sensor to work in ping mode, ping once and store the measurements (the US sensor measures the 8 closest distances each time, see below). Next times, it just tells the sensor to ping. You can use the “regular” US Sensor block to read the last distance stored. Try changing the time delay on the Wait block and see how this works. The last I2C block returns the sensor to the “regular” mode, just to be extra safe…

Now for something more exciting - as I said the US sensor measures 8 distances. The US Sensor block gives access only to the first (closest) object. Extending the previous program we now use the I2C Read to read and display the remaining 7 distances:

Last, but not least, we can now work with two US on the same NXT with alternating pinging. First we should set both sensors:

and then we loop, pinging both sensors (a delay between sensors may be needed to allow echos die out before second sensor fires, in my tests it didn’t show any effect) and showing measurements:

* Contributer: Guy Ziv

Re: NXTasy Salvaging

Posted: 17 Oct 2010, 20:55
by HaWe
I already posted the ping mode here as you not might have been aware of... ;)
https://sourceforge.net/apps/phpbb/mind ... ?f=3&t=100

Re: NXTasy Salvaging

Posted: 17 Oct 2010, 21:07
by nxtreme
doc-helmut wrote:I already posted the ping mode here as you not might have been aware of... ;)
https://sourceforge.net/apps/phpbb/mind ... ?f=3&t=100
Yes, now that you mention it, I do remember your post :). Shows how good my memory is...

Re: NXTasy Salvaging

Posted: 18 Oct 2010, 05:05
by mightor
Guys, I would prefer it if you could make the salvaged threads as separate threads on these forums to make it easier to find them again.

Thanks!

- Xander

Re: NXTasy Salvaging

Posted: 18 Oct 2010, 05:27
by muntoo
mightor wrote:Guys, I would prefer it if you could make the salvaged threads as separate threads on these forums to make it easier to find them again.

Thanks!

- Xander
How about post the stuff here as a link to the thread of the salvaged threads?
I mean, sort of like how Ford Prefect doc-helmut did:
doc-helmut wrote:I already posted the ping mode here as you not might have been aware of... ;)
https://sourceforge.net/apps/phpbb/mind ... ?f=3&t=100

Re: NXTasy Salvaging

Posted: 18 Oct 2010, 06:40
by mightor
Muntoo,

Sounds good :)

- Xander

Re: NXTasy Salvaging

Posted: 24 Oct 2010, 04:34
by muntoo
http://webcache.googleusercontent.com/search?q=cache:5uSti1JrDRwJ:forums.nxtasy.org/index.php%3Fshowtopic%3D4046+forums.nxtasy.org+spiller+rpg&cd=1&hl=en&ct=clnk wrote:
nxtasy.org forums > LEGO Mindstorms NXT > NXT Projects
5 Pages 1 2 3 > »
NXT RPG, In progress
Options
Spiller
Jul 31 2009, 05:54 PM
Post #1


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



NXT RPG
A turn-based role playing game for the NXT which features similar gameplay as the Pokemon games for Game Boy.
Work in progress!

Goals
Fully customizable
As much game data as possible is placed outside the executable.
...


Current features (development build)
Game maps with custom graphic and variable size.
Character "templates", character is defined by an ID and level and other stats is calculated based on the template.
--Character sprite
--Character name
--Character stats (attack, defense, speed, hit points, power points
Basic Save system
Text boxes
Move between different maps or teleport into a specific position on a map.


Possible future additions
Animated intro screen *2 (Maybe not anyway, only up to 10 IDs in RIC files? what kind of number is that??)
Attacks *X (expected to be done in v0.7)
Battles *X (expected to be done in v0.8)
Character types *X
Music as "MIDI" files *3 (Depends on CPU usage)
NPCs *3 (No idea how this should be done right now, but pretty crucial...)
...

*3 unlikely to be added
*2 likely to be added
*1 will probably be added
*X will be added (if everything goes well ; ) )


Requirements
Playing the game:
NXT with enhanced firmware 1.28
4 touch sensors

Compiling/code browsing:
NXC code: BCC, possible pre-release build
C++ code: I used MinGW, but Visual C++ and others should also work just as good.
XML and XSL files (editing): any text editor should be good...
XML+XSL files (viewing): Opera 10 or Firefox 3.6. (IE will not work.)


Status
Current version: 0.7
Version 0.8 status: Early stage


Downloads:
Version 0.7 (binary): NXT_RPG_0.7_bin.zip ( 35.76k ) Number of downloads: 5

Version 0.7 (source): NXT_RPG_0.7_src.zip ( 481.02k ) Number of downloads: 17

Version 0.6: NXT_RPG.zip ( 26.66k ) Number of downloads: 27

Snapshots:
Revision 75 (both): NXT_RPG___revision_75.zip ( 575.77k ) Number of downloads: 7


The game as of version 0.7
(The images might be a little newer than the one in the zip though...)
lvl1___v0.7plus.png ( 1.05k ) Number of downloads: 3
textbox___v0.7plus.png ( 100.05k ) Number of downloads: 1

The first level and a text box

character_info___details_overview___v0.7plus.png ( 100.05k ) Number of downloads: 1
ingame_menu___v0.7plus.png ( 100.05k ) Number of downloads: 1

The character info screen and the in-game menu.

Any feedback or suggestions are appreciated.



Andy
Jul 31 2009, 06:16 PM
Post #2


Proud NXTasy.org member!


Group: Members
Posts: 1,034
Joined: 17-July 06
From: Norway
Member No.: 45



Nice work, spiller! I will test it out as soon as I get the chanse (IMG:style_emoticons/default/smile.gif)
Keep us update on how the game's doing!

Regards,
Andreas



sidneys1
Jul 31 2009, 07:08 PM
Post #3


Programmer


Group: Members
Posts: 773
Joined: 23-May 07
From: PA
Member No.: 2,272



Nice! I like the in-game menu... how functional is it? And how functional is the Main Menu?

It's funny, You made the menus first, and are now probably working more on the 'game' part. I, in my game, made am making the 'game' part first, and then will work on the menus and etc. (IMG:style_emoticons/default/biggrin.gif)

Have a nice day,
~Sidneys1



Spiller
Jul 31 2009, 08:24 PM
Post #4


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



Main menu:
New game: Loads "Start.dat" which read possision where player starts (level number and x,y)
Load: enters a emtpy screen: A or B to get back
Options: the same
Exit: stops the program

Ingame:
Only Exit works, which removes the menu again. (all selectable though). B will exit too.
I had made a subroutine which showed charrecter stats, but the file with this made very strange chrashes. (I make a empty multiline comment, and the game chrashes... I didn't change anything which compiles and it chrashes!!!) So rewriting that part...


Actually, I haven't spend much time with those menus. (but they are easy to show on a screenshot) Most time have been used with making the varible system in the background as flexcible as possible and the code to get it work. And trying to make it draw the level on the screen faster...

So far it looks like the levels are completly done. When changing level, the new level is correctly loaded, redefining the size of the array and selecting new RIC file. (It will still be modified sligthly though...)

I have added events, which moves the player (to a new point or level) or shows a text box. But the text box is pretty bad... So next thing I am doing is to make my own custom font. Graphic done now, all ANSII charrecter from 32 to 126 (signs, numbers, upper case and lower case, heigth is 7 pixels). The challenge will be to make intelligent word wrapping now. : P

And I migth want to change the string loading function. Rigth now it reads the first byte to define the length of the string and then the correct number of charrecters, but this limit strings to 255 charrecters in length... But maybe it is enough?



Xander Soldaat
Aug 1 2009, 12:35 AM
Post #5


Captain Oblivious


Group: Members
Posts: 1,310
Joined: 23-February 08
From: Rotterdam, The Netherlands
Member No.: 4,793



Spiller,

Pretty impressive what you're managing to squeeze out of the NXT. Will there be NPCs and mobs as well?

Gr,
Xander



Spiller
Aug 1 2009, 05:15 AM
Post #6


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



Right now I don't know how to include NPCs, but I hope too add it. Rigth now there is support for static NPCs if you place one on the map and add a text or a level move event onto it. (I am adding a level_type_2, which will contain the battles.)

mobs will appear in the same way as in pokemon, they appear out of nowhere when you walk in certain areas. I'm thinking of changing the solid state of the map into a normal byte which will refer to a second more detailed stuct. This struct will then have the solid state, chance of event and possible others.


Update:
Font works now:
Font7px.png ( 564bytes ) Number of downloads: 4


It was actually pretty easy to get to work. It took some time to write all widths and posstions, but not that bad after all. (I haven't checked it completly yet though, so there could be a few errors hidden somewhere...)

Now to the hard part, intelligent word wrapping...
Edit: I don't know if it really can be called "intelligent" word wrapping, but at least word wrapping. (entering a new line when next word can't be fully on the screen)



Spiller
Aug 9 2009, 03:24 AM
Post #7


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



Word wrap works now : D
Or rather, I haven't found any bugs so far ; )

However it is quite slow... For a string that was 6 lines long, this took a full second...
But I saw a article about this on wikipedia, and it looked like it showed different solutions to the problem there. But I didn't look closer, I wanted to do it myself first.
So there migth be a faster method there.


I also made it possible to only draw certain lines. Rigth now this limits it to 256 lines. (I wouldn't need more though, I have a max on strings on 255 charrecters in the rpg rigth now.) But it is a really easy fix though...
example of full text:
word_wrap_full.png ( 674bytes ) Number of downloads: 6


Only showing line 2 and 3:
word_wrap_line_2_and_3.png ( 345bytes ) Number of downloads: 5

(edit: just noticed it looked bigger than on the other pic, there is an extra line between the text, fixed it now.)


Another thing, since I need to access the width of a charrecter in the program, I had to place the charrecter info in the program instead of the ric file, which means the program fills ~7000 bytes...
But I can place some of this in the ric file though, it should bring the size down a bit, but I still need every single chars width in the program...

Rigth now I have it as a switch, like this:
CODE
byte Font7width(const byte &charrecter){
//give width of charreter
switch(charrecter){
case 32: return 3; break; // (space)
case 33: return 2; break; // !
case 34: return 4; break; // "
case 35: //return 6; break; // #
case 36: return 6; break; // $
case 37: return 7; break; // %
I was wondering, can you change the order of the cases and if, will it inpact speed?
Because I was wondering to do something like this:
CODE
switch(charrecter){
case 33:
case 39:
case 46: return 2; break;
case 32:
case 41: return 3; break;
I think this should bring the size down a bit if I add them all under the same return break statements. But is it possible, and if it is, will it affect speed?

Edit: since I'm really stupid I didn't think of just trying it... Just a quick test, it compiled fine and speed didn't seem to change. Of course this didn't vertify mixed order works flawless, but it seemed to work fine.

Update: Did a full test, it worked fine, it even ran faster! Not much (150 msec), but it was faster anyway! Edit: actually, 150 isn't that little, it is over 10%...
Edit 2 because I forgot to mention it:
Before the change, the program used 7800 bytes, now it is 6800 bytes, so about 1000 bytes down in size. If I move the other parts into the ric file, it should go down quite a bit. I don't know how this will affect speed though.


Update:
Only the charrecter width is in the program now. Program size is 4000 bytes and ric file is 700.
Speed for that string is 775 msec now.
I have added it here so anyone interested can try it. Still first version and not completly tested, so maybe some bugs?
Font7pxOut(x,y,string); outputs the text on a single line.
Font7pxWrapOut(x,y,edge,string,start,end); outputs a string by using multible lines.
Arguments: (I shortned the names)
edge: A vertical line where the letters may not be printed and therefore first printed on next line. This is a fixed point on the screen. Use 100 for rigth edge of the screen.
start: the first line to draw. starts with 0. (I use this for scroling the text, since I will only be showing two lines at a time in the RPG.)
end: the line which it should stop drawing. Set this to false if you want everything to be displayed.
(example, start = 2, end = 4, results in line 2 and 3 will be displayed.)

The zip:
Font___word_wrap.zip ( 2.64k ) Number of downloads: 6



muntoo
Aug 16 2009, 04:02 PM
Post #8


The Great Evil Genius


Group: Members
Posts: 1,067
Joined: 17-January 09
From: Your Worst Nightmare
Member No.: 6,714



I can't seem to understand how any of it works (I mean how to play the game).

A suggestion would be to make use of BTNEXIT.
The preview should stay on the screen before getting holes poked in it for 2 seconds (or until you press enter). And the hole poke should be faster (fire the rifles!!!!)

Can you tell us how to play/work the menus (that don't work, I know, but later on).

EDIT: Oh yeah, it looks good for a game that isn't done yet... I think.



Spiller
Aug 18 2009, 05:00 AM
Post #9


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



QUOTE(muntoo @ Aug 16 2009, 11:02 PM)
I can't seem to understand how any of it works (I mean how to play the game).

A suggestion would be to make use of BTNEXIT.
The preview should stay on the screen before getting holes poked in it for 2 seconds (or until you press enter). And the hole poke should be faster (fire the rifles!!!!)

Can you tell us how to play/work the menus (that don't work, I know, but later on).

EDIT: Oh yeah, it looks good for a game that isn't done yet... I think.

The input is done with sensors mostly, so if you are just trying to press the nxt buttons, it wouldn't work.
Rigth now, you press two touch sensors to move sideways and using a motor (rotation sensor) to more upward and downwards. (this was done because of the contest, it doesn't really work that well...) Action key is left NXT button and back (not always used...) is the rigth NXT button. The middle button is rigth now only used to open the ingame menu.
Anyway, you migth want rigth now to change the input to other sensors, buttons. Just open the input_handlers.nxc file, (I think that is the name...) and find the task GetInput and change the sensors there, and it will work for the whole program.
(Direction is input.dpad[], where input.dpad[0] is up, input.dpad[1] is right, input.dpad[2] is down, and input.dpad[3] is left. Everything is bool, I don't think it will be too hard to figure out.)

I still need to work a bit on the input system, menus work fine, but moving around on the map migth seem a bit wierd right now... I have a idea right now, but I have to see how well it works.


The menus:
You move around with the dpad, accepts a choise with the action button, and exits with the back button. (the back button migth not be added in all menus right now though.)



I hope to release the version 0.7 before saturday, but I have had a hard time concentrating lately... (I only worked a bit on the text box with word wrap...)
Anyway, the controls are made to fit my needs when debuging, but if any want to try it, I can change into something specific if you want. It just need to control 3 buttons and give a direction (up, down, right, left). So if you want it, say how you want to control it and I will change it in the released v0.7.



NXTboy
Aug 21 2009, 06:20 AM
Post #10


Advanced Member


Group: Members
Posts: 475
Joined: 1-September 07
From: UK
Member No.: 3,844



QUOTE(Spiller @ Aug 9 2009, 09:24 AM)
Another thing, since I need to access the width of a charrecter in the program, I had to place the charrecter info in the program instead of the ric file, which means the program fills ~7000 bytes...
But I can place some of this in the ric file though, it should bring the size down a bit, but I still need every single chars width in the program...

Rigth now I have it as a switch, like this:
CODE
byte Font7width(const byte &charrecter){
//give width of charreter
switch(charrecter){
case 32: return 3; break; // (space)
case 33: return 2; break; // !
case 34: return 4; break; // "
case 35: //return 6; break; // #
case 36: return 6; break; // $
case 37: return 7; break; // %
Two things:

character is the correct way to spell "charrecter"

Arrays are your friend. Here's the code I used for my font:
CODE
#define Font7width(x) charwidths[x-32];
int charwidths[] = {1,1,3,5,5,6,5,1,2,2,2,3,1,2,1,2,4,2,4,4,4,4,4,4,4,4,1,1,4,4,4,4,8,6,6,6,6,5,5,6
,6,1,4,5,4,8,6,6,6,6,6,5,5,5,5,7,5,5,5,2,2,2,3,4,2,4,4,4,4,4,2,4,4,1,1,4,1,7,4,5
,4,4,2,4,2,4,4,5,3,3,3,2,1,2,4};



Spiller
Aug 21 2009, 07:44 AM
Post #11


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



QUOTE(NXTboy @ Aug 21 2009, 01:20 PM)
Arrays are your friend. Here's the code I used for my font:
CODE
#define Font7width(x) charwidths[x-32];
int charwidths[] = {1,1,3,5,5,6,5,1,2,2,2,3,1,2,1,2,4,2,4,4,4,4,4,4,4,4,1,1,4,4,4,4,8,6,6,6,6,5,5,6
,6,1,4,5,4,8,6,6,6,6,6,5,5,5,5,7,5,5,5,2,2,2,3,4,2,4,4,4,4,4,2,4,4,1,1,4,1,7,4,5
,4,4,2,4,2,4,4,5,3,3,3,2,1,2,4};Thanks, I will try it out. It should speed things quite a bit and perhaps a little on the memory usage? I will probably use byte though, unless int is much faster, but I will try that too.



NXTboy
Aug 21 2009, 08:50 AM
Post #12


Advanced Member


Group: Members
Posts: 475
Joined: 1-September 07
From: UK
Member No.: 3,844



QUOTE(Spiller @ Aug 21 2009, 01:44 PM)
Thanks, I will try it out. It should speed things quite a bit and perhaps a little on the memory usage? I will probably use byte though, unless int is much faster, but I will try that too.
Yeah, use byte: it takes up half the space. In fact, use const byte. That might save memory usage, and will prevent accidental width modification.



Spiller
Aug 22 2009, 03:40 AM
Post #13


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



QUOTE(NXTboy @ Aug 21 2009, 03:50 PM)
Yeah, use byte: it takes up half the space. In fact, use const byte. That might save memory usage, and will prevent accidental width modification.I'm done with changing it now. (had to recharge the batteries, and couldn't find any others -__-)
Speed have been improved with 200msec (total 580msec) for the example sting, and filesize has went down 1000 bytes to a total of 3000 bytes now.
I tried to use int instead of byte, and surprisingly it was a bit slower. (588 msec) Not a speed difference that really matters, but considering you can cut the memory usage in half...

Anyway, I chose to make the function like this istead of using a macro:
CODE
byte Font7width(const byte &charrecter){
//give width of charreter
if((charrecter > 31)&&(charrecter < 127))
return charwidth[charrecter-32];
else
return 0;
}
This should prevent the program from chrashing if there is any control charrecters or otherwise unsuported charrecters in the string.

I was wondering to make an array struct containing information about how the string is breaked. So when showing scrolling text like in the RPG, I wouldn't need to recalculate the full string, I would just read the information from the struct.
I still need to optimize the function though...



midcyber
Sep 7 2009, 12:08 PM
Post #14


Newbie


Group: Members
Posts: 4
Joined: 20-February 08
Member No.: 4,771



As experienced mobile game developer, I would recommend to you use of monospace font.
i.e. where all characters of a same width.
This way, you can save time in two areas:
1) Calculating letter width
2) You can preformat your text on PC, and then no need in word wrap.
However, I know, developing dynamic word-wrapped is fun and gives a lot of experience (IMG:style_emoticons/default/wink.gif)



Spiller
Sep 7 2009, 04:03 PM
Post #15


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



QUOTE(midcyber @ Sep 7 2009, 07:08 PM)
As experienced mobile game developer, I would recommend to you use of monospace font.
i.e. where all characters of a same width.
This way, you can save time in two areas:
1) Calculating letter width
2) You can preformat your text on PC, and then no need in word wrap.
However, I know, developing dynamic word-wrapped is fun and gives a lot of experience (IMG:style_emoticons/default/wink.gif) Yes, the main reason for doing it was because of it being fun. Secondly, I couldn't find any with all ANCII characters, not even one with lower case letters. So by doing it now, I will have a font I can use in many other cases.
I will still mainly be using the other font, since my new font is larger and I don't need it that much. I think I will use the new font mainly for text inputted by the user (this is also text from data files) and the other for text hardwired in the program.

So I will continue with making the word wrap function. Mainly optimizing it, but I am also thinking about adding a function to store how a string is wrapped for use when text is scrolled. (so it doesn't need to recalculate the whole string just move one down...)

But that will wait for later, right now I will work on adding game characters and afterwards some battle mode.



Spiller
Oct 30 2009, 04:38 PM
Post #16


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



As I said in the other topic, I'm finally continuing the project. Almost 2 months, somehow I thought it was much more...

Just to show the project is alive again, here is a screenshot of the submenu where you can see more details about your characters:
Character_select.png ( 592bytes ) Number of downloads: 2

There is still needed quite a bit of work on this submenu though...
But this means I'm finally beginning to start on the game mechanics and after this submenu is done, I will start right away with Level_Type_2 which will contain all battles.


Secondly, I started organizing my project folder using SVN (just locally). I wanted to keep the older versions for the record, but they made my folder confusing to browse though, this might solve that. And it will be quite a bit easier to move the project to my laptop if needed.
So this will basely be a test to see if SVN could be useful for me.


Spiller



Linus
Nov 1 2009, 08:31 PM
Post #17


Loving to code


Group: Members
Posts: 939
Joined: 21-March 08
From: Aachen, Germany
Member No.: 4,951



QUOTE(Spiller @ Oct 30 2009, 10:38 PM)
Secondly, I started organizing my project folder using SVN (just locally).
...
So this will basely be a test to see if SVN could be useful for me.
Version control is one of the greatest things ever for programmers! There is a free SVN book available somewhere on the homepage. If you're using Windows, definitely check out TortoiseSVN!!
And while we're at it: If you're really just using it locally for now, you might like Git or Mercurial. Those are distributed version control systems, and you can easily commit changes without having to install or configure a server! There are TortoiseHG (for Mercurial) and TortoiseGit versions, too (not as perfectly matured as TortoiseSVN, but still ok).



Spiller
Nov 2 2009, 03:31 AM
Post #18


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



QUOTE(Linus @ Nov 2 2009, 02:31 AM)
Version control is one of the greatest things ever for programmers! There is a free SVN book available somewhere on the homepage. If you're using Windows, definitely check out TortoiseSVN!!I saw that book, read one chapter of it while in school. I already had TortoiseSVN installed since I needed to download the source code of a game so getting everything to work was actually surprisingly easy, I hadn't expected that.

QUOTE(Linus @ Nov 2 2009, 02:31 AM)
And while we're at it: If you're really just using it locally for now, you might like Git or Mercurial. Those are distributed version control systems, and you can easily commit changes without having to install or configure a server! There are TortoiseHG (for Mercurial) and TortoiseGit versions, too (not as perfectly matured as TortoiseSVN, but still ok).For now I guess I will just keep it like this since I actually needs my NXT to work on it, so I do not have much use of working at it on school or other places. But if I start a normal programming project I might try them out.

So far it seems great.


The project is going along pretty well in the moment.
I have added a file to contain all character names where the name is loaded as needed. (To avoid having too many strings in memory.) Even without any optimizations I didn't notice any delay, though this was only with a file 6 strings long. But it seems to be fast enough to load data from files when needed instead of keeping it in the memory all the time.
And I just finished the major time killers from school in the weekend, so I should have some more time to work on it now. : )



Spiller
Nov 14 2009, 12:41 PM
Post #19


Advanced Member


Group: Members
Posts: 407
Joined: 1-October 07
From: Denmark
Member No.: 3,987



I save the data files as binary files. The files containing the map can easily get up to 500-1000 characters and when everything is just saved as one long string of random numbers this get rather confusing and almost impossible to edit...

So I'm trying to find a data type which I can edit which will then be changed into the binary file used on the NXT.
Since we have been working a lot with XHTML and CSS in school I researched on XML. Saving it as a XML file could be rather useful because you can transform it into HTML and with the combination of a little CSS magic it will give a visual representation of the data.

I tried it, and you can see how it looks in the browser here:
map.png ( 1.58k ) Number of downloads: 22

(The blue color shows that it is solid and cannot be walked though.)

However I doubt it would be easy to make a program to read it and change it to a binary file...
But perhaps I can use XMLT again, if I make it paste the numbers like this: "&#"number";"? Even though I might not get the file directly, it should be easier to work with...

Anyone that knows of a better method?


And just a small update:
1.png ( 589bytes ) Number of downloads: 2
2.png ( 559bytes ) Number of downloads: 1


3.png ( 437bytes ) Number of downloads: 1
4.png ( 590bytes ) Number of downloads: 1

(You can move the characters in the list, you can see the result in the last image.)
(and btw, I like the new color background color in "NXT Screen")


Edit: I used XSLT to change the XML into a string which stored the number like this: "#xxx;" (where xxx is the number.) and boolean values like this for true: "&t;" and this for false: "&f;". I got a small c++ application to open that string and save a binary file based on this. So I found a working solution. (though the c++ app is rather bad written at this point...)



nxtboy III
Nov 29 2009, 09:33 AM
Post #20


Advanced Member


Group: Members
Posts: 401
Joined: 18-July 09
From: EVERYWHERE!!!!
Member No.: 7,759



QUOTE(Spiller @ Nov 14 2009, 01:41 PM)
I save the data files as binary files. The files containing the map can easily get up to 500-1000 characters and when everything is just saved as one long string of random numbers this get rather confusing and almost impossible to edit...

So I'm trying to find a data type which I can edit which will then be changed into the binary file used on the NXT.
Since we have been working a lot with XHTML and CSS in school I researched on XML. Saving it as a XML file could be rather useful because you can transform it into HTML and with the combination of a little CSS magic it will give a visual representation of the data.

I tried it, and you can see how it looks in the browser here:
map.png ( 1.58k ) Number of downloads: 22

(The blue color shows that it is solid and cannot be walked though.)

However I doubt it would be easy to make a program to read it and change it to a binary file...
But perhaps I can use XMLT again, if I make it paste the numbers like this: "&#"number";"? Even though I might not get the file directly, it should be easier to work with...

Anyone that knows of a better method?
And just a small update:
1.png ( 589bytes ) Number of downloads: 2
2.png ( 559bytes ) Number of downloads: 1


3.png ( 437bytes ) Number of downloads: 1
4.png ( 590bytes ) Number of downloads: 1

(You can move the characters in the list, you can see the result in the last image.)
(and btw, I like the new color background color in "NXT Screen")
Edit: I used XSLT to change the XML into a string which stored the number like this: "#xxx;" (where xxx is the number.) and boolean values like this for true: "&t;" and this for false: "&f;". I got a small c++ application to open that string and save a binary file based on this. So I found a working solution. (though the c++ app is rather bad written at this point...)



AWESOME!!! When will you be finished?