[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Gamedev

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 37
Thread images: 9

File: pro_coder_being_awesome.gif (2MB, 320x200px) Image search: [Google]
pro_coder_being_awesome.gif
2MB, 320x200px
To: Amateur Gamedevs of /g/
For: Training purpose


- Develop the core gameplay of a game of Snake (aka. Nibbler, Blockade, ...).
- The code should be in only one file
- You should do it today.
- Post the source ITT and at least a screenshot or a webm.
>>
>>56948154
thanks
>>
>>56948154
To: OP
For: This thread
"No"
>>
>>56948154
#include <stdio.h>

int main()
{
printf("Welcome to the press Enter game!\n"
"Press enter to begin: ");

getchar();

printf("You win!\n");
}
>>
File: snakentor_pic_2.png (9KB, 800x640px) Image search: [Google]
snakentor_pic_2.png
9KB, 800x640px
Finished for now I think.
>>
I'm on my phone so pseudo code but
DIM = 11
board = new DIM by DIM array of ints initialized to 0s
dir = N // N/S/E/W
pos = getRandomCoord()
bonus = getRandomCoord()
while (bonus == pos) bonus = getRandomCoord()
len = 1
board[pos] = len
board[bonus] = -1
end = false

until end {
sleep(200) // adjust for movement speed here
nextSpace = pos
if dir == N
nextSpace.y -= 1
else if dir == S
nextSpace.y += 1
//etc for E and W
if nextSpace is outside array
end in loss
else if board[nextSpace] == -1
len +=1
board[nextSpace] = len
pos = nextSpace
if len != DIM * DIM
while board[bonus] != 0
bonus = getRandomCoord()
board[bonus] = -1
else if board[nextSpace] > 0
end in loss
else
foreach space in board
if space > 0
space -= 1
board[nextSpace] = len
pos = nextSpace
}

Also need a callback to run whenever a direction key is pressed to change dir and a display loop to display everything but as I said, I'm on a phone so fuck that.

I realize that this method takes O(DIM^2) work each loop but that's still pretty small at any board size people will be playing and I haven't done analysis but I believe it'd end up being faster than other alternatives (unless language has really optimized lists or maps or sets)
>>
>>56948761
Nice, I don't know the language, though, it doesn't seem to move the snake accordingly and there are some cases ("features") which are not handled, making the core gameplay not really implemented.
>>
>>56948856
>I don't know the language
>anon said it was pseudo code
:/
>>
File: Gremlins Industries blockade ad.jpg (197KB, 850x1098px) Image search: [Google]
Gremlins Industries blockade ad.jpg
197KB, 850x1098px
>>
>>56948563
GTA 5 in a nutshell.
>>
>>56948856
It's a made up language to express my thoughts. I guess it looks kinda like lua though

What is it missing? Snake grows as it eats bonuses, dies it it hits edge or self, bonuses continue to spawn until there's no space left.
>>
>>56948887
Well, a minor thing: the snake shouldn't be able to turn back on place (if it goes up, it can't go down immediately). And a mjor thing I think I noticed (but not sure) is that when the snake moves, either the whole array structure gets displaced or a FIFO structure gets a new head and pops the tail, if you see what I mean.
>>
>>56948154
>1 file
Just kill yourself.
>>
>>56948904
Ah fuck I forgot that backwards movement. That'd be handled in the keypress callback I didn't write out of laziness though.

The tail of the snake is 1, the head is len, body is values between 1 and len
Each step each value on snake gets decreased by one and new head is made with len as value so that it ends up with old tail as empty space (0), old 2 as new tail, etc
>>
>>56948949
ok, nice design.

>>56948948
Multiple files are confusing.
>>
>>56948154
>French
Nigger
>>
>>56949451
It's a common mistake, modern French people are not all black.
>>
I made it in TI-83's BASIC back in high school but I haven't done any "programming" since
>>
>>56948154
Do your own homework Tyrone
>>
>>56949611
I'm a teacher, mamadou. I already did that game multiple times.

>>56949579
Do it again now, then.
>>
File: 1461072678536.gif (109KB, 209x193px) Image search: [Google]
1461072678536.gif
109KB, 209x193px
Pirate and archivist/preservation autistic here.

To any of you that do game dev, I suggest you consider the following

>Console piracy once in effect is impossible to stop sure to the regulations put in place by sony Microsoft or nintendo
>There are ways to stop it but not without a lot of effort and managing to push data as an update without approval of said company which inherently breaches contracts and will kill the company
>Having someone familiar with pirating techniques is useful if you need to combat it

And
>Preservation and archiving of various wip builds and/or prototypes varying from final releases are important data to have
>leftovers in code can cause vulnerability issues and potential problems (see beyond two souls debug enabling - and the Ellen page model having tits that were fully modeled only visible due to leftover debug code)
>However keeping it in the game post release as it is usable to have access to extra data/modes in game that normally are inaccessible
>Preservation people love this shit and use it because it's good shit

However
>Piracy and preservation
>They are the same shit sometimes
>Pirate game v1.000
>Has extra data for debugging modes, level select, etc
>Pirate game v1.001
>Same shit minus leftover data for debugging modes
>Preservationists want 1.000 at all costs (or <1.000)

My suggestion to anyone in game dev right now
>Leave the code in there (not symbols as that will be impossible - leave easy methods to access said data's (text file of commands parameters or something)
>push a day-1 patch (base patch?)
>Put version checks on boot of game in it so it fails to play without patch (may be tough to pull off with the companies but you know what to do)
>Pirates get their shit fucked - will need to make a bypass of sorts (varies based on system)
>Preservationists get what they want - the data to dig into and poke at for documentation and get to make their work easier
>Everyone potentially wins from it
>More fun for the more you dig
>>
>>56948154
>being a gamedev
enjoy the shit pay and having your work be criticized by a million autists and neckbeards
>>
>>56949909
> being a wageslave
No thanks anyway.

> listening to users
Sounds dumb. Maybe only for the brightest users.
>>
>>56949982
>implying anyone ever listens to them
>>
>>56949755
the existence of content that had been cut prior to release has caused problems for developers before, remember "hot coffee"? rockstar got in big shit because of it, since it would have caused the game to have a higher ESRB rating, they were forced to release a new version with the data removed, despite the fact the content was not accessible without hacking the game
>>
>>56948154
>The code should be in only one file
That's a bad idea tho. Snake and other simplistic shit is for basic game logic and groundwork for enginedev. In a normal use case you wouldn't stick update, resources, render, sound and controls and actor/entity/gameobject managers into one file.
>Post the source ITT and at least a screenshot or a webm.
Not doing your homework.
>>
>>56950763
Your point about engine is pretty dumb, one file is superior, complex architecture in a lot of files should be left for the day you are really going to deliver a game engine as a third party.

For me, it's done more than 3 times already. What about you?
>>
File: nsnake.png (10KB, 484x361px) Image search: [Google]
nsnake.png
10KB, 484x361px
>>
up
>>
>>56950586
Correct anon but that's not the content I'm referring to.

Cut/leftover content is nice to have e, but the utilities devs only usually have access to in their game that are stripped before shipping is what I care about. Even if there's no leftover cutscenes, models, music, whatever else, the presence of a debug menu and functions is what matters a lot more.

If you recall dead island shipping with debug shit that's one to specifically point at for what I want to see more of.
>>
File: 1470104261257.gif (717KB, 200x189px) Image search: [Google]
1470104261257.gif
717KB, 200x189px
I'm actually developing a big game, all alone in stupidness...
how don't we have a general for this?

ps.. facing some serious issues figuring out how to proceed on my own game, send help!
>>
>>56949755
>piracy
>preservation
wth are you talkin about?
>>
>>56955925
/g/ has a programming general
/vg/ has a game dev general
>>
>>56956040
I couldn't find the /vg/ one, what was its name?
>>
>>56958189
Agdg
>>
>>56955574
debug menus are pretty neat to look around, but usually only because they make it easier to;
- cheat, such as a level select, a common feature of debug menus
- access/trigger levels and events that aren't normally accessible, aka, cut content
- audio test (i do wish games more consistently had an audio test menu)
etc

can you imagine how much more shit rockstart would have been in if hot coffee could be triggered via a debug menu that could be gotten to without modifying the game? if this was the case, rockstar would have had a much harder time arguing that the content was not meant to be accessible/available
>>
OH NO

you made me remember that /sci/ thread

that was a wild thread
Thread posts: 37
Thread images: 9


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.