You are not logged in.

#1 2018-12-06 19:39:22

imike
Member

Logging ingame events to reallife world (windows)

Hi guys. Great community! Please advice where to start...

I'm making some project i need understand - what is happening inside quake 1 game to link it to IoT (Arduino / raspbery pi) events...

For example:
Lightin RGB lamp in a room where i'm playing shoul'd reflect to health ammount. Green / Yellow / Red

Or

If i will kill some specific monster - something should happen

Or if i will open some door by rune / key - real room lock will be opened

Or... If i will finish a level - some real-life action will take part - like alarm or engine start... something like this...

I can grab some events from Windows - like COM port commands aor log files changes...

But how i can pass these events to COM/files/other logging from Q1?

Hope you got an idea... Please advice

Last edited by imike (2018-12-06 19:40:24)

#2 2018-12-07 18:20:44

dumptruck_ds
Member

Re: Logging ingame events to reallife world (windows)

I wish I could even begin to help with this but sounds like an intriguing project. I would suggest asking Spike or SHAMBLERNAUT on the Quake Mapping Discord QuakeC channel. https://discordapp.com/invite/j5xh8QT

#3 2018-12-08 13:13:13

Spirit
Administrator

Re: Logging ingame events to reallife world (windows)

I would recommend avoiding to alter an engine. If you must, I would rather increase the verbosity of the game/mod you are running! Check out gnounc's achievements mod, I think that would be a good base.

Then just pipe the output of the engine's stdout to a tool that will act on it. For example a bash or Python script.

import sys
from collections import defaultdict
from pprint import pprint

collected = defaultdict(int)

for line in sys.stdin:
    print(line, end='')
    #print(repr(line))  # to see control characters etc
    
    line = line.strip("\n")
    
    if line == "You got the Double-barrelled Shotgun":
        collected['ssg'] += 1
        collected['shells'] += 5
        pprint(dict(collected))
    elif line == "You get 5 shells":
        collected['shells'] += 5
        pprint(dict(collected))
    elif line == "You got the shells":
        collected['shells'] += 40
        pprint(dict(collected))
    elif line == "\x02the Slipgate Complex":
        print("wagga wagga")
        
pprint(dict(collected))

would give you

$ unbuffer quakespasm-svn | python act_on_engine_output.py 
Command line: quakespasm-svn
Found SDL version 2.0.9
Detected 4 CPUs.
Quake 1.09 (c) id Software
GLQuake 1.00 (c) id Software
FitzQuake 0.85 (c) John Fitzgibbons
FitzQuake SDL port (c) SleepwalkR, Baker
QuakeSpasm 0.93.1 (c) Ozkan Sezer, Eric Wasylishen & others
Host_Init
Playing registered version.
Console initialized.
UDP Initialized
Server using protocol 666 (FitzQuake)
Exe: 18:16:12 Nov 16 2018
256.0 megabyte heap
Video mode 1024x768x24 60Hz (24-bit z-buffer, 0x FSAA) initialized
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: GeForce GTX 560 Ti/PCIe/SSE2
GL_VERSION: 4.4.0 NVIDIA 340.107
FOUND: ARB_vertex_buffer_object
FOUND: ARB_multitexture
GL_MAX_TEXTURE_UNITS: 4
FOUND: ARB_texture_env_combine
FOUND: ARB_texture_env_add
FOUND: SDL_GL_SetSwapInterval
FOUND: EXT_texture_filter_anisotropic
FOUND: ARB_texture_non_power_of_two
FOUND: GLSL

Sound Initialization
SDL audio spec  : 44100 Hz, 512 samples, 2 channels
SDL audio driver: pulseaudio - Built-in Audio Analog Stereo, 32768 bytes buffer
Audio: 16 bit, stereo, 44100 Hz
CDAudio disabled at compile time

========= Quake Initialized =========

execing quake.rc
execing default.cfg
execing config.cfg
execing autoexec.cfg
=== Spirit ' s autoexec.cfg in id1 === 
Unknown command "sv_cheats"
Spirit's autoexec.cfg in id1 done 
3 demo(s) in loop
]map e1m1

FITZQUAKE 0.85 SERVER (24778 CRC)



the Slipgate Complex
wagga wagga
Using protocol 666
Spirit entered the game

         You can jump across...

You got the shells
{'shells': 40}
You get 5 shells
{'shells': 45}
You get 5 shells
{'shells': 50}
You get 5 shells
{'shells': 55}
You get 5 shells
{'shells': 60}
You get 5 shells
{'shells': 65}
You get 5 shells
{'shells': 70}
You get 5 shells
{'shells': 75}

        You found a secret area!

You got the Double-barrelled Shotgun
{'shells': 80, 'ssg': 1}

          Only 2 more to go...

You get 5 shells
{'shells': 85, 'ssg': 1}

          Only 1 more to go...

You get 5 shells
{'shells': 90, 'ssg': 1}
You receive 15 health

          Sequence completed!

You get 5 shells
{'shells': 95, 'ssg': 1}
You get 5 shells
{'shells': 100, 'ssg': 1}
You receive 15 health
You get 5 shells
{'shells': 105, 'ssg': 1}
You got the nails
You get 5 shells
{'shells': 110, 'ssg': 1}
You receive 15 health

    Walk into the slipgate to exit.


        You found a secret area!

You receive 100 health

    Walk into the slipgate to exit.

Mod_LoadTexinfo: 1 texture(s) missing from BSP file

FITZQUAKE 0.85 SERVER (24778 CRC)



Castle of the Damned
Using protocol 666
Client Spirit removed
Shutting down SDL sound
{'shells': 110, 'ssg': 1}
$ 

and of course you do whatever you can imagine in your script.

unbuffer makes sure your script receives the output in real-time. See https://unix.stackexchange.com/a/25375.

Last edited by Spirit (2018-12-08 13:55:22)

#4 Yesterday 12:07:19

Spirit
Administrator

Re: Logging ingame events to reallife world (windows)

Wow, I totally missed that you even wrote "windows" in the title, sorry! :D
But still I am sure you could do something similar on Windows.

#5 Today 14:38:51

imike
Member

Re: Logging ingame events to reallife world (windows)

Spirit wrote:

Wow, I totally missed that you even wrote "windows" in the title, sorry! :D
But still I am sure you could do something similar on Windows.

Thanks for such detailed reply. Certainly - i got an idea - will keep you informed )

I have never run Q1 on other than Dos/Win system - but i have exp in webdev. So i'll try to manage it.

Again - thanks for heading me to right direction!

Quick reply

Write your message and submit
Are you human or robot? If you have trouble, mail to spirit åt quaddicted døt c

Checking if this is requested by a real person and not an automated program.

Board footer