1. Post #121
    Gold Member
    robmaister12's Avatar
    January 2008
    4,969 Posts
    how do you clear
    From what I've read, aside from system("cls"); (There's a pretty huge security issue here, someone can just replace the cls command with anything they want) you can either use the curses or ncurses to clear the screen or do this:

    Code:
    int i;
      
      for ( i = 0; i < SCREEN_HEIGHT; i++ )
        putchar ( '\n' );
    where SCREEN_HEIGHT is the number of rows that your command prompt/terminal has.

    Edited:

    I'd recommend curses/ncurses though, it probably contains a lot of functionality you'd want for making a game like that (I'm assuming, I've never used those libraries before)
    Reply With Quote Edit / Delete United States Show Events Dumb Dumb x 1Disagree Disagree x 1 (list)

  2. Post #122
    Interesting that you say that. Friend.
    NorthernGate's Avatar
    August 2007
    3,412 Posts
    I'm trying to sort the entities in my scene by their property called, well, depth. I was wondering what the best algorithm for sorting by a number is. I've heard things about QuickSort and Radix, but I'd love some opinions.
    Reply With Quote Edit / Delete United States Show Events

  3. Post #123
    limitofinf's Avatar
    December 2010
    161 Posts
    Hey, a quicksort/heapsort hybrid would be best. What language are you using? (Chances are it already has a highly optimized sorting function.)
    Reply With Quote Edit / Delete United States Show Events Dumb Dumb x 1Optimistic Optimistic x 1 (list)

  4. Post #124
    Interesting that you say that. Friend.
    NorthernGate's Avatar
    August 2007
    3,412 Posts
    C#, I've got all my entities stored in a dictionary: Dictionary<String,Entity>.
    Reply With Quote Edit / Delete United States Show Events

  5. Post #125
    likesoursugar's Avatar
    January 2009
    651 Posts
    uploading some content to youtube, but it will take a while. Will probably cancel it and do it tomorrow, or is there any free good .avi compressor?
    Reply With Quote Edit / Delete Sweden Show Events

  6. Post #126
    Gold Member
    mechanarchy's Avatar
    September 2009
    1,214 Posts
    I'm trying to sort the entities in my scene by their property called, well, depth. I was wondering what the best algorithm for sorting by a number is. I've heard things about QuickSort and Radix, but I'd love some opinions.
    Bogosort.
    Reply With Quote Edit / Delete Australia Show Events Dumb Dumb x 1 (list)

  7. Post #127
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    How big is the data set you're going to sort? If it's small just use selection sort.

    Go through the list and find the highest element, insert to another list. And repeat until the first list is empty.
    Reply With Quote Edit / Delete United States Show Events

  8. Post #128
    limitofinf's Avatar
    December 2010
    161 Posts
    C#, I've got all my entities stored in a dictionary: Dictionary<String,Entity>.
    Hey, 2 things:

    1) You won't be able to sort the dictionary itself because it's an associated container; you'll have to create a List<Entity> (or similar).

    2) Use C#'s Sort() function, it's a rather optimized version of quicksort. It would take a lot of effort to write something faster than it.
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 1Informative Informative x 1Dumb Dumb x 1Optimistic Optimistic x 1 (list)

  9. Post #129
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    I'm trying to sort the entities in my scene by their property called, well, depth. I was wondering what the best algorithm for sorting by a number is. I've heard things about QuickSort and Radix, but I'd love some opinions.
    Edited:

    Fucking broke my merge :(
    Reply With Quote Edit / Delete United States Show Events

  10. Post #130
    limitofinf's Avatar
    December 2010
    161 Posts
    How big is the data set you're going to sort? If it's small just use selection sort.
    Hey, for small data sets, insertion sort is much quicker than selection sort. In fact, IIRC, std::sort is a hybrid of insertion sort, quick sort, and heap sort (but that doesn't apply to C#).
    Reply With Quote Edit / Delete United States Show Events Dumb Dumb x 1Optimistic Optimistic x 1 (list)

  11. Post #131
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    I was just suggesting a common sort, on very small lists even bubble sort is fine.
    Reply With Quote Edit / Delete United States Show Events

  12. Post #132
    Combino's Avatar
    December 2010
    217 Posts
    I hate Binary Coded Decimal :smith::

    INS(adc)
    {
    	unsigned short total = (unsigned short)cpu->regs.a + (unsigned short)param + (GET_FLAG(cpu, FCARRY) ? 1 : 0);
    		
    	if(GET_FLAG(cpu, FBCD))
    	{
    		cpu->regs.a += (param & 255) + (GET_FLAG(cpu, FCARRY) ? 1 : 0);
    
    		FLAG_IF(cpu, FCARRY, total > 255);
    		FLAG_IF(cpu, FZERO, cpu->regs.a == 0);
    		FLAG_IF(cpu, FNEG, cpu->regs.a & 128);
    		FLAG_IF(cpu, FOFLOW, (cpu->regs.a > 0) != (total > 0));
    	}
    	else
    	{
    		// binary coded decimal mode eeek
    		
    		cpu->regs.a = (total / 10) << 4 + (total % 10);
    	}
    }
    
    Reply With Quote Edit / Delete Australia Show Events Optimistic Optimistic x 1 (list)

  13. Post #133
    Interesting that you say that. Friend.
    NorthernGate's Avatar
    August 2007
    3,412 Posts
    Thanks for the help guys, got it now.
    Reply With Quote Edit / Delete United States Show Events

  14. Post #134
    likesoursugar's Avatar
    January 2009
    651 Posts
    Iris content:
    - Generating a 10000 x 10000 map.
    - Temporary start screen.
    - Loading screen.
    x - No collision detection yet (almost)
    x -Can move diagonal for some dumb reason.
    Reply With Quote Edit / Delete Sweden Show Events Optimistic Optimistic x 2Dumb Dumb x 1 (list)

  15. Post #135
    quality poster
    Dennab
    August 2009
    12,242 Posts

    Can't be bothered to upload the video just so I can embed it. OH FINE I'LL UPLOAD IT.

    Finally finished sprite animation, my method of loading frames and animations is kind of half assed as I kind of just "made it work" rather than thinking out an ideal system, but eh, its not obsolete, its still a pretty good sprite handler and I'm quite proud of my work. Tomorrow I'll be working on.. Well to be honest I'm not sure. So far I have a good framework for the game (rendering, input, entity classes, etc..), so I'm thinking I'll add either maps or physics, it really just comes down to which one I'll be doing first! My plan is to finish maps and physics, and then add script integration (Probably Lua, just because I'm familiar) to handle scripted events (Obviously ) like light switches, AI routines, etc..

    Oh and I plan to have semi-tile based maps, with which I'll implement a sort of 2D shader by just making tiles that are further away from light sources draw colors turn closer to black.

    Busy busy bee :buddy:

    Edited:

    Iris content:
    Generating a 10000 x 10000 map.
    No collision detection yet (almost)
    Can move diagonal for some dumb reason.
    I don't mean to be rude but the way the grass sits on top of the hills just looks horrible. Though I'm kind of guessing that its temporary while you work on the harder stuff?
    Reply With Quote Edit / Delete United States Show Events

  16. Post #136
    Combino's Avatar
    December 2010
    217 Posts
    Gave my test 6502 computer a 32x8 'screen' that's mapped into RAM at 0x200 - 0x2FF.

    The idea is that anything not directly related to the CPU (I'm going to call this the machine profile) is in init_6502.c. Later on I'll rework this to dynamically load a .so file and invoke the init_6502() in that.



    Here's the assembly source for the image executing in the picture above:

    Code:
    .segment "CODE"
    
    	ldx #0
    	ldy #0
    	
    	loop:
    		txa
    		cmp #14
    		bcc skipset
    		lda #0
    		skipset:
    		tax
    		lda msg,x
    		sta $200,y
    		inx
    		iny
    		
    		jmp loop
    
    	isr:
    		rti
    
    	msg: .byt "Hello, World! ", $0
    
    .segment "VECTORS"
    	.word isr, isr, isr
    Reply With Quote Edit / Delete Australia Show Events Programming King Programming King x 5Dumb Dumb x 1 (list)

  17. Post #137
    Gold Member
    Hypershadsy's Avatar
    February 2008
    2,413 Posts
    (Repost?)
    This tool randomly generates 8-bit sound effects for use in games.
    http://www.drpetter.se/project_sfxr.html
    Reply With Quote Edit / Delete United States Show Events Late Late x 1Agree Agree x 1Useful Useful x 1 (list)

  18. Post #138
    Moderator Illuminati
    Hexxeh's Avatar
    June 2006
    5,091 Posts
    Just finished up Luigi, a Cr-48 firmware toolkit: http://hexxeh.net/?p=328117655


    Allows you to reflash the firmware on your Cr-48 with a custom one that allows you to boot any OS.
    Reply With Quote Edit / Delete United Kingdom Show Events Programming King Programming King x 20Winner Winner x 1Useful Useful x 1 (list)

  19. Post #139
    Combino's Avatar
    December 2010
    217 Posts
    Wow, nice work!

    Made all the more awesome by the music, too.
    Reply With Quote Edit / Delete Australia Show Events Agree Agree x 2Disagree Disagree x 1 (list)

  20. Post #140
    xAustechx's Avatar
    July 2009
    584 Posts
    I couldn't sleep, it's currently 2:00 AM and I gotta go to school at 7:00 AM.

    Since I'm gonna fall asleep in school, I figured I should do something productive while awake.

    I've been re-doing systems of beat tapper these past few days, making the class structure more flexible. In doing this I had a chance to re-do the menu.





    Dark Grey: Folders
    Light Grey: Folder (currently selected)
    White: Song
    Yellow: Song (currently selected)
    Blue: Loaded Song
    Light Blue: Loaded Song (currently selected)


    I also worked on an Input Manager making things a lot easier. This means that I can (hopefully more easily) add in controller/dance pad support. :D
    Reply With Quote Edit / Delete United States Show Events Artistic Artistic x 1 (list)

  21. Post #141
    DevBug's Avatar
    July 2010
    1,059 Posts
    Anyone know of a Motorola 6800 assembler?

    Edit:

    Can't find a standalone assembler that's open source. So: http://docs.google.com/viewer?a=v&q=...yv-oTkCbtFRgOA
    Reply With Quote Edit / Delete Canada Show Events Agree Agree x 1 (list)

  22. Post #142
    limitofinf's Avatar
    December 2010
    161 Posts
    I was just suggesting a common sort, on very small lists even bubble sort is fine.
    Hey, my bad, I thought you were actually suggesting selection sort over quick sort. My point was that quick sort is not in any way slow for small data sets, but insertion sort is usually faster than it for small data sets.
    Reply With Quote Edit / Delete United States Show Events Optimistic Optimistic x 1 (list)

  23. Post #143
    Gold Member
    BackwardSpy's Avatar
    May 2008
    6,497 Posts
    I was about to complain that I wasn't in the highlights (hardly surprising) but then I noticed I got the award for best avatar :3:
    I'm glad you like it.
    Reply With Quote Edit / Delete United Kingdom Show Events Friendly Friendly x 3Dumb Dumb x 1 (list)

  24. Post #144
    iNova's Avatar
    November 2008
    1,045 Posts
    Just finished up Luigi, a Cr-48 firmware toolkit: http://hexxeh.net/?p=328117655


    Allows you to reflash the firmware on your Cr-48 with a custom one that allows you to boot any OS.
    Was too mesmerized looking at your avatar while listening to the music, other than that: awesome.


    Iris content:
    - Generating a 10000 x 10000 map.
    - Temporary start screen.
    - Loading screen.
    x - No collision detection yet (almost)
    x -Can move diagonal for some dumb reason.
    Looks a ton like lewt.
    Reply With Quote Edit / Delete Estonia Show Events Agree Agree x 6Dumb Dumb x 1 (list)

  25. Post #145
    Gold Member
    Jallen's Avatar
    December 2007
    7,557 Posts
    Iris content:
    - Generating a 10000 x 10000 map.
    - Temporary start screen.
    - Loading screen.
    x - No collision detection yet (almost)
    x -Can move diagonal for some dumb reason.
    Probably can be avoided by just doing an else if on the input checks. like, if up, else if right, else if left, else if down.
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 3 (list)

  26. Post #146
    sLysdal's Avatar
    December 2008
    271 Posts
    gonna make a text based game with c++
    i just started out with c++ and i want to know how you do something that stays in the text thingy
    like this (poor paint):


    is there any framework or something for this
    im new to desktop programming
    I made a engine for text based games a while back, it uses lua as scripting language, handles input, output, colors, and more. And i also fixed security holes.

    Contact me if you want it :)
    Reply With Quote Edit / Delete Denmark Show Events

  27. Post #147
    likesoursugar's Avatar
    January 2009
    651 Posts
    Probably can be avoided by just doing an else if on the input checks. like, if up, else if right, else if left, else if down.
    Yeah I know but that's not so nice. Because then 2 of the keys will be prioritised.
    But I'll take a look after I've done some other stuff
    Reply With Quote Edit / Delete Sweden Show Events

  28. Post #148
    Combino's Avatar
    December 2010
    217 Posts
    I made a engine for text based games a while back, it uses lua as scripting language, handles input, output, colors, and more. And i also fixed security holes.

    Contact me if you want it :)
    How can something that simple have security holes?
    Reply With Quote Edit / Delete Australia Show Events Agree Agree x 5Dumb Dumb x 3 (list)

  29. Post #149
    sLysdal's Avatar
    December 2008
    271 Posts
    How can something that simple have security holes?
    The OS library in lua have security holes, as you can place direct system calls.
    These holes have also been patched in gmod.

    Edited:

    From lua documentation:
    os.execute([command])
    Execute an operating system shell command. This is like the C system() function. The system dependent status code is returned.
    Reply With Quote Edit / Delete Denmark Show Events Zing Zing x 3Informative Informative x 2Dumb Dumb x 1 (list)

  30. Post #150
    iNova's Avatar
    November 2008
    1,045 Posts
    else if
    -snip-
    Reply With Quote Edit / Delete Estonia Show Events Dumb Dumb x 10Zing Zing x 3Late Late x 1 (list)

  31. Post #151
    I'm Better Than You
    Handsome Matt's Avatar
    August 2008
    5,480 Posts
    Just finished up Luigi, a Cr-48 firmware toolkit: http://hexxeh.net/?p=328117655


    Allows you to reflash the firmware on your Cr-48 with a custom one that allows you to boot any OS.
    What music is that? Awesome job by the way.
    Reply With Quote Edit / Delete United Kingdom Show Events

  32. Post #152
    Gold Member
    ZeekyHBomb's Avatar
    June 2006
    3,577 Posts
    Gah, my old school had this. Seeing you mouse move on it's own is really disturbing.
    Happened to me once while using Notepad++ and the teacher wanted to close it.
    When the display popped up whether or not to save the modified file I saw the cursor moving to "No" and I was like "Yes! Save that file!". The cursor stopped and the teacher looked at me, saying nothing.
    "It won't to any harm, just look at it! Save it.". My teacher switched from looking at his screen and back at me.
    He seemed not to know what to do and I was like "Save it, save it, save it!". The teacher moved a little back from his desk, waited a little while apparently lost in thought (probably not) and decided to give me back control :D
    My heartbeat slowly returned to normal.
    Reply With Quote Edit / Delete Germany Show Events Funny Funny x 8Winner Winner x 1 (list)

  33. Post #153
    I'm Better Than You
    Handsome Matt's Avatar
    August 2008
    5,480 Posts
    Happened to me once while using Notepad++ and the teacher wanted to close it.
    When the display popped up whether or not to save the modified file I saw the cursor moving to "No" and I was like "Yes! Save that file!". The cursor stopped and the teacher looked at me, saying nothing.
    "It won't to any harm, just look at it! Save it.". My teacher switched from looking at his screen and back at me.
    He seemed not to know what to do and I was like "Save it, save it, save it!". The teacher moved a little back from his desk, waited a little while apparently lost in thought (probably not) and decided to give me back control :D
    My heartbeat slowly returned to normal.
    Notepad++ I heard it's Linux software. This kid must be a hacker.
    Reply With Quote Edit / Delete United Kingdom Show Events Winner Winner x 1 (list)

  34. Post #154
    q3k
    Gold Member
    q3k's Avatar
    October 2009
    921 Posts
    ITT: Kids whining about their schools.
    Reply With Quote Edit / Delete Poland Show Events Dumb Dumb x 13Agree Agree x 3Informative Informative x 1 (list)

  35. Post #155
    Gold Member
    Jallen's Avatar
    December 2007
    7,557 Posts
    Happened to me once while using Notepad++ and the teacher wanted to close it.
    When the display popped up whether or not to save the modified file I saw the cursor moving to "No" and I was like "Yes! Save that file!". The cursor stopped and the teacher looked at me, saying nothing.
    "It won't to any harm, just look at it! Save it.". My teacher switched from looking at his screen and back at me.
    He seemed not to know what to do and I was like "Save it, save it, save it!". The teacher moved a little back from his desk, waited a little while apparently lost in thought (probably not) and decided to give me back control :D
    My heartbeat slowly returned to normal.
    When we were in year 10 or 11 (age 15-16) we managed to get access to the schools VNC program using cmd, because they had only restricted access in explorer (wtf?)
    The program didn't allow alpha numeric passwords so the password ended up just being the name of the school. The numbers they were putting on the end every time did nothing (LOL)

    So to cut a long story short, we fucked around, didn't really do anything drastic except make peoples mouse pointers spaz out etc, got threatened with all sort of exclusion and shit for using an "illegal batch file" and generally worried our asses off once they found it.

    Everyone involved had to write a 1000 word essay on how what we did was wrong. I filled mine with about 20 ways in which the schools system was insecure :smugdog:

    But seriously I shit my pants when they found out. I was messing with it in a graphics lesson one time and suddenly this IT teacher came in through the door, talked to the teacher and then started walking straight towards me. Never again.
    Reply With Quote Edit / Delete United States Show Events Funny Funny x 7 (list)

  36. Post #156
    Gold Member
    efeX's Avatar
    April 2009
    2,332 Posts
    -snip-
    jealous?
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 5 (list)

  37. Post #157
    Gold Member
    Robert64's Avatar
    November 2007
    1,326 Posts
    When we were in year 10 or 11 (age 15-16) we managed to get access to the schools VNC program using cmd, because they had only restricted access in explorer (wtf?)
    The program didn't allow alpha numeric passwords so the password ended up just being the name of the school. The numbers they were putting on the end every time did nothing (LOL)

    So to cut a long story short, we fucked around, didn't really do anything drastic except make peoples mouse pointers spaz out etc, got threatened with all sort of exclusion and shit for using an "illegal batch file" and generally worried our asses off once they found it.

    Everyone involved had to write a 1000 word essay on how what we did was wrong. I filled mine with about 20 ways in which the schools system was insecure :smugdog:

    But seriously I shit my pants when they found out. I was messing with it in a graphics lesson one time and suddenly this IT teacher came in through the door, talked to the teacher and then started walking straight towards me. Never again.
    I found a computer left logged in as an admin account. I found VNC and got it running, then passed it on to my friends who proceeded to open paint and draw pleasant images on random computers in an IT room on the other side of the school.

    Never got caught.
    Reply With Quote Edit / Delete United Kingdom Show Events

  38. Post #158
    Neigh
    CarlBooth's Avatar
    June 2007
    28,550 Posts
    Sorry, but it really irritates me when the kids think they know better than the IT team.

    Our job is to make the however-many-hundred computers in your school work for the however-many-thousand people that use them. If your school's network has been running for more than 2 or 3 years its very likely all the settings and programs on it have been tweaked over time so that its easiest for everyone to use.

    For example, if you discover that you can make the screen go pink and set the font to 72pt it isn't because we forgot to disable setting XYZ. It's because students with vision imparements might need to change their settings so they can actually do the work in class.

    Also, we don't watch what you're doing because we all get a massive kick out of moving your mouse or closing any stupid programs you are using that you shouldn't be. VNC or whatever monitoring software is on machines because the school has a legal duty of care to ensure that all the students are protected online and that you can't get into trouble or be victimised or exploited by people or programs on the Internet. If you start messing about with that software or changing how it works then it opens all sorts of cans of worms.

    This is the same for proxies too. So you discover a proxy to get through the firewall and on to blocked sites - Cool. Now what if a 12 year old also uses this proxy and is going on some chat site where they are being groomed. Not so cool now is it?
    Reply With Quote Edit / Delete United Kingdom Show Events Agree Agree x 11Dumb Dumb x 2Friendly Friendly x 2Disagree Disagree x 1 (list)

  39. Post #159
    I'm Better Than You
    Handsome Matt's Avatar
    August 2008
    5,480 Posts
    ITT: Kids whining about their schools.
    You're 18 you've only just left school, stop acting like such a stuck up prick about it.

    Edited:

    Sorry, but it really irritates me when the kids think they know better than the IT team.
    Some of them probably do.
    Reply With Quote Edit / Delete United Kingdom Show Events Agree Agree x 18Disagree Disagree x 3Dumb Dumb x 1 (list)

  40. Post #160
    Gold Member
    Jallen's Avatar
    December 2007
    7,557 Posts
    Sorry, but it really irritates me when the kids think they know better than the IT team.

    Our job is to make the however-many-hundred computers in your school work for the however-many-thousand people that use them. If your school's network has been running for more than 2 or 3 years its very likely all the settings and programs on it have been tweaked over time so that its easiest for everyone to use.

    For example, if you discover that you can make the screen go pink and set the font to 72pt it isn't because we forgot to disable setting XYZ. It's because students with vision imparements might need to change their settings so they can actually do the work in class.

    Also, we don't watch what you're doing because we all get a massive kick out of moving your mouse or closing any stupid programs you are using that you shouldn't be. VNC or whatever monitoring software is on machines because the school has a legal duty of care to ensure that all the students are protected online and that you can't get into trouble or be victimised or exploited by people or programs on the Internet. If you start messing about with that software or changing how it works then it opens all sorts of cans of worms.

    This is the same for proxies too. So you discover a proxy to get through the firewall and on to blocked sites - Cool. Now what if a 12 year old also uses this proxy and is going on some chat site where they are being groomed. Not so cool now is it?
    That's all understandable and I agree, but aside from one teacher I had who was a badass with computing, I'm fairly sure I did know better than the IT teachers.

    As for the tech guys who sat in this room and did all the admin stuff, I know nothing about networking or administration. So really I have respect for them.
    That doesn't mean it's not REALLY fun to take advantage of silly little exploits :D (never anything malicious of course)
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 4 (list)