Welcome to DU!
The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards.
Join the community:
Create a free account
Support DU (and get rid of ads!):
Become a Star Member
Latest Breaking News
Editorials & Other Articles
General Discussion
The DU Lounge
All Forums
Issue Forums
Culture Forums
Alliance Forums
Region Forums
Support Forums
Help & Search
Gaming
Related: About this forumWhere might I have seen a link to an example of gaming programming?
I was a programmer all my professional life, but I'm 81 and retired over 10 years ago and never got near programming on the web. I've been curious about what code for controlling a game looks like, and saw a link somewhere a few days that looked like it would be just that. I don't know if it was on DU or not, but a search of DU for "gaming" only shows Subjects, not content.
Ideas?
Thanks,
LAS
3 replies
= new reply since forum marked as read
Highlight:
NoneDon't highlight anything
5 newestHighlight 5 most recent replies

Where might I have seen a link to an example of gaming programming? (Original Post)
LAS14
22 hrs ago
OP
Inkey
(388 posts)1. Look for Steam programing
They have been active in creating and
updating game programs for a while now.
Jim__
(14,722 posts)2. I googled example of gaming programming
Here's the quick answer from AI:
A simple example of game programming involves creating a basic interactive element, like a character that moves in response to player input. This could be done using a scripting language like Lua, Python, or JavaScript within a game engine, or even with C++ for lower-level game development.
Here's a simplified example using a hypothetical GameEngine and Lua:
-- Define a player character object
player = {
x = 0, -- Initial x position
y = 0, -- Initial y position
speed = 5, -- Movement speed
}
-- Function to handle player input
function handleInput(input)
if input == "left" then
player.x = player.x - player.speed
elseif input == "right" then
player.x = player.x + player.speed
end
end
-- Game loop function
function gameLoop()
-- Check for input (e.g., keyboard input)
if (GameEngine.getKeyPress("left"

handleInput("left"

elseif (GameEngine.getKeyPress("right"

handleInput("right"

end
-- Update the game world (e.g., display the character)
GameEngine.drawCharacter(player.x, player.y)
-- Call the game loop again after a delay
GameEngine.setNextFrame(gameLoop)
end
-- Start the game
GameEngine.startGame(gameLoop)
LAS14
(15,167 posts)3. Perfect!! Thanks so much. nt