DescriptionPoly3D is a flat-shaded 3D engine for SmileBASIC. The engine supports flat-shaded polygonal 3D models defined with triangles (no lighting support). It is a lightweight engine optimized for performance. This engine evolved from my earlier Wire3D engine.
Performance tests (New 3DS, rendering rotating models, no gameplay code):
0 - 190 triangles onscreen: 60fps
190 - 390 triangles onscreen: 30fps
390 - 630 triangles onscreen: 20fps
660 triangles onscreen: 15fps
Version 1.1.0 (13 December 2018)
Added FIRSTPERSON example game. Move around and shoot targets as fast as possible. Demonstrates depth-sorting, 3D camera movement and rotation, and basic collision detection. 60 fps on a New 3DS
(No engine changes)
Version 1.1.0 (2 November 2018)
Added STARBLITZ example game. Fly your spaceship and avoid the obstacles. Demonstrates depth-sorting, 3D movement and rotation, and basic collision detection. 60 fps on a New 3DS
Engine, Model Editor: Fixed numerous issues with axes being double-or-triple reversed
Model Editor: Fixed vertex movement controls sometimes being reversed
Model Editor: Reversed the z-axis. Now the coordinate system behaves like Blender 3D, as I had originally intended
Model Editor: Added some parsing code for OBJ files (not tested; how would I get an OBJ file into SB in the first place?)
Model Editor: Added buttons for copying and pasting face colors
Many other minor bug fixes
Version 1.0.1 (24 October 2018)
Fixed error if you deleted all faces from a model
Fixed slider values being constantly reapplied until you tapped somewhere else on the touch screen
Save/Load remembers the last file name you entered, so that you don't have to keep re-typing it each time you save
Added an example model Pumpkin.3D
Version 1.0 (24 October 2018):
Rewrote Poly3D into a compact common library that can be easily used by other programs
Added Poly3D Model Editor v1.0 (compatible with New 3DS or Circle Pad Pro). This is a simple model editor with limited features, but should be good enough for creating simple models.
- Create 3D models with colored faces
- Save / Load 3D model files
- Camera controls
- In addition to the main camera, the model is displayed as a wireframe in three orthogonal views (Front, Left, Top) on the touch screen
- Undo / Redo functionality
Added a GUI library which can be used to draw interactive buttons, checkboxes, and sliders on the touch screen
Note: I released this latest update much earlier than I was planning, so that others can use the included model editor. This version does not contain any other example projects. I am hoping to release another update sometime in the next month or so with additional examples of the engine in use, but can't make any promises. Hopefully I won't disappear for 3 years again! :)
Version 0.8 update:
*Supports rotation on all 3 axes (uses Euler rotation and suffers from gimbal lock, so I don't recommend rotating on all 3 axes at the same time)
*Uses GPAGE buffer to eliminate draw flicker (thanks Trinitro!)
*Fixed support for multiple models in a single scene
*Added two new models, a cube and a Starwing, which definitely isn't borrowed from any old Nintendo games
*Added more models and animations to the sample scene to better demonstrate the engine. The sample scene includes over 200 polys and runs at 60fps on a New 3DS
Version 0.7 (initial):
*Supports 3D models with per-face coloration
*Supports instancing models, reducing memory usage
*Models can be translated and rotated
*Depth-sorting so faces are rendered in the correct order
*Screen-space culling - models that lie outside the screen coordinates are not processed, reducing render time
*User can walk around with D-pad or analog stick and aim with touch-screen or gyro controls
*Faces darken with distance, so models gradually fade into background
*Radar on lower screen shows player position in relation to models
*Code is reasonably well-documented
*Sample scene included
Planned features for the future:
*Support for lighting
*Scaling support for models
*Actual gameplay features
Known issues:
*There is some distortion to the models when rotating on X and Y axis at the same time; I'm looking into itInstructionsControls for Starblitz: D-Pad moves camera, Circle Pad moves ship
Controls for FirstPerson: Circle-pad to move, touch-screen to aim, L or R to shoot
Instructions for using the model editor:
Load P3DModelEditor into Slot 0, and press Start. The model editor launches with a default cube model. The general idea is that you position points, called "vertices", and then connect them with triangles, called "faces". For example, a cube has 8 corners, so it has 8 vertices. Each side of a cube is a square, which requires two triangles to draw, so 12 faces in total.
Controls:
- A: Start moving vertex; confirm vertex position (Vertex mode). Confirm selected vertex (Add Face mode)
- B: Cancel moving vertex (Vertex mode)
- X: Select next vertex/face
- Y: Select previous vertex/face
- L: (hold) Increase movement speed (while moving vertex in Vertex mode)
- R: (hold) Decrease movement speed (while moving vertex in Vertex mode)
Touch screen controls should be mostly self-explanatory.
To create new vertices, press "Add Vert" while in Vertex mode.
To create new faces, press "Add Face". Select the first vertex and press "A". Repeat for two more vertices. When three have been selected, a new face (triangle) is created that connects the three selected vertices.
The RGB sliders can be used to edit the color of the selected face in Face mode. They have no effect in other modes.
Note: this engine is unrelated to the P3D engine; the "P3D" in "P3DModelEditor" is short for "Poly3D".NotesIncludes:
- POLY3D.LIB: Engine library
- GUILIB.LIB: Touchscreen GUI library
- P3DMODELEDITOR: Model editor for Poly3D
- STARBLITZ: simple example game, fly your ship and avoid crashing into obstacles
92 Comment(s)thou_fatGAMER12Avatar TabooI didn't change my avatar for 180 daysWebsiteVideo GamesI like to play video games!HobbiesNight PersonI like the quiet night and sleep late.Express YourselfMan this looks really cool. Maybe I can use it for the fan game I've always wanted to make! Sad things is I lost my 3DS. :-(thou_fatGAMER12Avatar TabooI didn't change my avatar for 180 daysWebsiteVideo GamesI like to play video games!HobbiesNight PersonI like the quiet night and sleep late.Express YourselfAlso is it possible to load textures? (Probably not)randoIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteTextures don't exist in this.TheV360Pokemon Is Awesome!I love Pokemon!Express YourselfFirst DayJoined on the very first day of SmileBASIC SourceWebsiteNight PersonI like the quiet night and sleep late.Express YourselfTextures are a PlayStation-1-level thing, and even the PlayStation didn't do them 100% right (see affine texture warping)thou_fatGAMER12Avatar TabooI didn't change my avatar for 180 daysWebsiteVideo GamesI like to play video games!HobbiesNight PersonI like the quiet night and sleep late.Express YourselfWell then. I just wanted to make it more detailed. It's still really cool (for me) to be able to make models! Well, if I can find my 3DS anytime soon.
hakkeRNGHiddenEaster EggsQSP Contest 2 Contest ParticipantI participated in the second SmileBASIC Source QSP Contest!Expert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strength☆UwU☆ what's this? can i mwake fwortnwite thwee dee ess with this wondewful engwine OwO twanks pweaseeee oneesan UwU byeeeee!~★★★IAmRalseiForum LeaderHiddenAchievementsSecond YearMy account is over 2 years oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengthi feel like stabbing you just for posting thisrandoIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteIf you really feel like that you need help.hakkeRNGHiddenEaster EggsQSP Contest 2 Contest ParticipantI participated in the second SmileBASIC Source QSP Contest!Expert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthUwU yeah he's rwight owO?? bwaaaah my bwoyfwiend left me uguu~~ bwaaaa Owo!? thwedee fortnwight is cuming Owo!?
ive been like half an hour in the fricking queue to play a battlefield 1 game aaaIAmRalseiForum LeaderHiddenAchievementsSecond YearMy account is over 2 years oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strength
If you really feel like that you need help.
Your reply has one upvote.randoIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteThank you, kohai.
Btw the reply was meant towards your reply, not banana's comment.IAmRalseiForum LeaderHiddenAchievementsSecond YearMy account is over 2 years oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthI am aware.randoIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteI love the editor, but
BUG:
Basically one yellow triangle is not being rendered completely for some reason. It looks like a pink triangle is being rendered above it. (it's up to the right of another yellow triangles, the space between the 3 selected points should be yellow.)
I also love the D-PAD precision. Thank you for not forcing me to use the circle pad :)the_squat1115Second YearMy account is over 2 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteForum ContributorHiddenAchievementsDid you know that the creator is no longer active? Just see his account.randoIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteYeah I know.
Posting bugs is still a good thing to do.the_squat1115Second YearMy account is over 2 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteForum ContributorHiddenAchievementsOk...?kevinfoleyFor performance purposes, I had to fudge the way triangles are depth-sorted. The renderer uses depth sorting to determine what order to draw the triangles in; closer triangles should be drawn after (and thus on top of) further triangles. IIRC, I coded the renderer to determine depth by measuring the distance from the center of the camera to the triangle. This usually works well enough, but can give undesired results if triangles are very close together or very large.
In less technical terms: the engine uses a simple formula to determine which triangle is closer to the camera; this formula usually is good enough but it sometimes makes mistakes and draws triangles in the wrong order.randoIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteCoolkevinfoleyI've added a simple first-person shooter demo where you can move around and shoot missiles at targets (it re-uses the models from the Starblitz demo). Real life has me pretty busy, but if I have time I'll eventually expand the demo into something a little fancier.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!HobbiesSometimes triangles disappear when they are near-orthogonal to the camera.
Your code currently draws the backfaces of models which means that when you have perspective and you sort, the back faces will sometimes be closer than the front when near-orthogonal to the camera. Adding this line of code will only draw one side of triangles, meaning the back faces will be skipped. It should also greatly boost your performance.
Inside of the site's most up-to-date POLY3D.LIB file, consider adding the following to line 124 (maybe line 165 too).
IF
((POINTS[E2,0]
-POINTS[E1,0])
*(POINTS[E3,1]
-POINTS[E1,1])
-(POINTS[E2,1]
-POINTS[E1,1])
*(POINTS[E3,0]
-POINTS[E1,0]))
>=0 THEN CONTINUEThe only issue is that this requires you to update all of your models, since there are inconsistencies in defining clockwise/counterclockwise triangles, so the models are a bit jumbled up, but only one side of them now gets drawn.
I guess this also depends on how you want it to be, since your STARBLITZ demo (which is really awesome btw) has one-triangle-wide wings, which behaves wrong with this change. So, just consider it.kevinfoleyI've never noticed triangles to disappear completely, but I'll keep an eye out for that.
I thought about trying to incorporate normals for the purpose of backface culling and potentially lighting, but I didn't think it would be worth the tradeoffs and performance overhead. I like being able to use the two-sided triangles for flat details, like the wings that you mentioned. Another benefit is that you can make a line by connecting two of the three corners of a triangle to the same vertex, thus not requiring any extra code or edge cases to support lines.
I've noticed that SIM.3D also has issues with occasionally drawing triangles out of order, causing similar flickering near corners.
Thanks, I'm glad you enjoyed the STARBLITZ demo. I may expand it more after I add a few additional demos.
Were you able to adapt the model editor for SIM.3D?
DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengthonce this is like SANIC, you make is even faster by using sprites instead of GTRI, since you would be using sprites, it would be twice as fast when rendering a triangles. This also brings in textures to the mix. We might actually get an engine capable of running games like Crash Bandicoot(1996) at 30FPS Also I have noticed an exceptional difference of rendering speed when you constrain it all to the screen(s). Here is what I used(roughly):
VAR M%,IT%
'draw IT% times because it is less noticable on small scale applications
FOR I = 1 TO IT%
GFILL 0,0,511,511
NEXT
?MILLISEC - M%
GCLIP 0,0,399,239
M% = MILLISEC
FOR I = 1 TO IT%
GFILL 0,0,511,511
NEXT
?MILLISEC-M%
if this doesn't produce usable results, just increase IT%
this also takes care of off - screen culling, too. The culling only actually helps if a part of a triangle is on - screen. If not even a single pixel of a triangle is onscreen, the culling becomes ineffective. GCLIP actually is really useful in this scenario, but even SPCLIP and BGCLIP help, accordingly to what is being rendered.kevinfoleyI do not think rendering with sprites is practical.
I already have a fast screen culling method in Poly3D. My culling method skips not only the drawing, but also many of the 3D calculations. Maybe I'm just not following you, but I don't see how your example code would help.kevinfoleyAs far as I can tell, the Givers P3D game only uses triangle sprites for rendering the intro animation, and the result is an ugly mess of misaligned sprites. The rest of the gameplay seems to use flat-colored faces probably drawn with graphics commands.
If you think you can make a 3D engine with sprites, go ahead, but I personally have no interest in trying to rewrite my engine to use sprites.DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengthlet's say we have a triangle that is partially off - screen. It would draw the rest of the triangle(offscreen) anyway. All I'm doing with this code is showing how GCLIP can improve performance by making it check "is this pixel I'm about to draw past the boundaries? Yes, so I can skip this one"
this code proves sprites are faster to draw:
VAR M%,I%
M% = MILLISEC
WHILE MILLISEC-M%<1001:GFILL I,0,15,15:INC I%:WEND
?"a moving box can be drawed",I%,"times a second"
I% = 0'reset it from our last test
SPSET 0,0'16x16 size
'since we are only [i]moving[/i] the sprite anddrawing it, don't include initialization of it.
M% = MILLISEC
WHILE MILLISEC - M%<1001: SPOFS 0,I%,0:INC I%:WEND
?"a moving sprite can be drawed",I%,"times a second"
DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengthalso, P3D has unaligned sprites because of the trashy way SB scales sprites. (you could add a wireframe rendition of each triangle as a cheap sprite anti-aliasing method.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!HobbiesIt's a bit difficult to control. but I can see this being really handy for 3D model making! The code is pretty straightforward, and well documented. Can you possibly add an export-to-text option, or a better way to access .3D/.3DM files? If I could have access to every triangle point, then this would be really convenient for me, and other developers here too!
Thanks for making this!kevinfoleyThanks! The code for exporting and importing models is at the bottom of P3DMODELEDITOR. That should give you all the information you need to access the data, and is much faster to work with than text. The save format is really very straightforward, and it should be easy to write a parser (or copy and modify my own parsing code). Is there a reason you wanted text rather than an array of numbers?
I am working on an update that fixes some issues with coordinates being double-or-triple-reversed, and will probably release that in the next few days.12Me21Syntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself.obj is extremely simple and widely used, so it might be worth adding a way to import/export files in this format.kevinfoleyHmm, good suggestion. I think I could do an OBJ import/exporter without too much trouble.kevinfoley@12Me21 Well, I wrote some simple code that could hopefully parse an OBJ file, but how would I get an OBJ file from my PC into SmileBASIC?12Me21Syntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourselfhttp://smilebasicsource.com/page?pid=812randoIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsitelol yeahkevinfoleyI've released an update with general improvements and fixes to how axes/coordinates are handled, and a new demo game. The update also has the OBJ parsing code that I haven't tested. I'll need to copy a model file onto my 3DS using the modem app in order to try that.kevinfoleySeveral years after the last release, I finally got the urge to start working on this project again. I have completely overhauled the original messy code into a highly streamlined common library. I've also developed a simple 3D model editor to go with the engine. I haven't uploaded the new code yet, but will do so in the next week or two.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!HobbiesThat's exciting! I'll be sure to be one of the first to check it out. No rush!kevinfoleyI've uploaded the new version with model editor, and updated the download key.h267Third YearMy account is over 3 years oldWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteMinecraft Is Awesome!I love Minecraft!Express YourselfYou should make a custom model creator. Depending on the scale of this, this could be used to make 3D game pieces in SmileBASIC. Comboned with the raycaster, you have a full 3D game.12Me21Syntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfI think someone is working on one nowSuper_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express YourselfWell it might be too slow for a 3d polygon and a raycaster all at once. SB can only do so much.ThatStupidGuyAhem: BBW3E88V
https://twitter.com/Bug_taro/status/691996196626272257Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express YourselfWhere is this program, what happened to it and how?
YOU REALLY PROVED ME WRONG.... OMG I WUV DIS
ThatStupidGuyHa.
GuzzlerFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteDrawingI like to draw!HobbiesIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthYes make it please!kevinfoleyI have developed a simple 3D model editor and will release it soon.MinxrodThird YearMy account is over 3 years oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthQSP Contest 2 Contest ParticipantI participated in the second SmileBASIC Source QSP Contest!This is so neat :D
But I have no idea how the models are made.
I don't understand how they are defined... if someone knows can they explain to me please?
kevinfoleyThey're defined in data at the bottom of the program. Each model consists of a set of vertices and a set of faces that connect the vertices. The way I bundled them together is kind of messy and hard to follow, but I'm hoping to improve it in the next version. If you don't know what "vertices" or "faces" are, you might want to do some research on 3D modelling in general.MinxrodThird YearMy account is over 3 years oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthQSP Contest 2 Contest ParticipantI participated in the second SmileBASIC Source QSP Contest!Oh, you define vertices and then basically sets of those vertices?
DasEtwasWhat happens if two polys overlap?Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourselfits just an overlaping polygon.12Me21Syntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourselfpossibly z fightingkevinfoleyThere's an algorithm to determine the draw order of polygons; if two overlap, it's going to draw one of them on top of the other based on that algorithm. That can look weird but doesn't come up very often.Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express YourselfWhat's the syntax for creating a polygon?PixelStudio"*Actual gameplay features"
Hype hype hypekevinfoleyEr, okay?kldck_hulFirst MonthJoined in the very first month of SmileBASIC SourceWebsiteScholarReceived for knowing a great deal about programming topicsAchievementsZelda Is Awesome!I love The Legend Of Zelda!Express Yourself*Actual gameplay features
What does this include?
Are we going to get any scene graphs etc?
I'm also curious if this does any back-face culling?kevinfoleyActual gameplay features would include things such as collision detection and maybe a pooling system. I'm working on a demo game that uses a refined version of the engine, but had to take a break due to the holidays. I'll be starting on it again soon.Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express YourselfModel maker?PixelStudioOn line 537 change data to DATA 50,32,24 and it looks like the ships are firing at the tie fightersPtcguyFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteMinecraft Is Awesome!I love Minecraft!Express YourselfBeginner ProgrammerI'm just starting out! I'm still trying to grasp the basics.Programming StrengthcoolPixelStudioThis is amazing! Imagine one of these bad boys flying into a fps map and idk, drops supplies or something? Even if it can't be physically there it will sure add a neat effect to the game :) although I can be taking it too far...Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself1 word: a person. Just a person. Do it.kevinfoleyWhat do you mean? Are you asking me to model a person, or what?Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express YourselfYes, make a person.. like a polygonal model of a person. doesn't have to be good.kevinfoleySorry, this sounds like a waste of time. A person isn't very interesting unless it's animated, and animating a person in code would be hell.Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express YourselfIt doesn't seem boring to me....YolkaiHead AdminHow many polygons is that in the first (second uploaded) image? Maybe I underestimated Smilebasic.blizord Ten I think. They move quickly and in many directions too.kevinfoleyLol. Ten models, not ten faces. There are about 220 faces in this scene.kevinfoleyI'm used to saying faces, which is really 3D modelling lingo - polygons and faces are the same thing here.GuzzlerFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteDrawingI like to draw!HobbiesIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthWow, this is really "shaping" up!
1
2
IF ((POINTS[E2,0] -POINTS[E1,0]) *(POINTS[E3,1] -POINTS[E1,1]) -(POINTS[E2,1] -POINTS[E1,1]) *(POINTS[E3,0] -POINTS[E1,0])) >=0 THEN CONTINUE
The only issue is that this requires you to update all of your models, since there are inconsistencies in defining clockwise/counterclockwise triangles, so the models are a bit jumbled up, but only one side of them now gets drawn. I guess this also depends on how you want it to be, since your STARBLITZ demo (which is really awesome btw) has one-triangle-wide wings, which behaves wrong with this change. So, just consider it.VAR M%,IT% 'draw IT% times because it is less noticable on small scale applications FOR I = 1 TO IT% GFILL 0,0,511,511 NEXT ?MILLISEC - M% GCLIP 0,0,399,239 M% = MILLISEC FOR I = 1 TO IT% GFILL 0,0,511,511 NEXT ?MILLISEC-M%
if this doesn't produce usable results, just increaseVAR M%,I% M% = MILLISEC WHILE MILLISEC-M%<1001:GFILL I,0,15,15:INC I%:WEND ?"a moving box can be drawed",I%,"times a second" I% = 0'reset it from our last test SPSET 0,0'16x16 size 'since we are only [i]moving[/i] the sprite anddrawing it, don't include initialization of it. M% = MILLISEC WHILE MILLISEC - M%<1001: SPOFS 0,I%,0:INC I%:WEND ?"a moving sprite can be drawed",I%,"times a second"