Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

What programming topic would you want the next challenge to be about?  (It might be a good opportunity to focus on a subject you're not familiar with or to reinforce knowledge on one that you already know)

Control Flow
- 2 (2.2%)
Arrays, Strings, Pointers, and References
- 8 (9%)
Functions
- 4 (4.5%)
Basic object-oriented programming
- 30 (33.7%)
A bit more advanced OOP (Composition, Operator overloading, Inheritance, Virtual Functions)
- 18 (20.2%)
Templates
- 8 (9%)
Other (Explain)
- 4 (4.5%)
Working with files?  (Streams)
- 15 (16.9%)

Total Members Voted: 89


Pages: 1 ... 48 49 [50] 51 52 ... 78

Author Topic: Programming Challenges & Resources (#bay12prog) Initiative  (Read 95896 times)

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #735 on: December 28, 2010, 01:32:47 pm »

I can't really tell. What language is that?
Logged

IHateOutside

  • Bay Watcher
  • Fire safety is for wimps.
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #736 on: December 28, 2010, 01:33:59 pm »

I can't really tell. What language is that?
looks like c (++)


Anyone know any decent tutorials for VB.net ? Trying to work something out and I can't find much through google.
Logged

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #737 on: December 28, 2010, 01:48:26 pm »

Looks like c or some shell, maybe bash. It doesn't really matter though, as all they show there are mathematical tricks, which work everywhere.
Oh, and I forgot to post this http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/ which is just as cool.

e,
Anyone know any decent tutorials for VB.net ? Trying to work something out and I can't find much through google.
Syntax is very similar across many languages (eg, C++, C#, etc.), so I'd say, just try doing stuff. If something doesn't compile, look it up.
« Last Edit: December 28, 2010, 02:09:00 pm by ILikePie »
Logged

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #738 on: December 30, 2010, 01:21:46 pm »

The Python thread has inspired me to try write a tic tac toe game in bash, here's what I have so far:
Code: [Select]
#!/bin/bash

player='X'
comp='O'
blank='_'

# initialize board:
for ((i=1; i<10; i++)); do
    board[$i]=$blank
done

function is_int() {
    if [[ $1 =~ ^[0-9]+$ ]]; then
    return 1
    else
    return 0
    fi
}

function draw_board () {
    for ((i=1; i<10; i++)); do
    echo -en "${board[$i]} "
    if [ $(($i%3)) == 0 ]; then
        echo -en "\n"
    fi
    done
}

function move () {
    if [ ${board[$1]} == $blank ]; then
    board[$1]=$2
    return 1
    else
    return 0
    fi
}

draw_board
echo -n "Please make your move: "; read move
while ! (move $move $player); do
    read move
done
draw_board

exit 0
I'm having problems with the last while loop.
Code: [Select]
while ! (move $move $player); do
      read move
  done
It's supposed to run the move function until the player makes a valid move, but instead, it just hangs.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #739 on: December 30, 2010, 03:45:01 pm »

Hmmm. So, I'm going to do scripting support for my actual game logic.
So, I've got a C++ engine that "does all the real shizzle", now to choose a language.

I'm currently looking at Lua for being light-weight, or maybe Python for more options. What say you?
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

alfie275

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #740 on: December 30, 2010, 04:12:31 pm »

Lua, it's pretty damn fast and seems pretty common, eg, Cortex Command, Gmod etc.
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #741 on: December 30, 2010, 05:27:02 pm »

Yeah, I read some Python vs Lua summaries, and Lua seems like the better tool for the job, since it's A: mostly configuration and B: C++ integration is one of it's strong suits.

I could do everything in C++ but the rapid development (not having to recompile the entire thing every time) appeals to me, and I do a lot of scripting-inside-a-c-app already at work, so I'm used to it. So Lua it is.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #742 on: December 30, 2010, 07:53:37 pm »

Small programming dilemma. Should I dynamically (or whatever) create items by having an empty item template and assigning values to it (such as size, weight, value, description etc.) and do that each time, or should I make a list of predefined items and pick one from that?

Don't go around pretending you will add stats.

either think of them now, or change everything later.
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #743 on: December 30, 2010, 08:02:54 pm »

Why not have both? You could just have a list of predefined items and a function to add new ones if needed. Of course, I don't know how difficult that would be with the game architecture and programming language you're using, so feel free to ignore this. Easiest way would probably be to represent your objects as a hash list, so you can just add anything by keyword and retrieve it's value when needed.
« Last Edit: December 30, 2010, 08:05:25 pm by Virex »
Logged

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #744 on: December 30, 2010, 09:25:54 pm »

Why not have both? You could just have a list of predefined items and a function to add new ones if needed. Of course, I don't know how difficult that would be with the game architecture and programming language you're using, so feel free to ignore this. Easiest way would probably be to represent your objects as a hash list, so you can just add anything by keyword and retrieve it's value when needed.
complexity.......stability,maintenance, ease of coding

and of course, less surface area for the inpouring of bugs.
Logged

Normandy

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #745 on: December 30, 2010, 11:21:16 pm »

I'd have to agree with eerr here. Things can get very complex and inconsistent very quickly when programming so generically. Build strong consistency in your methods first before making them generic - that way, you can isolate bugs and make sure that your system works well.

That being said, don't be afraid to use hash lists once it's clear what functionalities you will need them for. Just make sure the framework is there first.
« Last Edit: December 30, 2010, 11:22:58 pm by Normandy »
Logged

IHateOutside

  • Bay Watcher
  • Fire safety is for wimps.
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #746 on: January 01, 2011, 05:59:41 pm »

This is a bit annoying now. Why won't this do anything? It doesn't seem to recognise any key presses at all.
VB10.net before I forget

Code: [Select]
   
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
            Case Keys.Right
                Timer1.Start()
            Case Keys.Left
                Timer2.Start()
            Case Keys.Up
                Timer3.Start()
            Case Keys.Down
                Timer4.Start()
        End Select
    End Sub
Logged

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #747 on: January 03, 2011, 04:44:57 am »

I'm not too familiar, but I would reccomend a debug statement.

something which prints the value of e.keycode in that function, as well as key.right, everytime that function is called.

should flush out mos' any bug.
Logged

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #748 on: January 03, 2011, 09:06:14 am »

Also, do yourself a favor and import System.Windows.Forms.
Logged

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #749 on: January 03, 2011, 12:43:32 pm »

I got inspired by

EDIT: Jopax, I feel that someone needs to make "Robot Rainbow Ostrich Attack" after seeing that.

To make this thing:

Code: (C++) [Select]
#include <iostream>
#include <string>

int main()
{using namespace std;string _;string $; string € = "!?.";int Ω=0; int ¥;while(Ω++<4)cout<<"Robot Rainbow Ostrich Attack!\n\n";
cout<<"You see an ostrich! What do you do?\n\n";cin>>$;_+=$;_+=" ";do{cin>>$;_+=$;_+=" ";}while(_.find_first_of(€)==_.npos);
do{Ω=_.find_first_of(€);_.replace(Ω,1,"");¥=_.find("I ");if(¥!=_.npos)_.replace(¥,1,"");else;}while(_.find_first_of(€)!=_.npos)
;cout<<"\nOh no! Your attempts to "<<_<<"fail because the ostrich managed to eat you first.\n\nGame Over.\n\n";Ω=0;return Ω;}
Logged
Pages: 1 ... 48 49 [50] 51 52 ... 78