User Tools

Site Tools


notes:sysprog

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:sysprog [2019/05/01 19:07] – [Game implementations] bstrong2notes:sysprog [2020/01/23 12:45] (current) – created wedge
Line 1: Line 1:
 <WRAP round fggray muchbigger box>Systems Programming Course Notes wiki</WRAP> <WRAP round fggray muchbigger box>Systems Programming Course Notes wiki</WRAP>
- 
-======URLs====== 
-  * http://lazyfoo.net/SDL_tutorials/ 
- Pretty cool video to check out. 
-  * https://youtu.be/yFLa3ln16w0 
  
 ======Login Problems====== ======Login Problems======
Line 32: Line 27:
   * Questions you have that may deserve a more visual answer   * Questions you have that may deserve a more visual answer
  
-==How To Compile a SDL .c file== 
-  * gcc -Wall --std=gnu99 -o desiredfilename filename.c -lSDL 
-  * (Please note that the letter after the dash IE:"-" is a lowercase 'L'.) 
-==How to compile with a SDL_image.h Header Included== 
-  *gcc -Wall --std=gnu99 -o desiredfilename filename.c -lSDL -lSDL_image 
- 
-==Multi-File C SDL Programs== 
-  * compile the first two c files 
-    - gcc -Wall --std=gnu99 -c firstfile.c 
-    - gcc -Wall --std=gnu99 -c secondfile.c 
-  * combine the generated files with the header file 
-    - gcc -Wall --std=gnu99 -o desiredname firstfile.o secondfile.o -lSDL -lSDL_image 
- 
-  ***Protip: Put these within a bash/makefile to save time and frustration.  No need to smash the up arrow for an hour!** 
- 
- 
-==Linking everything together== 
-If you ever are curious on the information on how everything is working with using SDL functions you can explore them! The file path is **/usr/include/SDL**. 
-Remember you can also see man pages on these ex: **man SDL_BlitSurface** 
- 
-==Important info when blitting== 
-Make sure when you blit an image onto a surface that both the image and surface have compatible formats such as 32-bit as this wastes useful processing power switching the formats around if they are not the same. Also, once you are done with the image, be sure to release the allocated memory that you worked with during the application. 
- 
-==Sounds and SDL== 
-If you'd like to play a sound through SDL, it's best to use the extension library SDL_mixer. There are two basic types of sound in the SDL_mixer: Mix_Music for songs and music, and Mix_Chunk for sound effects such as footsteps or voice lines. As for actually playing said audio, you should use the function "Mix_OpenAudio" to first initialize the mixer's functions. This function has 4 arguments. The frequency, format, number of channels, and sample size of the clip being played. Now that SDL_mixer is initialized, You can use "Mix_LoadMUS" and "Mix_LoadWAV" to music and sound effects respectfully. After the audio has run its course, don't forget to free the music man! 
- 
-==SDL important functions== 
- 
--The SDL_GetMouseState(int *x int *y) function allows the user to receive any information on both the buttons being pressed and the location of the mouse with the SDL_BUTTON() macros and the x and y integers respectfully. 
- 
--The SDL_GetKeyState(int *numkeys) points the numkeys pointer at an array indexed with SDLK_* symbols. Each pointer in the array corresponds with a button on the keyboard. If the value is 1, the key is pressed and the opposite for if the value is 0. It is important to note that the returned pointer should not be freed by the caller as it is a pointer to an internal SDL array. 
- 
-======Game implementations====== 
- 
-===Impossible Game/Square Dash(pending name) by Brandon and Billy=== 
-==Concept== 
-You are a square that constantly speeds to the  
-right. With only the ability to jump, you must  
-maneuver around the obstacles that may cause you 
-harm. 
- 
-In the kingdom of Polygonia, The twin nobles 
-Prince Radii and Princess Diameter have been  
-kidnapped by the Notorious Troll Nunia. Nunia  
-you may ask? Nunia business. As the only shape 
-able to jump, you must go on a great voyage  
-to stop Nunia from enacting his terrible plans,  
-rescue Radii and Diameter from a inevitable death, 
-and save Polygonia from plunging into darkness. 
- 
-==Possible Obstacles== 
-  * <del>walls</del> 
-  * <del>spikes</del> 
-  * <del>portals</del> 
-  * <del>reversed gravity zones(Special level effect)</del> 
-  * <del>pits</del> 
-  * <del>Ice/Oil/Slick platforms</del> 
- 
-Things that need to be figured out for thee impossible game. Since we have moar time to figure out the game we will be adding some more awesome things! Here is the order that we plan on implementing things. 
- 
-  * <del>Hit detection</del> 
-  * <del>text indicating death</del> 
-  * <del>Death/start over</del> 
-  * <del>oil slick, and portal testing</del> 
-  * <del>Set up the map (level 1 in progress)</del> 
-  * start menu 
-  * <del>level change animation</del> 
-  * <del>Level 2 and level 3 (map setup) in progress</del> 
-  * End/beginning cut scene 
-  * Boss Battle! 
-  * Multiple sprites for Nunia during boss fight 
-  * Implement a save file(being able to skip levels) 
-  * Implement a scoreboard(best times) 
-  * Circle Nunia as he builds the map as you play! 
-      -This is done by looping the objects falling out of view on the left side of the screen around to off the edge of the right side of the screen. 
- 
- 
- 
- 
- 
-==IDK what i'm doing yet (Pending ideas) by Josh== 
-==Concepts== 
- 
-+ Side/vertical scrolling metroid-vania style game; post apocalypse themed 
- 
-+ Physics based moon/planet/asteroid lander 
- 
-+ Single screen mouse-click shooter, in the vein of early browser-based flash shooters 
- 
- 
-== Shooter game math == 
-When using a mouse in a shooter game you might wanna use a little math to get your projectile to behave like you want. 
-It's easy to compare the distance of where you clicked to where your character is and divvy up the X and Y however in my instance of the game this made the bullet move faster if you clicked further away. So one way to deal with this is to find the angle of the shot. Using some simple geometry this can be done, SOH CAH TOA, we'll use TOA since we want to 
-change the hypotenuse depending on how fast we want the bullet to move. Tan(Opposite/adjacent) will give us our angle and from there. Tan(angle) = Sin/Cos you'll have to use sin for y and cos for the x and simply solve from there and you'll get a consistent speed based on your angle and hypotenuse choice.  
- 
-Will post finalized idea here, working stuff out on paper 
-=====DokuWiki wrap plugin===== 
-http://www.dokuwiki.org/_media/plugin:wrap_plugin_example2.png 
notes/sysprog.1556752075.txt.gz · Last modified: 2019/05/01 19:07 by bstrong2