Gaming without wm ?
When gaming, I want to get the most out of my system (see below for specs), so I want to exit out of KDE, run X with the particular game as the client and make any changes as necessary (gamma, resolution, etc.). How would I go about doing this with a script? I envision its something like the below;
-- cstrike -- #!/bin/bash logout #Gets me out of KDE/Gnome/wm to CLI? cp .xinitrc .xinitrc_original #Backup original xinitrc cp .xinitrc_gamename .xinitrc #Edited xinitrc for each game startx -- -quiet -depth 16 #Starts game with 16-bit color? cp .xinitrc_original .xinitrc #Once I quit game, cp original back startx #Return to KDE desktop/wm The .xinitrc_gamename would have the "exec wm" line commented out, and in its place it would have a command to execute a script (cstrike.sh) that starts the game I want to play; -- cstrike.sh -- #!/bin/bash export __GL_SYNC_TO_VBLANK=1 export __GL_FSAA_MODE=1 #GF4, FSAA 1 = 2x FSAA xgamma -gamma 1.75 winex -workdir "/home/skilless/.transgaming/c_drive/SIERRA/Half-Life" "C:/SIERRA/Half-Life/hl.exe" -console -game cstrike -numericping xgamma -gamma 1.0 I'm not sure, because I'm not at home to test it out, but should this work? I'm wondering how overwriting the .xinitrc file will work; first because I don't want to run the games as root/su, and second because I want the original .xinitrc to be returned to normal once I quit the game and then go back to KDE. So, to give a synopsis; 1. Drop out of KDE/X to CLI 2. Start 3D game in X without running a wm 3. Drop to CLI once I quit game 4. Return to normal KDE/X/wm environment Any suggestions on how to accomplish this more elegantly (or at all), would be appreciated..... ================= System Specs ================= MDK 9.0 / XFree86 4.2.1 Athlon 1600+ XP MSI-6330 256MB PC-133 CAS2 SDRAM Gainward GF4 Ti4200 64MB (1.0-3123 drivers) PGS EO76t 17" monitor / 1280x1024x32bpp default res |
Welcome to LQ.
I would have set my default runlevel to 3 (in /etc/inittab) and have in my .xinitrc a simple line that executes the game. That way the only thing that runs is the game with xinit, no WM so no clutter. When you exit the game, it drops straight back to the CLI. If you wanted you could make it so that your .xinitrc file goes straight into KDE unless you give it a parameter like startx game in which case it then runs the game instead... but I'm no basher so I wouldn't have the slightest idea how to do this. Hope this gives you some other ideas. |
My runlevel is init 3, so that is a given. ;)
I don't know how I would do the "startx gamename" suggestion, perhaps someone has an idea of how to do this? Basically, I'm trying to find two more things and I think I'll be set to go; 1. Drop out of KDE/X without using Ctrl+Alt+Backspace 2. Find out if games/winex can be started with .xinitrc + startx and then start a new X session once I quit the game I think that I'll re-post my exact examples, with comments, to be critiqued; -- .xinitrc_original -- exec twm -- .xinitrc_cstrike -- /home/skilless/scripts/cstrike.sh -- cstrike.sh -- #!/bin/bash export __GL_SYNC_TO_VBLANK=1 export __GL_FSAA_MODE=1 #GF4, FSAA 1 = 2x FSAA xgamma -gamma 1.75 winex -workdir "/home/skilless/.transgaming/c_drive/SIERRA/Half-Life" "C:/SIERRA/Half-Life/hl.exe" -console -game cstrike -numericping xgamma -gamma 1.0 #returns gamma to normal -- cstrike -- #!/bin/bash # I need a line here that will drop me out of KDE/X (logout, init 3, other?) cp .xinitrc .xinitrc_original cp .xinitrc_cstrike .xinitrc startx -- -quiet -depth 16 cp .xinitrc_original .xinitrc startx # Perhaps I need a 'wait' command here so that I wait until I quit the game before doing another "startx" ? Cstrike would be shortcut on my desktop that would do the following; 1. Drop me to CLI 2. Make the game I want be the only X client (start game in X without a windows manager) 3. Drop back to CLI when quitting the game and copy original .xinitrc back 4. Start KDE/X as normal (startx) I'm also wondering if I need to set the resolution of the screen I want to play in with the "-geometry" flag, or will that be done automatically by the game/winex? Thanks for any help! :Pengy: |
Adding a case statement to .xinitrc would probably do the trick. Something along the lines of:
#!/bin/bash game=$1 case $game in xbill ) xbill;; othergame ) runothergame.sh;; #add more games as needed * ) startkde esac Learning a little shell scripting probably woudln't hurt in this case either. |
Well, I wrote a little script that finds and then kills the X pid, so I'll use that to shutdown X and then do the rest as written.
I think I like the idea of using .xinitrc_gamename better than the startx gamename way of doing this. supenguin, Quote:
|
Quote:
|
Just gave myself a big "DUH!"
-- stopx -- #!/bin/bash killall name X killall name kdeinit -- cstrike.sh -- export __GL_SYNC_TO_VBLANK=1 # This locks/unlocks Vertical refresh to fps export __GL_FSAA_MODE=1 # FSAA 1 = 2x FSAA xgamma -gamma 1.75 winex -workdir "/home/skilless/.transgaming/c_drive/SIERRA/Half-Life" "C:/SIERRA/Half-L ife/hl.exe" -console -game cstrike -numericping xgamma -gamma 1.0 -- cstrike -- #!/bin/bash startx ~/scripts/cstrike.sh -- -quiet -depth 16 startx So, all I have to do/type is; 1. stopx 2. ./cstrike Upon exiting the game, I return to KDE. My only problem is, after issuing the stopx command in the GUI (KDE in this case), I drop to the CLI and my commands no longer get passed. So, now if anyone knows how I can continue passing commands to the command line (without manually typing them in), I'll be able to add that into my script. My ultimate goal here is to create links to all of my 3D games so that I always drop to the CLI --> X (sans wm) to play them with only a double-click on the icon.... Any ideas? |
Well, I come across the same problem.
One way to do this is to Ctrl+Alt+F2 to tty2 and give the ./cstrike command. This shuts down KDE/X in tty1 and starts the game in tty2. Then when I quit the game, KDE gets started in tty2, while tty1 stays at the command prompt.....sigh..... I guess I could work this way, just keep Ctrl-Alt-Fx between ttys and then play the game there. But, if anyone knows how I could pass a script from a script started in Xterm to the regular CLI, I'd appreciate it..... |
What I would do is modify my startx script to look for a particular
file in /tmp, say /tmp/game If it exists, get the name of the game you want to play from there, delete /tmp/game and rerun startx.gamename. Put all of this at the end of your current startx script. Cause your icons to run little scripts that spit the name of the game you want to play into /tmp/game, and then kill X. something like: Code:
normal X startup stuff Code:
if [ -e "/tmp/blah" ]; then Code:
#!/usr/bin/env bash as pseudocode to get you started. |
All times are GMT -5. The time now is 04:01 AM. |