Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411259 Posts in 69320 Topics- by 58379 Members - Latest Member: bob1029

March 26, 2024, 01:04:49 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
  Show Posts
Pages: 1 ... 5 6 [7] 8 9 ... 14
121  Developer / Technical / Re: Bad Coding Habits on: April 13, 2011, 05:47:47 PM
I am used to make everything as short as possible, but some programming languages become really confusing to do it that way.
122  Player / Games / Re: OnLive and indie game developers on: April 12, 2011, 03:20:12 AM
With streaming it is possible to write a network multiplayer game without network code. Everything runs on the server. But I don't know weather the SDK supports that.
123  Player / Games / Re: Giant robots. on: April 12, 2011, 03:16:06 AM
I like Total Annihilation, it is not a Mech Game, but it has this giant

. If you want to play this game with modern graphics go here SpringRTS
124  Player / General / Re: Things that Suck on: April 12, 2011, 02:54:54 AM
endless forum threds, nobody reads it anyway
125  Community / Tutorials / Re: Quaternion Mathematics on: April 11, 2011, 09:48:54 AM
Can you also say how to represent an orientation with a directional vector and an up vector as quaternion?
126  Developer / Technical / Re: What do you Love/Hate about programming languages? on: April 11, 2011, 05:32:14 AM
Scala solves all many of my needs

+ expressive and minimal
+ typesave
+ typeinference
+ multiparadigma
+ Big Library
+ Native support for concurrency (actor)
+ portable
+ build in sofware design pattern (singleton, future ,factory)
+ performance (as much as Java)
+ scaleable
+ awesome

example, define the for loop from c in scala:
Code:

def cfor(init: => Unit,cond: => Boolean,inc: => Unit)(fun: => Unit){
    init
    while(cond){
        fun
        inc
    }
}

val s = "next"
var i = 0;
cfor(i = 0,i<10,i+=1){
    printf("%s: %d\n",s,i)
}


other things:
+ linux package manager (developing c++ is so much more comfortable with a package manager)

things I do not like:
- XML editing. XML sucks, because its unreadable, unexpressive and ugly
- Ant, Ivy, Maven (its xml)
- jvm classpath, it never finds anything.
- C/C++ development under windows.
- dynamic typing
127  Developer / Technical / Re: Updating a big map full of tiles on: April 10, 2011, 07:13:31 AM
1. don't update anything at all:

if something happens (world has changed)
 calculate whrere it happened and update only those tiles in range.

2. if you want that an action has an reaction in the future (eg a wall is gone, some tiles are now in sunlight and there should grow grass in the future)
create a sorted queue of actions, so that you can check for every frame if something has to happen this frame.
this queue can look like this:
Code:
    time    coord   action
    227     99,99   grow grass
    373     54,32   grow tree
    500     12,21   remove burning block
everything is sorted by time, and elements with time<currentFrame are removed

3. water is always fake

4. if you really need to update everything, dont update everything in each frame, make it concurrent and chech the result 10 or 60 frames later.
128  Community / Tutorials / Re: Antymattars text engine. on: April 10, 2011, 03:30:37 AM
I have no game maker so please excuse me that I cannot test your text engine. I have no Idea by what you mean by text engine. Is it an engine for text adventures, or a tool for JRPG style dialog boxes, or just a font renderer. Or is it an ASCII art polygon renderer.

Without any information about what your text engine is, don't expect from anybody to download it. Screenshots or videos might explain more.
129  Community / Tutorials / Re: Antymattars text engine. on: April 09, 2011, 03:14:39 AM
maybe this belongs more to the feedback section. It sounds more like a training project.
130  Community / Tutorials / Re: Quaternion Mathematics on: April 08, 2011, 04:02:06 AM
thak you very much
131  Developer / Playtesting / Re: tactical squad space shooter on: April 06, 2011, 11:54:05 AM
nice to see a revival of the good old Bullfrog games. Naming suggestion: Alien squad.

But notice it is very important to something around the alien figting. Having a base and sending out the squad into missions like in UFO would be awesome.
132  Developer / Playtesting / Re: Oze - 2D platform exploring/mining game on: April 06, 2011, 11:44:50 AM
looks interesting.
133  Community / Tutorials / Re: Scala for Games II: Hello world on: April 06, 2011, 07:14:35 AM
yay feedback  Gentleman maybe we'll see some scala games in the next competition  Giggle
134  Community / Tutorials / vectors quaternions matrices on: April 06, 2011, 03:25:40 AM
on my task to write a tutorial for Scala to make games, I found these totorials for math. All examples are written in scala, but definitely it is an awesome library to represent vectors.

http://www.simplex3d.org/tag/math-tutorial/
135  Developer / Technical / Re: Camera Concept on: April 05, 2011, 08:48:26 AM
moving everything to the camery is not a bad at all. If you have an api that lets you control your camera free in space, there is no reason not to do this. In opengl you have this command:
Code:
glTranslate2d(-camera.x,-camera.y)
It will move everything that comes after the command so that the calculation of the position doesn't have to be recalculated for the objects you want to draw.
136  Developer / Technical / Re: Developer Tools (WIP) on: April 05, 2011, 07:29:11 AM
The collaborative editor Gobby. is a lightweight code editor that lets you and your friends edit the same source files at the same time. Like google docs, just for code and much faster.

I use it regularly, it does its job well, no slowdowns or crashes. Even undo works, and that's a non-trivial task in a multiple user environment.

The second tool is the IDE codeLite. The first version of code lite was just a demonstration tool for a new code completion tool that should integrated into other IDEs. But now code lite has evolved into a full working IDE itself.
137  Community / Writing / Re: Clever language joke stories on: April 05, 2011, 05:15:24 AM
For all how understand German:
besser fettarme Milch als Fettarme
138  Community / Creative / Re: What sort of things do you LOVE/HATE in games? on: April 05, 2011, 04:46:26 AM
thinks I like are all impressive new things. If a game offers new gameplay mechanics its cool. Copying the same into another without improving it is not cool. So be cool and steal enough ideas so that at least one of them is new to me.

-clumsy controls
-quick time events (drangons lair, God of War, Resident Evil)
-automated controls (fighting in Uncharted looks cool, but doing it sucks, because it is not me who decides how to attack)
-inflation of death (sunny boy kills thousands of Soldiers: Uncharted)
-inconsistency (Kratos in GoW can smash stone walls, but no wooden doors with a lock)
-grinding (insert any mmorpg here)
-generated gameplay (generator that creates 100 equal levels)
-invisible walls (whatever you do, dont implement invisible walls they suck)
-gamepad support limited to xbox 360 controller (there are so many cool input devices)
139  Community / Tutorials / Scala for Games II: Hello world on: April 04, 2011, 09:53:06 AM
This tutorial assumes you are interested to make games with scala. It will cover all steps you need to compile a project.

Everything you need to install is Simple Build Tool (sbt). With sbt you build your projects, solve dependencies, and do many more stuff. How to install sbt you can read here. This is everything you need to install, everything else is managed by sbt. Even downloading the scala compiler is done by sbt. For code editing notepad will be sufficient, yet.

now create a folder somewhere on your computer, and open that folder in a terminal. If you have done everything right in the first step, typing sbt will start sbt and you will be prompted if you want to Create a project. Now you have to enter some project specific details. Name Organisation and Version does not really matter it is only for you, but scala version and sbt version shound not be changed (just hit enter). Now the download of many dependencies starts. After it has finished you should have new folders, and in the terminal you are now in the interactive sbt shell. The most important command you can type here is run. It compiles and runs your project. To test this, you can create a new source file Main.scala in src/main/scala with the following content:
Code:
object Main{
  def main(args:Array[String]){
    println("Hallo Welt")
  }
}
This is just a Hello world program. BTW ~run will automatically compile and run your code every time you save your sourcecode.

For our project we can use the LWJGL project plugin. Create a file plugin.scala in project/plugin (folder needs to be created) with the following content

Code:
import sbt._

class Plugin(info: ProjectInfo) extends PluginDefinition(info) {
  val lwjglVersion = "com.github.philcali" % "sbt-lwjgl-plugin" % "2.0.4"
}
this is the plugin definition file. It sets the dependencies to all deeded plugin. If you want to use more plugins for your project, you will have to define them in this file.

Now we also need our project definition, create a file project.scala in project/build (folder needs to be created) with the following content

Code:
import sbt._

class Project(info: ProjectInfo) extends LWJGLProject(info)
This is our project definition. there is no project specific configuration yet, because everything we need to run a LWJGL project is inherited by LWJGLProject.

in our sbt terminal we now need to do the folloing two commands

reload reloads project definition
update downloads dependencies

now everything is ready to write an LWJGL project. If you are interested how this lwjgl project definition looks like, you can see it in project/plugins/src_managed/sbt-lwjgl-plugin-2.0.4/LWJGLProject.scala. There are also project defitiontions of Slick and JMonkey projects, to use them your project definition would look like:
Code:
class Project(info: ProjectInfo) extends LWJGLProject(info) with JMonkey
or
Code:
class Project(info: ProjectInfo) extends LWJGLProject(info) with Slick2D

to make the home project a little bit more interesting I have created a simple template project that can then be modified into any other project, it is a little bit more than the classic rotating triangle (IKJL for controls). just override your main scala source with:

Code:
import org.lwjgl._
import opengl.{Display,GL11,DisplayMode}
import GL11._
import input._
import math._

object Main{
  val GAME_TITLE = "My Game"
  val FRAMERATE = 60
  val width = 640
  val height = 480

  // init needs to be called before display list of player can be created
  init
  
  var finished = false

  def main(args:Array[String]){
    while(!finished){
      Display.update
      
      logic
      render

      Display.sync(FRAMERATE)
    }
  }

  def init{
    println("init Display")
    Display.setTitle(GAME_TITLE)
    Display.setVSyncEnabled(true)
    Display.setDisplayMode(new DisplayMode(width,height))
    Display.create

    println("init gl")
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHTING)
    glEnable(GL_LIGHT0)
    adjustcam
  }

  def adjustcam{
    val v = width.toFloat / height.toFloat
    
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity
    glFrustum(-v,v,-1,1,1,100)
    glMatrixMode(GL_MODELVIEW)
  }

  def cleanup{
    Display.destroy
  }

  def logic{
    import Keyboard._

    if(isKeyDown(KEY_ESCAPE))
      finished = true
    if(Display.isCloseRequested)
      finished = true
    
    Player.update
    Camera.update
    // this rotates our camera around the center
  }

  def renderGrid(size : Int){
      // this creates the nice looking background.
    glDisable(GL_LIGHTING)
    glBegin(GL_LINES)
    for(i <- -size to size){
      glVertex2i(i,-size)
      glVertex2i(i, size)
      glVertex2i(-size,i)
      glVertex2i( size,i)
    }
    glEnd
    glEnable(GL_LIGHTING)
  }

  def render{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    Camera.apply
    Player.draw
    
    //without background, motion is not visible
    // a green grid is nice and retro
    glColor3f(0,1,0)
    renderGrid(1000)
  }
}

object Camera{
  var angle = 0.0f
  var rotation = 0.0f

  def update{
    angle += 2.0f % 360
    rotation += 0.2f
  }

  def apply{
    glLoadIdentity
    glTranslatef(0,0,-20)
    glRotatef(-70,1,0,0)
    glRotatef(rotation,0,0,1)
  }
}

// the player is a singleton, because we only have one player
// if we want to make this game into a multiplayer game, we only need to
// replace object with class, and instanciate some player objects.
object Player
{
  // short form to init three variables
  var x,y,z = 0f

  val vertexData = BufferUtils.createFloatBuffer(18);
  val normalData = BufferUtils.createFloatBuffer(18);
  
  vertexData.put(Array[Float](0,0,0.5f, -0.5f,-0.5f,0, -0.5f, 0.5f,0,  0.5f, 0.5f,0,  0.5f,-0.5f,0, -0.5f,-0.5f,0)).flip
  normalData.put(Array[Float](0,0,   1, -1   ,-1   ,1, -1   , 1   ,1,  1   , 1   ,1,  1   ,-1   ,1, -1   ,-1   ,1)).flip
  
  val displayList = glGenLists(1)
  
  glEnableClientState(GL_VERTEX_ARRAY)
  glEnableClientState(GL_NORMAL_ARRAY)
    
  glVertexPointer(3,0,vertexData)
  glNormalPointer(0,normalData)
    
  glNewList(displayList,GL_COMPILE)
  glDrawArrays(GL_TRIANGLE_FAN,0,6)
  glEndList
  
  glDisableClientState(GL_VERTEX_ARRAY)
  glDisableClientState(GL_NORMAL_ARRAY)

  def update{
    // in scala we can locally import all methods from Keyboard.
    import Keyboard._

    // rx and rx store our keyboard input as direction
    var rx,ry = 0

    // keys are IKJL for up down left right

    if(isKeyDown(KEY_I))
      ry += 1
    if(isKeyDown(KEY_K))
      ry -= 1
    if(isKeyDown(KEY_J))
      rx -= 1
    if(isKeyDown(KEY_L))
      rx += 1
      
    // this makes the direction relative to the camera position
    // it is a simple rotation matrix you may know from linear algebra
    val ax = rx*cos(-Camera.rotation.toRadians)-ry*sin(-Camera.rotation.toRadians)
    val ay = rx*sin(-Camera.rotation.toRadians)+ry*cos(-Camera.rotation.toRadians)

    x += 0.1f*ax.toFloat
    y += 0.1f*ay.toFloat
  }
  
  def draw = {
    glPushMatrix
    glTranslatef(x,y,z)
    glRotatef(Camera.angle, 0, 0, 1.0f)
    glColor3f(1, 0, 0)
    glCallList(displayList)
    glPopMatrix
  }
}


ok, thats all about setting up LWJGL. From here on you can edit your code, compile your project and do whatever you want to do. But for syntax highlighting, you should use one of the supported editors. I am using Gedit, but Jedit does work as well as the cooperative editor gobby. IntelliJ (complete Java IDE) does also work. The good thing is, there is an sbt plugin that generates the IntelliJ project files for you, and a plugin for IntelliJ (use the plugin manager) that lets you use sbt inside of intelliJ.

(any response even negative response is welcome)
140  Community / Tutorials / Re: I'm going on a long path to learn programming on: April 04, 2011, 09:09:30 AM
for games i would recommend Processing. Java is not the best language out there, but processing had done a great job in making game programming a nice experience.

If you just want to learn a programming language, I would recomment Scala. It is optimised in expressiveness, consistency and is 100 times faster than Python.
Pages: 1 ... 5 6 [7] 8 9 ... 14
Theme orange-lt created by panic