game of thought

Members
  • Content count

    138
  • Joined

  • Last visited

Community Reputation

220 Neutral

About game of thought

  • Rank
    Member
  1. Hello, I have been writing a turn based strategy game for around the last month. It is almost done but there is one critical issue, my turn counter bugs out when clicked.   I have been used SDL2's event library to handle clicks and it tends to click the buttons for quite a while     This isn't really an issue for when the units and tiles are selected and when pathfinding is performed, but when the next turn button is clicked it goes absolutely nuts in the status window(this is from turn 1 by the way):   I am not really sure what exactly causes this, but it seems to be either the main loop or the input functions. while( oneSideIsDead != TRUE ) { turnButtonISClicked = 0; oldUnitSelected = 0; if( turnIsChanged == 1 ) { turnIsChanged = 0; turnNumber = turnNumber + 1; fprintf( stdout , "Turn : %d\n" , turnNumber ); turnButtonISClicked = 0; } for( looper = 1 ; looper <= map->sides[ Side ]->numberUnits ; looper++ ) { map->sides[ whichSide ]->units[looper]->selected = FALSE; } fprintf(stdout, "works 2\n"); for( loopertwo = 0 ; loopertwo < map->tiles[0]->numberTiles ; loopertwo++ ) { map->tiles[loopertwo]->isSelected = FALSE; } fprintf(stdout, "works 3\n"); if( turnNumber % 2 == 1 ) { Side = 0; enemySide = 1; } else { Side = 1; enemySide = 0; } while( turnButtonIsClicked != END_TURN_BUTTON_CODE ) { if( turnButtonIsClicked != 0 ) { oldUnitSelected = turnButtonIsClicked; } turnButtonIsClicked = 0; start = clock(); SDL_RenderClear( renderer ); if( time % 1 == 0 ) { turnButtonIsClicked = handleMapBeenClicked( map->sides[ Side ] , map->sides[ enemySide ] , map->tiles , nextTurn , events ); if( ( oldUnitSelected == UNIT_IS_SELECTED && turnButtonIsClicked == TILE_IS_SELECTED) || ( oldUnitSelected == UNIT_IS_SELECTED && turnButtonIsClicked == UNIT_IS_SELECTED_OTHER ) ) { for( looper = 1 ; looper <= map->sides[ Side ]->numberUnits ; looper++ ) { if( map->sides[ whichSide ]->units[looper]->selected == TRUE ) { break; } } for( looperthree = 1 ; looperthree <= map->sides[ enemySide ]->numberUnits ; looperthree++ ) { if( map->sides[ otherSide ]->units[looperthree]->selected == TRUE ) { break; } } for( loopertwo = 0 ; loopertwo < map->tiles[0]->numberTiles ; loopertwo++ ) { if( map->tiles[loopertwo]->isSelected == TRUE ) { break; } } if( i != map->sides[ Side ]->numberUnits + 1 && !( loopertwo == map->tiles[0]->numberTiles ) && map->sides[ Side ]->units[looper]->selected == TRUE && map->tiles[loopertwo]->isSelected == TRUE && oldUnitSelected == UNIT_IS_SELECTED && turnButtonIsClicked == TILE_IS_SELECTED ) { Mix_PlayChannel( -1 , marchSound , 0 ); moveUnit( map->sides[ Side ], map->tiles , map->tiles[loopertwo]->relativeX , map->tiles[loopertwo]->relativeY , looper ); } if(looper != map->sides[ Side ]->numberUnits + 1 && map->sides[ Side ]->units[looper]->selected == TRUE && looperthree != map->sides[ enemySide ]->noUnits + 1 && map->sides[ enemySide ]->units[looperthree]->selected == TRUE && oldIsSelected == UNIT_IS_SELECTED && turnButtonIsClicked == UNIT_IS_SELECTED_OTHER ) { Mix_PlayChannel( -1 , shootSound , 0 ); defendingSideCasualties = shootUnit( map->sides[ Side ] , looper , map->sides[ enemySide ] , looperthree , map->tiles ); attackingSideCasualties = shootUnit( map->sides[ enemySide ] , looper , map->sides[ Side ] , looper , map->tiles ); resolveShooting( map->sides[ Side ] , looper , map->sides[ Side ] , looperthree , defendingSideCasualties , attackingSideCasualties ); map->sides[ Side ]->units[looper]->selected = FALSE; map->sides[ enemySide ]->units[looperthree]->selected = FALSE; } } } if( events->type == SDL_QUIT ) { *success = FAIL; return; } and here is the relevant input code for the turn button: fprintf( stderr , "Checking if the button is pressed....\n" ); if(SDL_HasIntersection( mouseDimensions , &( button->dimensionsAndSize ) ) == SDL_TRUE ) { return SUCCESS; } else { return FAIL; } return NULL_INPUT_VALUE; If you need anything else to help you figure this out please don't hesitate to ask. This is at this point the only thing really holding me back and I am not sure why it does this.   Thanks a lot.
  2. It is a text based zombie game in PDcurses, although could be easily converted to ncurses or regular curses. Here: clicky   If you can't get it to compile and have the libraries go into main.h and change the curses include as you may have it installed in a different ways.   I am aware of some issues that exist in the code, although they will not be fixed for a while: 1) There is no detection for anything going out of bounds 2) Zombies spawn on top of players and pits, pits on players, often either makes the game easier or instant game over.       Please provide comments on primarily on source code of the game primarily, and you can read some slapped together documentation in LaTeX, HTML and man pages.   Thanks
  3. It has been a while since I have been on this forum (the better part of two years I believe) but I have come back to talk about my newly formed Game/ programming jams called ASCII enthusiasts.     The main theme of this jam is the usage of ASCII/ANSI and text based graphics to create programs only. The first competition, know as the 72 hour competition on the website, consists of a 72 hour jam to create something in the flavour of a console or terminal program but without It having to be run in the terminal. The other one, which is 10 days, is a more pure console affair and should be better for beginners as you won't be rushing around. The 72 hour version will be from the 25th June to the 28th June while the 10 day version is from the 1st July to the 10th july.   We have a basic site here : click Thanks for reading
  4. Wanna get intro Dungeons and Dragons role playing, wherE?

    you could see d20 SRD which has the base rules and a lot of monsters     http://www.d20srd.org/     otherwise buy the rulebook, DM handbook and player handbooks
  5. Can somebody critque my youtube channel in a constructive manner

    Thanks for the response. The reason i was asking for advice is because i would like to be given information on a non annoying technique rather than being the next annoying 10 year old(which i am not but you get the idea).
  6. Can somebody critque my youtube channel in a constructive manner

    Thank you for your input and i can understand that that is a good idea in terms of SEO but it doesn't always matter in context to some channels who have a downplayed element of certain things. Such as Rachel  Morris who has done lets plays and programming tutorials, and generally seems to be computer related.   In the end, as much as it feels good to have loads of views, i would be happier making the videos that i want to.  Thank you for the advice.   ps: also, i can only use my phone once for extra long videos as far as i know so that is an incentive to use the same channel if i do say so myself     Edit
  7. Can somebody critque my youtube channel in a constructive manner

    in case you didnt notice, i only uploaded it yesterday. And while i can understand that lets plays are over done, what else is there to do to establish a bread and butter of a channel?   I can't just make c tutorials, i need a form of variety.
  8. Zombie Survival Sandbox?

    +1 Gavin Williams
  9. Upcoming Unofficial GameDev Competition

    I am very interested, i think i may partake.
  10. I was a regular on this forum and stopped posting because i learned a programming language and found my own way in terms of apis etc.. Anyway, i would like to request something of you. I started a youtube channel a while ago and started uploading a week ago and i wondered if you could provide some constructive critism of a youtube channel. I can change almost anything save the following: - my voice, its a bit high but hopefully not particually annoying - what i am currently doing, i will not discontinue my DF lets play or C tutorials Other than that go nuts, as long as it is constructive It would also be useful to see the positives so i can play to them Some helpful info on the channel: - It is all unscripted and during the video(save the review) - some are quite long Thank you all in advance. Link: http://www.youtube.com/user/fusiongamesstudios
  11. Null character, PDcurses

    Thanks
  12. Null character, PDcurses

    Hello, i have recently been writing a roguelike in C99 and i have a problem when writing this game, one of my items is forever null regardless of what i do. I am quite new to C so the solution may be obvious but i can't see it, i have tried tweaking some of the assignment loops but nothing seems to happen     if you want to see the error a screenshot is attached.   how my assignment essentially works by using the map definition to assign items to positions based on the following things   while(i < MAP_ARRAY_SIZE_X)//80 { while(j < MAP_ARRAY_SIZE_Y)//25 { itemdecider = rand() % 50 + 1; definefloor(&map[i][j], i , j);//defines the thing if(map[i][j].blocked == false && itemdecider == 5 && itemcounter < 20) { defineitem(&items[itemcounter], i , j);//this defines the item of course   itemcounter++; } j++; } j = 0; i++;   } i = 0; the item array is 20 across(hence 0 - 19  in the array) so i don't quite know what is causing this as the draw function works in the same way     ask for any other information if you need   Thanks for your time    if you want the source you can get it here: https://github.com/gigaraptor/The-Third-Rogue   PS: it is odd as this only happens once in 4-5 executions of the program
  13. Moving onto c++ from c

    Thanks everyone
  14. Moving onto c++ from c

    I am fine with pointers, i would just like to rely in them less that i would in c. Which from what i hear is with c++.
  15. Moving onto c++ from c

    I have learned c for roughly 3 months and i believe i have a good grasp on most stuff(save char pointers but i am working on it). I now want to move onto c++ because of a few reasons: - better dynamic memory allocation - boolean(better than unsigned char IMO) - classes - the ability to not have to use pointers as much - better STD lib Etc. Now i have bought a c++ textbook and i have read the first few chapters and it seems identical to c. Since i am new to c/c++ i dont really want to miss anything that may be important but i am pushed for time. Which topics should i read and practice and which ones can be ignored or are identical to c?