Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 111 112 [113] 114 115 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 908213 times)

Simmura McCrea

  • Bay Watcher
    • View Profile
    • My Steam profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1680 on: February 24, 2012, 02:40:55 pm »

C++. The exact error is "no default constructor to initialize arrays of objects".
Logged

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1681 on: February 24, 2012, 02:59:06 pm »

You probably want an array of pointers to these objects. You shouldn't really be using C arrays for non-POD types though, a list or vector is more appropriate.
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1682 on: February 24, 2012, 03:45:09 pm »

You probably want an array of pointers to these objects.
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #1683 on: February 24, 2012, 04:16:53 pm »

You probably want an array of pointers to these objects. You shouldn't really be using C arrays for non-POD types though, a list or vector is more appropriate.

Don't forget we have std::array for fixed size arrays nowadays (they are useful sometimes and don't let anybody tell you otherwise). Ironically, std::array is itself a POD type which means you can do std::array<int, 5> arr = { 1, 2, 3, 4, 5 }; xD But I don't think it works without a default constructor so here it's useless.

So you want an array, and none of the objects in the array have a default constructor? Hmm, std::vector or list would work as memory isn't constructed until you push_back/insert/whatever so the copy/move would be used and s'all good. std::array wouldn't here so maybe something an array of chars and reinterpret_casts to make it treat them as the class...
« Last Edit: February 24, 2012, 04:28:48 pm by MorleyDev »
Logged

Simmura McCrea

  • Bay Watcher
    • View Profile
    • My Steam profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1684 on: February 24, 2012, 04:28:10 pm »

I tried a list beforehand, but I can't seem to get a list of a list of objects working. I'll try an array of pointers, then.
Logged

alfie275

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1685 on: February 24, 2012, 06:06:40 pm »

Btw, a default constructor is one that takes no arguments. You could try vectors instead of lists, they are dynamic arrays with automatic expansion/contraction rather than linked lists.
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1686 on: February 25, 2012, 12:19:59 am »

Alright, I want to make a strategy game of some description, does anyone have any suggestions for what I could try to make?
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1687 on: February 25, 2012, 12:23:46 am »

That is more game design than programming. The programming part is making it once you know what it is you want to make...
Anyway, you could make an Worms type game!

alfie275

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1688 on: February 25, 2012, 07:57:39 am »

Start with something simple, maybe your own version of chess?
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1689 on: February 25, 2012, 03:18:25 pm »

I hate myself, I want to learn it but I can't be bothered.

damn you C++! I will capture you tomorrow!
then the day after.

I feel like that sometimes too,
It's not hard, it's just a LOT of material to learn.

I have bouts of inspiration where I'll read a few hundred pages or so, then set the book aside for a few weeks or months, then pick it back up, spend a day catching up with what I already learned then go from there.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1690 on: February 25, 2012, 11:50:27 pm »

Ha! I think I'm finally making a breakthrough with using functions! It took a while, but I managed to get tonight's assignment calling everything correctly without asking for help  :D
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1691 on: February 25, 2012, 11:52:01 pm »

Nice work man! Every break through will become easier and easier the more you program, so these early ones are a big achievement.

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1692 on: February 25, 2012, 11:55:38 pm »

Yeah, for sure. Many thanks to the coders in this thread for being great teachers. One of these days I'll have something nifty to show off.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1693 on: February 26, 2012, 12:03:04 am »

Eh, if you have any cool tricks, you might have them sooner rather than later. Programmers tend to be dicks, in that instead of showing a simple technique and then maybe showing how it can be appropriated, they start with something complex for the sake of showing off what they can do.
Case and point, I have found better written tutorials 3d ray casting collision response, than simple 2d AABB rectangular collision response, and they always, no matter what, make it for rotating rectangles. You can't just hit two rigid, non-rotating blocks together, it has to be a oval and a spinning triangle.

Programmers aren't happy showing how to do something simple, because then they aren't flexing their muscles showing what leet maths dudes they are.

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1694 on: February 26, 2012, 12:13:32 am »

Max White, when you say 'collision response', what exactly are you referring to?
Logged
Pages: 1 ... 111 112 [113] 114 115 ... 796