Qbasicnews.com
May 26, 2018, 02:35:21 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: 2d kinetic motion sim: NODES  (Read 5477 times)
Meg
Ancient QBer
****
Posts: 483


« on: January 11, 2005, 05:48:57 PM »

01/17/2005 Update
 I've added a new constant Walls% that lets you pick either no walls, wrap-around walls, or reflecting walls.  Demo now makes use of the Distance() function.

01/13/2005 Update
 I've done some more work on the 2D motion program.  Now there's a routine for rotating the nodes' bearings by whatever degrees you want.  There's also a function to return distance between nodes, and a routine that lets you point one node at another.

01/11/2005 Original Post
 I'm having tons of fun with this.  There's so many things which could be added on. If anybody is interested in messing around with this program, feel free!  Post any cool findings here, or ask any questions and I'll do my best to answer them.

These programs should be run from the IDE with the /L switch.

I should point out that when I run this from the IDE, after the program ends, my left shift key is toggled "on" and I have to tap it once to turn it off. Not sure why this happens, but it's because of something the keyhandler does.

{I will keep this link list updated as I add to the code.}
01/17/05 http://www.ifcdata.com/mb/qb/nodes3.txt (Walls Added)
01/13/05 http://www.ifcdata.com/mb/qb/nodes2.txt (Rotation Added)
01/11/05 http://www.ifcdata.com/mb/qb/nodes1.txt (Original Engine)

*peace*

Meg.
Logged
Torahteen
Ancient Guru
****
Posts: 743



« Reply #1 on: January 12, 2005, 07:30:31 PM »

Very cool! Cheesy
Logged

quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Meg
Ancient QBer
****
Posts: 483


« Reply #2 on: January 13, 2005, 02:08:42 PM »

Thanks!  I've added a routine for rotation, so there's a lot more you can do with it, now.  Lemme know if you make anything cool out of this engine. ^_^  I'll keep updating the original post.

*peace*

Meg.
Logged
Meg
Ancient QBer
****
Posts: 483


« Reply #3 on: January 17, 2005, 05:35:53 PM »

Walls added.  Original post updated.

Call for help:  I'd like some help optimizing this code.  It's starting to run pretty slow when I add nodes.  Anybody see any easy ways to lower the number of calculations/loop?  Thanks in advance.

*peace*

Meg.
Logged
adosorken
*/-\*
*****
Posts: 3655



WWW
« Reply #4 on: January 17, 2005, 06:11:51 PM »

Quote from: "Meg"
Anybody see any easy ways to lower the number of calculations/loop?

Port it to freeBASIC. Cheesy
Logged

I'd knock on wood, but my desk is particle board.
Z!re
*/-\*
*****
Posts: 4599


« Reply #5 on: January 17, 2005, 06:19:06 PM »

Precalculate COS and SIN

Use 6.28xxxxxx instead of 2* Pi

Remove the vSync


Thats the obvious things i can find in the code.
Logged
Meg
Ancient QBer
****
Posts: 483


« Reply #6 on: January 18, 2005, 10:34:07 AM »

Quote
Precalculate COS and SIN

I thought about that, but the bearings of the nodes aren't integer quantities.

Quote
Use 6.28xxxxxx instead of 2* Pi

True.  Having a 2Pi constant would be one less calculation.

Quote
Remove the vSync

I'll have to mess around with that, and see if I can find a good balance.  I don't know much about the other method for refreshing the screen without it "blinking" (double-buffering?)

Quote
Port it to freeBASIC.

I'd like to do this, actually.  I've really been interested in FB, but to be honest I've looked at it a little and have absolutely no idea how to use it, and couldn't find documentation anywhere.  When I tried to compile something with it, I'd get an .ASM file, but no .EXE.  If somebody could point me to a tutorial for FB, It would be much appreciated.

*peace*

Meg.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #7 on: January 18, 2005, 11:17:43 AM »

Meg, it's easy: just install it, add the path to fbc.exe to your PATH variable, and then call fbc program.bas .

When you get the errors, you can alwasy ask here.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Z!re
*/-\*
*****
Posts: 4599


« Reply #8 on: January 18, 2005, 11:19:47 AM »

Unfortunately there is no documentations/tutorials on FB yet.

Precaulculate the bearing down to as many decimals you want:
Code:
Accuracy = 10^Decimalplaces
Dim LUTSIN(360*accuracy) as single

a! = LUTSIN(CInt(angle*accuracy))


I'm not sure if this is faster than using regular SIN in QB though. In FB the LUT way is faster.


You can't do double buffering in screen 12 in QB


Anyways, to get FB to work you should simply have to do:
fbc basfile.bas

If there is an error it should tell you.
Logged
Meg
Ancient QBer
****
Posts: 483


« Reply #9 on: January 18, 2005, 02:11:52 PM »

I put in "fbc nodes.bas" and it makes nodes.asm, but not an exe file.

Code:
C:\DOWNLOAD\FB>fbc nodes.bas
nodes.bas(95) : error 10: Expected '=', found: '986'

C:\DOWNLOAD\FB>


I tried removing the WAIT commands (for screen refresh), and now get:

Code:
C:\DOWNLOAD\FB>fbc nodes.bas
nodes.bas(164) : error 59: Type mismatch, at parameter: 1

C:\DOWNLOAD\FB>


I removed everything relating to the multikey routine, and now it *looks* like it works fine:

Code:
C:\DOWNLOAD\FB>fbc nodes.bas

C:\DOWNLOAD\FB>


Yet, it still only makes a nodes.asm file.  No exe.

*peace*

Meg.
Logged
adosorken
*/-\*
*****
Posts: 3655



WWW
« Reply #10 on: January 18, 2005, 02:15:25 PM »

Then it probably returned an error message and didn't finish compiling. QB and FB aren't 100% cross-compatible, so perhaps something in your program doesn't work the same in FB as it does in QB. Cheesy
Logged

I'd knock on wood, but my desk is particle board.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!