Infinite horizon or Repeating objects

Hello again (after many years). I’d like to learn how to make games and decided to start with a simple (I hope) game. Ever played cubefield? http://www.yoarcade.net/cubefieldfullscreen.php , It’s a game where the blocks on the horizon infinitely spawn in front of you as you try to dodge them.

I don’t want to make it 100% accurate. Just the idea of dodging blocks.

My question is: How do I do go about making objects infinitely spawn on the horizon? I can imagine there are many ways to go about it. Would a simple python script do the trick?

I’ve never made a game, so I’m very novice and would appreciate anyone’s enlightened tips. Thanks in advance.

Excellent choice for a first project.

The core method used in games of this nature is a “treadmill”. So, you don’t actually move the player, but you move the world around him/her, giving the illusion of movement, while you spawn a never-ending stream of new obstacles from some “horizon source”.

Actually, I don’t know if you’re familiar with my BGE video tutorials, but in my “Tunnel Runner” series, I basically go through the development of a whole game that utilizes this method.

You can watch the videos here: Link

Thank you, Goran. I’m fascinated with this technology. I truly appreciate your contribution and look forward to viewing your vids :slight_smile:

so is the game you posted the link to yours? or a reference? eather way cool yet simple fun game! i started ot make one like this a few months ago but never went further with it.

mrn: It’s a reference. I’ve never made a game before. If my first game turned out that good then I’ve been doing the wrong thing all my life! :smiley:

Goran, love the tutorials so far. Great explanations as you are working. To me this is very important. I like the pace. Perhaps just a bit slower before making a click on something, but otherwise it’s great.

Little problem: For the 2nd video the mouse won’t move. I posted on youtube. Blender console looks like this:

Blender Game Engine Started
Python module can't be imported - object 'Player', controller 'Python':
Traceback (most recent call last):
  File "C:\Users\***\Documents\Blender	unnel_game.blend\Player.py",
line 5, in <module>
AttributeError: 'module' object has no attribute 'SetMousePosition'
Blender Game Engine Finished

SetMousePosition shouldn’t have a capital s at the beginning.

Also “mouse_move” doesn’t work:

KeyError: 'requested item "mouse_move" does not exist'

Doesn’t work for what? You’re accessing a key from a dictionary that doesn’t exist.

sdfgeoff: Thanks for pointing that out. Now that’s fixed, the mouse_move is still a problem. I don’t know what dictionary I’m missing.

This is the code I’ve written:

from bge import logic, render
from mathutils import Vector

screen_center = Vector((render.getWindowWidth()/2, render.getWindowHeight()/2))
render.setMousePosition(int(screen_center.x), int(screen_center.y))
render.showMouse(1)

def move():
    
    cont = logic.getCurrentController()
    mouse_move = cont.sensors["mouse_move"]
    
    mouse_pos = Vector(mouse_move.position)
    
    
    mouse_offset = mouse_pos - screen_center  
    mouse_offset.magnitude *= 0.001
    
    move = [mouse_offset.x, 0, -mouse_offset.y]
    
    player = cont.owner
    player.applyMovement(move)

agoose77: These errors and code are relative to the 2nd tutorial in the link Goran posted: TR[1] - Spawn randomization, and player movement

You didn’t rename the sensor to “mouse_move” - or so it seems.

Be sure to watch the videos carefully. Also, watch them fullscreen in 720p.

PS:

Glad you like the tuts :slight_smile:

Aha, the mouse sensor name was “Mouse_move”. Fixed that and all is well, thanks for that and keep em coming :smiley:

Goran: Question about video TR[4] Crusher blocks: In Blender 2.62, I don’t see f-curve in the logic brick actuator list. I found action, which has the frame selection, but that’s it. I tried using it but the crushers won’t move :confused: