LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-10-2002, 03:07 PM   #1
Skilless
LQ Newbie
 
Registered: Dec 2002
Distribution: MDK 9.0
Posts: 8

Rep: Reputation: 0
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
 
Old 12-10-2002, 03:30 PM   #2
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Debian + Ubuntu
Posts: 4,358

Rep: Reputation: 57
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.
 
Old 12-10-2002, 04:09 PM   #3
Skilless
LQ Newbie
 
Registered: Dec 2002
Distribution: MDK 9.0
Posts: 8

Original Poster
Rep: Reputation: 0
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!

 
Old 12-10-2002, 05:03 PM   #4
supenguin
LQ Newbie
 
Registered: Jul 2002
Posts: 17

Rep: Reputation: 0
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.
 
Old 12-10-2002, 05:13 PM   #5
Skilless
LQ Newbie
 
Registered: Dec 2002
Distribution: MDK 9.0
Posts: 8

Original Poster
Rep: Reputation: 0
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:
Learning a little shell scripting probably woudln't hurt in this case either.
Weird, I thought I was scripting........guess not, huh?
 
Old 12-10-2002, 05:21 PM   #6
supenguin
LQ Newbie
 
Registered: Jul 2002
Posts: 17

Rep: Reputation: 0
Quote:
Originally posted by Skilless

Weird, I thought I was scripting........guess not, huh? [/B]
nevermind. I guess you are. I gotta pay more attention to the posts I'm replying to before I reply
 
Old 12-11-2002, 12:14 AM   #7
Skilless
LQ Newbie
 
Registered: Dec 2002
Distribution: MDK 9.0
Posts: 8

Original Poster
Rep: Reputation: 0
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?
 
Old 12-11-2002, 10:36 AM   #8
Skilless
LQ Newbie
 
Registered: Dec 2002
Distribution: MDK 9.0
Posts: 8

Original Poster
Rep: Reputation: 0
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.....
 
Old 12-11-2002, 01:59 PM   #9
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 48
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
. 
.


if [ -e "/tmp/game" ]; then
   $gamename = `cat /tmp/game`
    /bin/rm /tmp/blah
   exec /path/to/startx.${gamename}
fi
You can test this by simply putting something like:
Code:
if [ -e "/tmp/blah" ]; then
  echo "Blah!!!"
  /bin/rm /tmp/blah
fi
at the end of your startx script, then write a very short script:

Code:
#!/usr/bin/env bash

touch /tmp/blah
killall name X
Disclaimer: I have not tested all of the above code, it's just there
as pseudocode to get you started.

Last edited by moses; 12-11-2002 at 02:07 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gaming Sfisher961 Linux - Games 2 09-19-2005 03:21 PM
Gaming browncow Ubuntu 1 05-26-2005 11:14 AM
Gaming fireedo Mandriva 1 05-06-2005 02:17 PM
who's into gaming? rusty_slacker General 25 01-14-2005 05:56 PM
Gaming 1_8_7 Linux - Software 5 11-21-2004 02:17 PM


All times are GMT -5. The time now is 09:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration