Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2d kinetic motion sim: NODES
#1
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.
Reply
#2
Very cool! Big Grin
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#3
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.
Reply
#4
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.
Reply
#5
Quote:Anybody see any easy ways to lower the number of calculations/loop?
Port it to freeBASIC. Big Grin
I'd knock on wood, but my desk is particle board.
Reply
#6
Precalculate COS and SIN

Use 6.28xxxxxx instead of 2* Pi

Remove the vSync


Thats the obvious things i can find in the code.
Reply
#7
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.
Reply
#8
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.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#9
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.
Reply
#10
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)