omf Posted October 7, 2015 Share Posted October 7, 2015 So i was looking at the bcx help file and see that there is a QSORT command that sorts data in defined arrays, i cant make it work, i think that it does not work on jaguar hardware or the required include files are not present. in the RB+ implementation is there an alternative to this that works apart from writing your own mess of code to deal with it? any thoughts? Quote Link to comment Share on other sites More sharing options...
Sporadic Posted October 7, 2015 Share Posted October 7, 2015 Without the required bcx files etc then you'd have to roll your own. Is the sort required in the main loop? or 'offline' ? Doing your own would be easy enough in basic but if its in a time critical point of the program then something more native would be good for sure. Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted October 7, 2015 Share Posted October 7, 2015 What data are you trying to sort? Perhaps there is a different way of approaching your problem that doesn't need a sort. Quote Link to comment Share on other sites More sharing options...
Mr SQL Posted October 7, 2015 Share Posted October 7, 2015 You could most easily do a bubble sort in BASIC to target a single array which would mirror the QSORT function but it is the least efficient method which could be an issue if it's time critical as Captain Picard has pointed out. If you want to sort the contents of one array based on another QSORT is out and you'd have to write your own algorithm anyway. Virtual World BASIC for the Atari VCS has built in commands that load and sort one multidimensional array (the screen) from the much larger MD array of the virtual world. This sort of complex sorting is made possible by a Relational Database core that is part of the BASIC runtime; it's written in optimized Assembly but still consumes enough processor power that it steals a frame to run the algorithm on the 6502. I envision a similar engine for the Jag could load a 3D screen from a 3D virtual world and surface language intrinsics to control it Quote Link to comment Share on other sites More sharing options...
omf Posted October 7, 2015 Author Share Posted October 7, 2015 (edited) in the game i need to sort integer values in value of highest first and this will relate to the y value, i need to remove them from screen with an explosion 1 at a time from bottom up so knowing the maximum y value to the lowest y value would help greatly i guess i could write a spaghetti bowl of code to sort it out time isnt really an issue as its for when your dead and all objects are static Edited October 7, 2015 by omf Quote Link to comment Share on other sites More sharing options...
sh3-rg Posted October 7, 2015 Share Posted October 7, 2015 OK I know what game you are making and what you want to achieve. If I were doing it I'd simply cycle through all active objects of this type reading the y values, make the largest one inactive, do the assplosion and repeat for as many active objects of that type there are. There's no need to grab and sort the y values, just zap the biggest one every iteration. Quote Link to comment Share on other sites More sharing options...
+CyranoJ Posted October 7, 2015 Share Posted October 7, 2015 in the game i need to sort integer values in value of highest first and this will relate to the y value, i need to remove them from screen with an explosion 1 at a time from bottom up so knowing the maximum y value to the lowest y value would help greatly i guess i could write a spaghetti bowl of code to sort it out time isnt really an issue as its for when your dead and all objects are static Put a 1 pixel high object at the floor, and use the collision detection to test for a hit. Offload this stuff to RAPTOR. Quote Link to comment Share on other sites More sharing options...
ggn Posted October 7, 2015 Share Posted October 7, 2015 To be honest, I didn't pay attention to what has been written on this thread. I just googled qsort, found a PD version, made a function for it, compiled, wrote a sample program, worked first time, shrug . It's probably fast but don't quote me on this! Now, if I suspect that someone is trying to write a relational database on rb+, I'll delete the repositories immediately . 6 Quote Link to comment Share on other sites More sharing options...
sh3-rg Posted October 7, 2015 Share Posted October 7, 2015 Put a 1 pixel high object at the floor, and use the collision detection to test for a hit. Offload this stuff to RAPTOR. That's not what he wants to manage. On death, these objects are frozen - he wants to remove them one by one and make a show of it from bottom to top and they will not necessarily be in any original order such as the order they appear in the list. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.